-
Notifications
You must be signed in to change notification settings - Fork 607
108 lines (102 loc) · 3.42 KB
/
Copy pathbackend.yml
File metadata and controls
108 lines (102 loc) · 3.42 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Backend
on:
push:
branches:
- main
paths:
- docker/**
- pontoon/**
- requirements/**
- .github/workflows/backend.yml
pull_request:
branches:
- main
paths:
- docker/**
- pontoon/**
- requirements/**
- .github/workflows/backend.yml
workflow_dispatch:
permissions: {}
jobs:
test:
name: pytest
env:
UV_SYSTEM_PYTHON: 1
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: pontoon
POSTGRES_PASSWORD: pontoon
POSTGRES_DB: pontoon
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U pontoon"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.13'
- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: |
**/requirements/*.txt
# Version should match the one used in docker/Dockerfile*
version: "0.11.32"
- name: Install requirements
run: uv pip install -r requirements/dev.txt
- name: Install pip-licenses
run: uv pip install 'pip-licenses==5.0.0'
- name: Check licenses
run: |
pip-licenses
pip-licenses --fail-on="GNU General Public License (GPL)" --ignore-packages text-unidecode translate-toolkit
# Set environment variables
- run: uv pip install pytest-dotenv
- run: >
sed
-e 's#^DATABASE_URL=.*#DATABASE_URL=postgres://pontoon:pontoon@localhost/pontoon#'
-e '/^SITE_URL=/d'
docker/config/server.env.template > .env
# Run collectstatic with minimal dependencies, skipping the actual front-end build
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with: { node-version: '24' }
- run: npm install
working-directory: pontoon
- run: mkdir -p translate/dist translate/public
- run: zensical build -f documentation/zensical.toml
- run: python manage.py collectstatic
# Check if there are missing migrations
- name: Verify missing migrations
run: python manage.py makemigrations --check
# Confirm that requirements have been correctly compiled.
# Ignore comments and empty lines.
- name: Check compiled requirements
run: |
bash docker/compile_requirements.sh
for file in requirements/*.txt; do
if ! diff <(grep -vE '^\s*#|^\s*$' "$file") <(git show HEAD:"$file" | grep -vE '^\s*#|^\s*$'); then
echo "Error: $file is not up to date. Please run 'make requirements' and commit the changes."
exit 1
fi
done
- name: Run tests
env:
COVERAGE_CORE: sysmon
run: pytest -n auto --cov-report=xml:pontoon/coverage.xml --cov=.
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
flags: backend
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}