Skip to content

Bump eslint-config-beslogic to 3.0 and drop-pre-commit (#268) #69

Bump eslint-config-beslogic to 3.0 and drop-pre-commit (#268)

Bump eslint-config-beslogic to 3.0 and drop-pre-commit (#268) #69

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
jobs:
django-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: canopeum_backend
steps:
- uses: actions/checkout@v4
- name: Install uv using the standalone installer
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv sync --locked --extra dev
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Run Django Tests
run: python manage.py test
mypy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: canopeum_backend
steps:
- uses: actions/checkout@v4
- name: Install uv using the standalone installer
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv sync --locked --extra dev
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- run: mypy . --python-version=3.12
pyright:
runs-on: ubuntu-latest
defaults:
run:
working-directory: canopeum_backend
steps:
- uses: actions/checkout@v4
- name: Install uv using the standalone installer
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv sync --locked --extra dev
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- uses: jakebailey/pyright-action@v2
with:
version: PATH
python-version: "3.12"
working-directory: canopeum_backend
Ruff-Autofixes:
runs-on: unbuntu-latest
defaults:
run:
working-directory: canopeum_backend
# 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 }}
- run: echo "${{github.event.head_commit.author.name}}"
- uses: astral-sh/ruff-action@v1
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