forked from data-for-change/anyway
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (101 loc) · 3.09 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
name: Tests
on:
pull_request:
branches:
- master
- dev
push:
branches:
- master
- dev
jobs:
#Eslint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Setup Node.js environment
# uses: actions/[email protected]
# with:
# node-version: '8.17'
# - run: npm install -g [email protected]
# - run: eslint static/js --ignore-path=static/js/.eslintignore
Pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r test_requirements.txt -r requirements.txt
- name: Pylint
run: |
pylint anyway tests main.py
Black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Install Dependencies
run: |
python -m pip install --upgrade black
- name: black formatting
run: |
black anyway/**/*.py -l 100 --verbose --check
Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Starting Server and DB
run: |
docker-compose -f docker-compose.yml up -d --build
- 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 registered-vehicles
docker exec anyway ./main.py process cbs
- 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@v1
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false