forked from aiidalab/aiidalab-qe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove arm64 build * Move Dockerfile up * Remove firefox tests * Don't push to dockerhub
- Loading branch information
1 parent
4d7cadc
commit 71cf2ff
Showing
17 changed files
with
89 additions
and
549 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,91 @@ | ||
--- | ||
name: Build a new image and then upload the image, tags and manifests to GitHub artifacts | ||
name: Build Docker image | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
workflow_dispatch: | ||
|
||
env: | ||
OWNER: ${{ github.repository_owner }} | ||
FORCE_COLOR: 1 | ||
IMAGE: ghcr.io/aiidalab/qe | ||
BUILDKIT_PROGRESS: plain | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image: | ||
description: Image name | ||
required: true | ||
type: string | ||
architecture: | ||
description: Image architecture, e.g. amd64, arm64 | ||
required: true | ||
type: string | ||
runsOn: | ||
description: GitHub Actions Runner image | ||
required: true | ||
type: string | ||
# https://docs.github.com/en/actions/using-jobs/using-concurrency | ||
concurrency: | ||
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-test-upload: | ||
runs-on: ${{ inputs.runsOn }} | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
|
||
steps: | ||
- name: Checkout Repo ⚡️ | ||
uses: actions/checkout@v4 | ||
- name: Create dev environment 📦 | ||
uses: ./.github/actions/create-dev-env | ||
|
||
- name: Login to Container Registry 🔑 | ||
uses: docker/login-action@v2 | ||
if: ${{ !github.event.pull_request.head.repo.fork }} | ||
with: | ||
architecture: ${{ inputs.architecture }} | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Self-hosted runners share a state (whole VM) between runs | ||
# Also, they might have running or stopped containers, | ||
# which are not cleaned up by `docker system prun` | ||
- name: Reset docker state and cleanup artifacts 🗑️ | ||
if: ${{ startsWith(inputs.runsOn, 'ubuntu') }} | ||
run: | | ||
docker kill $(docker ps --quiet) || true | ||
docker rm $(docker ps --all --quiet) || true | ||
docker system prune --all --force | ||
rm -rf /tmp/aiidalab/ | ||
shell: bash | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build image 🛠 | ||
working-directory: docker | ||
run: docker buildx bake --set qe.platform=linux/${{ inputs.architecture }} -f docker-bake.hcl -f build.json --load | ||
env: | ||
# Use buildx | ||
DOCKER_BUILDKIT: 1 | ||
# Full logs for CI build | ||
BUILDKIT_PROGRESS: plain | ||
shell: bash | ||
- name: Docker meta 📝 | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
name=${{ env.IMAGE }} | ||
tags: | | ||
type=ref,event=pr | ||
type=edge,enable={{is_default_branch}} | ||
type=raw,value={{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | ||
- name: Run tests ✅ | ||
uses: ./.github/actions/integration-tests | ||
- name: Build and push image | ||
id: build-upload | ||
uses: docker/build-push-action@v5 | ||
with: | ||
architecture: ${{ inputs.architecture }} | ||
runsOn: ${{ inputs.runsOn }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
load: ${{ github.event.pull_request.head.repo.fork }} | ||
push: ${{ ! github.event.pull_request.head.repo.fork }} | ||
context: . | ||
platforms: linux/amd64 | ||
cache-to: | | ||
type=gha,scope=${{ github.workflow }},mode=min | ||
cache-from: | | ||
type=gha,scope=${{ github.workflow }} | ||
- name: Save image as a tar for later use 💾 | ||
run: | | ||
mkdir -p /tmp/aiidalab/ | ||
docker save ${{ env.OWNER }}/${{ inputs.image }} -o /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}.tar | ||
shell: bash | ||
if: always() | ||
- name: Set Up Python 🐍 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install Dev Dependencies 📦 | ||
run: pip install -r requirements-docker.txt | ||
|
||
- name: Upload image as artifact 💾 | ||
- name: Set jupyter token env | ||
run: echo "JUPYTER_TOKEN=$(openssl rand -hex 32)" >> $GITHUB_ENV | ||
|
||
- name: Run pytest for Chrome | ||
run: pytest --driver Chrome tests_integration/ | ||
env: | ||
QE_IMAGE: ${{ env.IMAGE }}@${{ steps.build-upload.outputs.digest }} | ||
|
||
- name: Upload screenshots as artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.image }}-${{ inputs.architecture }} | ||
path: /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}.tar | ||
retention-days: 3 | ||
if: always() | ||
name: Screenshots | ||
path: screenshots/ | ||
if-no-files-found: error |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.