-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (89 loc) · 3.31 KB
/
test.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
96
97
98
99
100
101
102
name: Run Django Tests
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
test:
name: Run Django Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13.4
env:
POSTGRES_DB: github_actions
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
options:
--mount type=tmpfs,destination=/var/lib/postgresql/data/
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up Python 3.10.8
uses: actions/setup-python@v1
with:
python-version: 3.10.8
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install library
run: poetry install --no-interaction
- name: Run tests
run: |
source .venv/bin/activate
pytest --runslow --cache-clear --durations 20 --cov=./ --cov-report=xml
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_BASE_BUCKET_ADDRESS: ${{ secrets.AWS_BASE_BUCKET_ADDRESS }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
DEFAULT_FROM_EMAIL_SES: ${{ secrets.DEFAULT_FROM_EMAIL_SES }}
DJANGO_ADMIN_LOGIN_PATH: ${{ secrets.DJANGO_ADMIN_LOGIN_PATH }}
EMAIL_HOST_PASSWORD_SES: ${{ secrets.EMAIL_HOST_PASSWORD_SES }}
EMAIL_HOST_SES: ${{ secrets.EMAIL_HOST_SES }}
EMAIL_HOST_USER_SES: ${{ secrets.EMAIL_HOST_USER_SES }}
FIELD_ENCRYPTION_KEY: ${{ secrets.FIELD_ENCRYPTION_KEY }}
OD_API_BASE_URL: ${{ secrets.OD_API_BASE_URL }}
OD_APPLICATION_ID: ${{ secrets.OD_APPLICATION_ID }}
OD_APPLICATION_KEY_1: ${{ secrets.OD_APPLICATION_KEY_1 }}
PYTEST_TEST_PASSWORD: ${{ secrets.PYTEST_TEST_PASSWORD }}
RECAPTCHA_PRIVATE_KEY: ${{ secrets.RECAPTCHA_PRIVATE_KEY }}
RECAPTCHA_PUBLIC_KEY: ${{ secrets.RECAPTCHA_PUBLIC_KEY }}
REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }}
REDIS_URL: ${{ secrets.REDIS_URL }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
SES_ACCESS_KEY: ${{ secrets.SES_ACCESS_KEY }}
SES_SECRET_KEY: ${{ secrets.SES_SECRET_KEY }}
DJANGO_SETTINGS_MODULE: ${{ secrets.DJANGO_SETTINGS_MODULE }}
SYSTEM_ENV: GITHUB_RUN_ID
- name: Upload Coverage Report to Codecov.io
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests