Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/docs/certifi-2024.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 authored Jul 19, 2024
2 parents aef1fbd + ffc646e commit 8f22c1c
Show file tree
Hide file tree
Showing 24 changed files with 140 additions and 578 deletions.
27 changes: 0 additions & 27 deletions .github/actions/create-dev-env/action.yml

This file was deleted.

59 changes: 0 additions & 59 deletions .github/actions/integration-tests/action.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/actions/load-image/action.yml

This file was deleted.

125 changes: 69 additions & 56 deletions .github/workflows/docker-build-test-upload.yml
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: ${{ inputs.platform != 'x86_64' }}
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_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
push: ${{ ! (github.event_name == 'pull_request' && 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
65 changes: 0 additions & 65 deletions .github/workflows/docker-merge-tags.yml

This file was deleted.

Loading

0 comments on commit 8f22c1c

Please sign in to comment.