Archive home directory using multi-stage build #64
Workflow file for this run
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
--- | |
name: Build Docker image | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: 1 | |
IMAGE: ghcr.io/aiidalab/qe | |
BUILDKIT_PROGRESS: plain | |
# 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: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Checkout Repo ⚡️ | |
uses: actions/checkout@v4 | |
- name: Login to Container Registry 🔑 | |
uses: docker/login-action@v2 | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- 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: Build and push image | |
id: build-upload | |
uses: docker/build-push-action@v5 | |
with: | |
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=max | |
cache-from: | | |
type=gha,scope=${{ github.workflow }} | |
- 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: Set jupyter token env | |
run: echo "JUPYTER_TOKEN=$(openssl rand -hex 32)" >> $GITHUB_ENV | |
- name: Run pytest for Chrome | |
run: pytest -sv --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: Screenshots | |
path: screenshots/ | |
if-no-files-found: error |