-
Notifications
You must be signed in to change notification settings - Fork 97
118 lines (106 loc) · 2.64 KB
/
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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: tests
on:
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.gitignore'
branches:
- main
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.gitignore'
branches:
- main
permissions:
contents: read
env:
MODULE_NAME: clairvoyance
MIN_TEST_COV: 0
SERVER: http://localhost:4000
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install poetry
- name: Setup poetry
run: |
poetry config virtualenvs.in-project true
poetry install
- name: Run tests
run: |
source .venv/bin/activate
pytest --cov=$MODULE_NAME --cov-report=xml --cov-fail-under=$MIN_TEST_COV tests
system-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install poetry
- name: Setup poetry
run: |
poetry config virtualenvs.in-project true
poetry install
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install deps and run server
run: |
cd tests/apollo-server
npm install
node src/index.js &
- name: Wait for server
run: |
for i in {0..10}; do
echo "Sleep for 1 second ..."
sleep 1
if curl -s -o /dev/null "$SERVER"; then
echo "$SERVER returned HTTP response!"
break
fi
if [ $i -eq 10 ]; then
echo "Server did not respond after 10 seconds!"
exit 1
fi
done
- name: Test with pytest
run: |
source .venv/bin/activate
python -m unittest tests/system.py
lint:
runs-on: ubuntu-latest
if: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install poetry
- name: Setup poetry
run: |
poetry config virtualenvs.in-project true
poetry install
- name: Run lint
if: always()
run: |
source .venv/bin/activate
isort -m 9 --line-length 160 $MODULE_NAME tests --check-only
pylint --load-plugins pylint_quotes $MODULE_NAME tests
docformatter --wrap-summaries 160 --wrap-descriptions 160 -cr $MODULE_NAME tests
yapf -rd $MODULE_NAME tests
mypy -V
mypy $MODULE_NAME tests