-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (75 loc) · 2.59 KB
/
run_unit_tests.yml
File metadata and controls
83 lines (75 loc) · 2.59 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
name: Unit Tests Django CI
on:
pull_request:
branches:
- develop
push:
branches:
- develop
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Python 3.12
uses: actions/setup-python@v1
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev
- name: Run tests
env:
ALTCHA_HMAC_KEY: ${{ secrets.ALTCHA_HMAC_KEY }}
SECRET_KEY: default-secret-key-for-testing
DATABASE_ENGINE: django.db.backends.postgresql_psycopg2
DATABASE_NAME: test_db
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
DATABASE_PORT: 5432
ALLOWED_HOSTS: localhost
CORS_ALLOWED_ORIGINS: http://127.0.0.1
CSRF_TRUSTED_ORIGINS: http://127.0.0.1
DRF_RECAPTCHA_SECRET_KEY: default-recaptcha-secret-key
EMAIL_HOST: smtp.example.com
EMAIL_PORT: 587
EMAIL_USE_TLS: True
EMAIL_HOST_USER: user@example.com
EMAIL_HOST_PASSWORD: password
JDH_ORCID_API_TOKEN: default-token
GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN_GITHUB }}
BLUESKY_JDH_ACCOUNT: ${{ secrets.BLUESKY_JDH_ACCOUNT }}
BLUESKY_JDH_PASSWORD: ${{ secrets.BLUESKY_JDH_PASSWORD }}
FACEBOOK_JDH_PAGE_ID: ${{ secrets.FACEBOOK_JDH_PAGE_ID }}
FACEBOOK_JDH_ACCESS_TOKEN: ${{ secrets.FACEBOOK_JDH_ACCESS_TOKEN }}
OJS_API_KEY_TOKEN: default-token
OJS_API_URL: https://ojs-api-url-example.com
COPY_EDITOR_ADDRESS: copy-editor-address@mail.com
run: |
pipenv run ./manage.py test
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics