-
Notifications
You must be signed in to change notification settings - Fork 19
71 lines (70 loc) · 2.38 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
name: tests
on:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'
schedule:
# run tests every night at midnight
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Python 3
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel pytest
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --deploy --dev
- name: Set PYTHONPATH
run: |
echo "PYTHONPATH=./backend" >> $GITHUB_ENV
- name: Pytest with Coverage
env:
TEST_CONTROLLER_ACCOUNT: ${{ secrets.TEST_CONTROLLER_ACCOUNT }}
TEST_CONTROLLER_HOST: ${{ secrets.TEST_CONTROLLER_HOST }}
TEST_CONTROLLER_PASSWORD: ${{ secrets.TEST_CONTROLLER_PASSWORD }}
TEST_CONTROLLER_PORT: ${{ secrets.TEST_CONTROLLER_PORT }}
TEST_CONTROLLER_SSL: ${{ secrets.TEST_CONTROLLER_SSL }}
TEST_CONTROLLER_USERNAME: ${{ secrets.TEST_CONTROLLER_USERNAME }}
TEST_CONTROLLER_APPLICATION_ID: ${{ secrets.TEST_CONTROLLER_APPLICATION_ID }}
TEST_CONTROLLER_EUM_APPLICATION_ID: ${{ secrets.TEST_CONTROLLER_EUM_APPLICATION_ID }}
run: |
pipenv run pytest --cov=backend \
--cov=backend/api \
--cov=backend/api/appd \
tests -W ignore::DeprecationWarning
set -x
total=`pipenv run coverage report | grep TOTAL | tr -s ' ' | cut -d ' ' -f 4 | head -c -2`
if (( $(echo "$total <= 50" | bc -l) )) ; then
COLOR=red
elif (( $(echo "$total > 80" | bc -l) )); then
COLOR=green
else
COLOR=orange
fi
curl "https://img.shields.io/badge/coverage-$total%25-$COLOR" > ../coverage.svg
ls -la
- uses: actions/checkout@v2
with:
ref: 'github-workflow'
- name: Move coverage.svg to working directory
run: |
mv ../coverage.svg .
- name: Commit Coverage Badge
uses: EndBug/add-and-commit@v7
with:
add: 'coverage.svg'
author_name: commitbot
author_email: [email protected]
branch: github-workflow