swap to using uv for project management #594
Workflow file for this run
This file contains hidden or 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: test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| concurrency: | |
| group: test-${{ github.head_ref }} | |
| cancel-in-progress: true | |
| env: | |
| PYTHONUNBUFFERED: "1" | |
| FORCE_COLOR: "1" | |
| jobs: | |
| generate-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| pyproject-file: pyproject.toml | |
| - id: set-matrix | |
| run: | | |
| uv run nox --session "gha_matrix" | |
| test: | |
| name: Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }} | |
| runs-on: ubuntu-latest | |
| needs: generate-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| pyproject-file: pyproject.toml | |
| - name: Run tests | |
| run: | | |
| uv run nox --session "tests(python='${{ matrix.python-version }}', django='${{ matrix.django-version }}')" | |
| tests: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: always() | |
| steps: | |
| - name: OK | |
| if: ${{ !(contains(needs.*.result, 'failure')) }} | |
| run: exit 0 | |
| - name: Fail | |
| if: ${{ contains(needs.*.result, 'failure') }} | |
| run: exit 1 | |
| types: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| pyproject-file: pyproject.toml | |
| - name: Run type checks | |
| run: | | |
| uv run nox --session "mypy" | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| pyproject-file: pyproject.toml | |
| - name: Generate code coverage | |
| run: | | |
| uv run nox --session "coverage" | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: .dockerfiles/Dockerfile | |
| load: true | |
| tags: django-email-relay-test:latest | |
| push: false | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Run container and check status | |
| run: | | |
| docker run -d --name test-container django-email-relay-test:latest | |
| sleep 10 | |
| if docker ps -f name=test-container --format '{{.Names}}' | grep -q test-container; then | |
| else | |
| docker logs test-container | |
| exit 1 | |
| fi | |
| - name: Clean up container | |
| if: always() | |
| run: | | |
| docker stop test-container || true | |
| docker rm test-container || true |