Skip to content

Add testing framework with Google Test and pytest #12

Add testing framework with Google Test and pytest

Add testing framework with Google Test and pytest #12

Workflow file for this run

# .github/workflows/docker.yml
name: Docker Build and Publish
on:
push:
branches: [ "main" ]
tags:
- 'v*'
pull_request:
branches: [ "main" ]
workflow_dispatch:
# Required for publishing to GitHub Container Registry
permissions:
contents: read
packages: write
jobs:
build-and-test:
name: Build Docker image and test build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
submodules: 'recursive'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: false
load: true
tags: mollerdb-dev:test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Verify build completes in container
run: |
docker run --rm -v ${{ github.workspace }}:/workspace mollerdb-dev:test bash -c "
set -e
echo '=== Verifying git submodules ==='
git config --global --add safe.directory /workspace
git submodule update --init --recursive
echo '=== Building mollerdb package ==='
pip install -e . --verbose --break-system-packages
echo '=== Verifying installation ==='
# FIXME Re-enable testing
#python -c 'import mollerdb; print(\"mollerdb imported successfully\")'
echo '=== Build verification complete ==='
"
publish:
name: Publish to GitHub Container Registry
needs: build-and-test
runs-on: ubuntu-latest
# Only publish on pushes to main or version tags
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
submodules: 'recursive'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max