Skip to content

Delay sandbox resolution til env build #211

Delay sandbox resolution til env build

Delay sandbox resolution til env build #211

Workflow file for this run

# This config runs the unit tests on linux
name: CI/CD Pipeline
on: [ push, pull_request ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
pip install -e '.[dev]'
- name: Test with PyUnit and collect coverage
run: |
coverage run
coverage combine
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
e2e-tests:
name: Run End to End Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build container for tests
run: docker compose build
- name: Run tests
run: docker compose up
- name: Verify test outputs
run: bash tests/e2e/verify.sh
build-and-push-image-generic:
if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main') }}
needs: [ unit-tests, e2e-tests ]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/generic
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
file: docker/generic.dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}/generic
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
build-and-publish-pypi:
runs-on: ubuntu-latest
permissions:
id-token: write
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: [ unit-tests, e2e-tests ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: pip install -e '.[dev]'
- name: Build
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1