-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (69 loc) · 2.06 KB
/
Copy pathrun-tests.yml
File metadata and controls
75 lines (69 loc) · 2.06 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
name: run-tests
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: [self-hosted, linux, X64]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: test
- name: Setup config
working-directory: test
run: |
python3 -c "
with open('cfg.ini', 'r+') as f:
d = f.read()
d = d\
.replace('DB_URL', '"'${{ secrets.DB_URL_TEST }}'"')\
.replace('DB_USER', '"'${{ secrets.DB_USER_TEST }}'"')\
.replace('DB_PASS', '"'${{ secrets.DB_PASS_TEST }}'"')\
.replace('DB_NAME', '"'${{ secrets.DB_NAME_TEST }}'"')\
.replace('EMAIL_PORT', '"'${{ secrets.EMAIL_PORT }}'"')\
f.seek(0)
f.write(d)
f.truncate()
f.close()"
- name: Install app
working-directory: test
run: |
python3.9 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install -e ".[testing]"
test:
needs: build
runs-on: [self-hosted, linux, X64]
steps:
- name: Initialize DB
working-directory: test
run: |
source .venv/bin/activate
alembic -c cfg.ini upgrade head
initialize_db
- name: Run linter
working-directory: test
run: |
source .venv/bin/activate
flake8
- name: Run tests
id: testStep
working-directory: test
run: |
source .venv/bin/activate
pytest -W error --cov=cyberdas --cov-report=xml
- name: Debug test failure
working-directory: test
if: ${{ always() && steps.testStep.outcome == 'failure' }}
run: |
source .venv/bin/activate
pytest -qs --no-summary
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
with:
files: ./test/coverage.xml
fail_ci_if_error: true
- name: Wipe files
run: rm -rf test