Bump Python to 3.13, add uv-secure, and update uv-based Dockerfile #164
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: Backend PR validation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "canopeum_backend/**" | |
| - ".github/workflows/canopeum_backend_pr_validation.yml" | |
| pull_request: | |
| branches: | |
| - main | |
| - production | |
| paths: | |
| - "canopeum_backend/**" | |
| - ".github/workflows/canopeum_backend_pr_validation.yml" | |
| env: | |
| # Since the Django mypy extention RUNS the config file, we need a non-empty secret to avoid | |
| # ImproperlyConfigured("The SECRET_KEY setting must not be empty.") | |
| SECRET_KEY_DJANGO_CANOPEUM: mypy-ext | |
| # Avoid accidentally pulling in dependency-groups with uv run | |
| UV_NO_SYNC: true | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| working-directory: canopeum_backend | |
| jobs: | |
| django-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| - run: uv sync --locked --no-dev | |
| - name: Run Django Tests | |
| run: uv run manage.py test | |
| uv-secure: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| working-directory: canopeum_backend | |
| - run: uvx uv-secure[faster-async] | |
| mypy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| working-directory: canopeum_backend | |
| - run: uv sync --locked | |
| - run: uv run mypy . | |
| pyright: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| working-directory: canopeum_backend | |
| activate-environment: true | |
| - run: uv sync --locked | |
| - uses: jakebailey/pyright-action@v2 | |
| with: | |
| version: PATH | |
| working-directory: canopeum_backend | |
| Ruff-Autofixes: | |
| runs-on: ubuntu-latest | |
| # Only run autofixes on PRs | |
| if: ${{ github.event_name == 'pull_request' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| # Token with Contents permissions to allow retriggering workflow | |
| token: ${{ secrets.PR_AUTOFIX_PAT }} | |
| - uses: astral-sh/ruff-action@v3 | |
| with: | |
| args: check --fix | |
| - uses: astral-sh/ruff-action@v1 | |
| # Format even on lint failure | |
| if: ${{ !cancelled() }} | |
| with: | |
| args: format | |
| - name: Commit autofixes | |
| uses: EndBug/add-and-commit@v9 | |
| # TODO: Prevent infinite loops, github.event.head_commit.author.name is not accessible in this context | |
| # if: ${{ github.event.head_commit.author.name != 'github-actions' }} | |
| # Push autofixes even on failure | |
| if: ${{ !cancelled() }} | |
| with: | |
| default_author: github_actions |