Skip to content

Explicit test path

Explicit test path #3

Workflow file for this run

name: Build, Test & Push to GHCR
on:
push:
branches: [ workflow_test ]
tags:
- 'v*' # also build/push on version tags (e.g., v1.2.3)
permissions:
contents: read
packages: write
jobs:
build-test-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# Setup Buildx (BuildKit)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Log in to GitHub Container Registry
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PASSWORD }}
# Create dummy .env file for CI
- name: Create dummy .env for CI
run: |
echo "host_config_dir=/tmp/configs" > .env
echo "host_data_dir=/tmp/data" >> .env
echo "host_log_dir=/tmp/logs" >> .env
# Derive tags & labels
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=sha
type=ref,event=tag
# Build image locally (don't push yet)
- name: Build Docker image
uses: docker/bake-action@v5
with:
files: |
docker-compose.yaml
push: false
load: true
set: |
*.platform=linux/amd64
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
deepvisionxplain.tags=test-image:latest
# Run tests inside the built container
- name: Run tests in container
run: |
docker run --rm test-image:latest python -m pytest tests/ -v
# Only push if tests passed
- name: Push Docker image
uses: docker/bake-action@v5
with:
files: |
docker-compose.yaml
push: true
set: |
*.platform=linux/amd64
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
deepvisionxplain.tags=${{ steps.meta.outputs.tags }}