-
Notifications
You must be signed in to change notification settings - Fork 244
110 lines (107 loc) · 3.33 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
name: Tests
on:
pull_request:
branches:
- master
- dev
push:
branches:
- master
- dev
jobs:
#Eslint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Setup Node.js environment
# uses: actions/setup-node@v1.4.1
# with:
# node-version: '8.17'
# - run: npm install -g eslint@6.8.0
# - run: eslint static/js --ignore-path=static/js/.eslintignore
Pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt -r requirements.txt
- name: Pylint
run: |
bin/pylint.sh
Black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install Dependencies
run: |
pip install -r test_requirements.txt
- name: black formatting
run: |
bin/black.sh
Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Starting Server and DB
run: |
cd ./anyway-newsflash-infographics/
bash run.bash
cd ../
docker compose -f docker-compose.yml up -d --build anyway
- name: Waiting for DB startup
run: |
bash ./wait_for_postgres.sh
- name: DB Initialization
run: |
docker exec anyway alembic upgrade head
docker exec anyway ./main.py process cities
docker exec anyway ./main.py process streets
docker exec anyway ./main.py process registered-vehicles
docker exec anyway ./main.py process cbs --source local_dir_for_tests_only
docker exec anyway ./main.py process road-segments
- name: Tests
env:
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_KEY: ${{ secrets.TWITTER_ACCESS_KEY }}
TWITTER_ACCESS_SECRET: ${{ secrets.TWITTER_ACCESS_SECRET }}
GOOGLE_MAPS_KEY: ${{ secrets.GOOGLE_MAPS_KEY }}
APP_SECRET_KEY: ${{ secrets.APP_SECRET_KEY }}
github-token: ${{ secrets.GITHUB_TOKEN }}
run: |
docker exec anyway pip install -r ./test_requirements.txt
docker exec \
-e TWITTER_CONSUMER_KEY=$TWITTER_CONSUMER_KEY \
-e TWITTER_CONSUMER_SECRET=$TWITTER_CONSUMER_SECRET \
-e TWITTER_ACCESS_KEY=$TWITTER_ACCESS_KEY \
-e TWITTER_ACCESS_SECRET=$TWITTER_ACCESS_SECRET \
-e GOOGLE_MAPS_KEY=$GOOGLE_MAPS_KEY \
-e APP_SECRET_KEY=$APP_SECRET_KEY \
anyway pytest -v tests -m "not browser" --cov=. --cov-report=xml
- name: Logging docker in case of failure
if: failure()
run : |
docker ps
docker container inspect anyway
docker logs --details anyway
echo +-+-+-
docker container inspect db
docker logs --details db
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false