Skip to content

Arm64 support

Arm64 support #778

Workflow file for this run

---
# Build and test all Docker images on every push and pull request.
#
# Builds the images with docker buildx bake and pushes them to a local Docker
# image registry, and runs the automated tests with pytest.
name: continuous-integration
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
build_vars: ${{ steps.build_vars.outputs.vars }}
targets: ${{ steps.bake_metadata.outputs.targets }}
images: ${{ steps.bake_metadata.outputs.images }}
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Read build variables
id: build_vars
run: |
echo ::set-output name=vars::$(cat build.json | \
jq '[.variable | to_entries[] | {"key": .key, "value": .value.default}] | from_entries')
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
bake-target: __template__-meta
images: |
name=ghcr.io/aiidalab/__template__
tags: |
type=edge
type=ref,event=pr
type=raw,value={{tag}},enable=${{ github.ref_type == 'tag' && ! startsWith(github.ref_name, 'v') }}
type=match,pattern=v(\d{4}\.\d{4}(-.+)?),group=1
type=sha
- name: Generate docker-bake meta file.
env:
BAKE_TEMPLATE_META: ${{ steps.meta.outputs.bake-file }}
run: |
cat ${BAKE_TEMPLATE_META} | jq -c \
| .github/workflows/merge-bake-template-target.sh \
| tee docker-bake-template-meta.json
# - name: Build images with buildx bake
# id: bake
# uses: docker/bake-action@v3.0.1
# with:
# files: |
# docker-bake.hcl
# build.json
# docker-bake-template-meta.json
# push: true
# - name: Set output variables
# id: bake_metadata
# env:
# BAKE_TEMPLATE_META: ${{ steps.meta.outputs.bake-file }}
# run: |
# cat ${BAKE_TEMPLATE_META} | jq -c \
# | .github/workflows/merge-bake-template-target.sh \
# | jq -c '.target | [to_entries[] | {"key": (.key|split("-")[:-1] | join("_")), "value": [.value.tags[]][1]}] | from_entries' \
# | tee bake-meta.json
# targets=$(echo $(cat bake-meta.json | jq -c 'keys'))
# echo "targets=$targets" >> "${GITHUB_OUTPUT}"
# images=$(echo $(cat bake-meta.json | jq -c '. | [to_entries[] | {"key": (.key|ascii_upcase + "_IMAGE"), "value": .value}] | from_entries'))
# echo "images=$images" >> "${GITHUB_OUTPUT}"
- name: for test.
run: |
sha="sha-df0a6ea"
echo "images='{"BASE_IMAGE":"ghcr.io/aiidalab/base:${sha}","BASE_WITH_SERVICES_IMAGE":"ghcr.io/aiidalab/base-with-services:${sha-df0a6ea}","LAB_IMAGE":"ghcr.io/aiidalab/lab:${sha}","FULL_STACK_IMAGE":"ghcr.io/aiidalab/full-stack:${sha}"}'" >> "${GITHUB_OUTPUT}"
test:
needs: build
runs-on: self-hosted
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: check images
env: ${{ fromJSON(needs.build.outputs.images) }}
run: |
echo $BASE_IMAGE
echo $FULL_STACK_IMAGE
- name: Setup Python test environment
uses: mamba-org/provision-with-micromamba@v13
with:
cache-env: true
- name: Run tests
shell: bash -l {0} # required to activate the conda environment
env: ${{ fromJSON(needs.build.outputs.images) }}
run: pytest -v -m "not integration"
# integration-test:
# needs: build
# runs-on: [self-hosted, ubuntu-latest]
# timeout-minutes: 20
# steps:
# - uses: actions/checkout@v2
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Setup Python test environment
# uses: mamba-org/provision-with-micromamba@v13
# with:
# cache-env: true
# - name: Run integration tests
# shell: bash -l {0} # required to activate the conda environment
# env: ${{ fromJSON(needs.build.outputs.images) }}
# run: pytest -v -m "integration"
# release:
# if: >-
# github.repository == 'aiidalab/aiidalab-docker-stack'
# && (github.ref_type == 'tag' || github.ref_name == 'main')
# needs:
# - build
# - test
# runs-on: ubuntu-latest
# timeout-minutes: 10
# strategy:
# matrix:
# target: ${{ fromJSON(needs.build.outputs.targets) }}
# steps:
# - uses: actions/checkout@v2
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v4
# env: ${{ fromJSON(needs.build.outputs.build_vars) }}
# with:
# images: docker.io/aiidalab/${{ matrix.target }}
# tags: |
# type=edge
# type=raw,value={{tag}},enable=${{ github.ref_type == 'tag' && ! startsWith(github.ref_name, 'v') }}
# type=raw,value=aiida-${{ env.AIIDA_VERSION }},enable=${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
# type=raw,value=python-${{ env.PYTHON_VERSION }},enable=${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
# type=raw,value=postgresql-${{ env.PGSQL_VERSION }},enable=${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
# type=match,pattern=v(\d{4}\.\d{4}(-.+)?),group=1
# - name: Determine src image tag
# id: images
# run: |
# src=$(echo '${{ needs.build.outputs.images }}'| jq -cr '.[("${{ matrix.target }}"|ascii_upcase|sub("-"; "_"; "g")) + "_IMAGE"]')
# echo ::set-output name=src::${src}
# - name: Push image
# uses: akhilerm/tag-push-action@v2.0.0
# with:
# src: ${{ steps.images.outputs.src }}
# dst: ${{ steps.meta.outputs.tags }}
# - name: Docker Hub Description
# uses: peter-evans/dockerhub-description@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# repository: aiidalab/${{ matrix.target }}
# short-description: ${{ github.event.repository.description }}
# - uses: softprops/action-gh-release@v0.1.14
# name: Create release
# if: startsWith(github.ref, 'refs/tags/v')
# with:
# generate_release_notes: true