-
Notifications
You must be signed in to change notification settings - Fork 21
72 lines (68 loc) · 1.88 KB
/
run-automated-tests.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
name: Automated Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
types: [opened, reopened, synchronize]
jobs:
build:
runs-on: ubuntu-20.04
timeout-minutes: 45
services:
postgres:
image: postgres:16.1-alpine
env:
POSTGRES_DB: researchhub
POSTGRES_USER: rh_developer
POSTGRES_PASSWORD: not_secure
DB_PORT: 5432
DB_HOST: localhost
DB_USER: rh_developer
DB_PASS: not_secure
APP_ENV: test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:6.2-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Updating pip
working-directory: ./src
run: |
pip install poetry
poetry run pip install --upgrade pip
poetry run pip install -U pip setuptools
- name: Install Dependencies
working-directory: ./src
run: |
poetry install
- name: Run Tests
working-directory: ./src
run: |
cp config/ci/* config
poetry run python manage.py migrate
poetry run python manage.py collectstatic --noinput
poetry run coverage run manage.py test --verbosity=2
poetry run coverage xml -o coverage.xml
- name: Upload Coverage Report to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./src/coverage.xml