-
Notifications
You must be signed in to change notification settings - Fork 528
76 lines (71 loc) · 2 KB
/
backend.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
name: Backend
on:
push:
branches:
- main
paths:
- requirements/**
- docker/config/server.env.template
- pontoon/**
- .github/workflows/backend.yml
pull_request:
branches:
- main
paths:
- requirements/**
- docker/config/server.env.template
- pontoon/**
- .github/workflows/backend.yml
workflow_dispatch:
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 --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true
version: "0.4.13"
- run: >
uv pip install
-r requirements/default.txt
-r requirements/dev.txt
-r requirements/test.txt
-r requirements/lint.txt
# 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
- run: npm install
working-directory: pontoon
- run: mkdir -p tag-admin/dist translate/dist translate/public
- run: python manage.py collectstatic
- run: pytest --cov-report=xml:pontoon/coverage.xml
- uses: codecov/codecov-action@v4
with:
flags: backend
files: pontoon/coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}