forked from kobotoolbox/kpi
-
Notifications
You must be signed in to change notification settings - Fork 7
74 lines (71 loc) · 2.74 KB
/
pytest.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
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: pytest
on:
push:
branches: [ master, beta ]
pull_request:
jobs:
build:
runs-on: ubuntu-20.04
env:
DATABASE_URL: postgis://kobo:kobo@localhost:5432/kpi_test
DJANGO_LANGUAGE_CODES: "ar cs de-DE en es fr hi ku pl pt tr zh-hans"
DJANGO_SECRET_KEY: notSecretJustForTestingYep
DJANGO_SETTINGS_MODULE: kobo.settings.testing
REDIS_SESSION_URL: redis://localhost:6379
SERVICE_ACCOUNT_BACKEND_URL: redis://localhost:6379/4
CACHE_URL: redis://localhost:6379/3
strategy:
matrix:
python-version: ['3.8', '3.10']
services:
postgres:
image: postgis/postgis:14-3.2
env:
POSTGRES_USER: kobo
POSTGRES_PASSWORD: kobo
POSTGRES_DB: kpi_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis_cache:
image: redis:6.2
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
# We need this particular version, as npm 8.5.5 is the last version
# that works with our package.json :sadface:.
node-version: '16.15.0'
cache: 'npm'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install pip-tools
run: python -m pip install pip-tools==7.\*
- name: Update Debian package lists
run: sudo DEBIAN_FRONTEND=noninteractive apt-get -y update
- name: Install Debian dependencies
# All about YAML line breaks: https://stackoverflow.com/a/21699210
run: >-
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install
gdal-bin gettext libproj-dev postgresql-client ffmpeg
gcc libc-dev build-essential
- name: Install Python dependencies
run: pip-sync dependencies/pip/dev_requirements.txt
- name: Install JavaScript dependencies
run: npm install
- name: Update translations
run: git submodule init && git submodule update --remote && python manage.py compilemessages
# Intercom tests in Python fail if the front-end code has not been built
- name: Build front-end code
run: SKIP_TS_CHECK=true npm run build
- name: Test back-end code
# Explicitly name the directories where coverage should be measured;
# specifying just `--cov=.` includes `src`, which contains third-party packages
run: pytest --cov=hub --cov=kobo --cov=kpi -ra
- name: Run coveralls for back-end code
uses: AndreMiras/coveralls-python-action@develop