name: CI on: pull_request: branches: [main] push: branches: [main] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: pre-commit: name: Static Analysis (pre-commit) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12" - uses: pre-commit/action@v3.0.1 tests: name: Tests runs-on: ubuntu-latest services: postgres: image: postgres env: POSTGRES_PASSWORD: postgres options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 ports: - 5432:5432 steps: - uses: actions/checkout@v4 - name: Setup docker buildx uses: docker/setup-buildx-action@v3 - name: Build container image uses: docker/build-push-action@v5 with: push: false tags: ${{ env.IMAGE_NAME }}:ci target: ci load: true cache-from: type=gha cache-to: type=gha,mode=max - name: Run pytest uses: addnab/docker-run-action@v3 with: image: ${{ env.IMAGE_NAME }}:ci run: pytest