-
Notifications
You must be signed in to change notification settings - Fork 14
95 lines (90 loc) · 2.92 KB
/
canopeum_backend_pr_validation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
# Push autofixes even on failure & prevent infinite loops
if: ${{ !cancelled() && github.event.head_commit.author.name != 'github-actions' }}
with:
default_author: github_actions