-
Notifications
You must be signed in to change notification settings - Fork 6
68 lines (61 loc) · 1.8 KB
/
run_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
###########################
###########################
## Python Unit tests ##
###########################
###########################
name: Unit tests
#############################
# Start the job on all push #
#############################
on:
push:
branches-ignore:
- 'main'
###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Unit tests
# Set the agent to run on
runs-on: ubuntu-latest
# multi-version python support
strategy:
matrix:
python-version: [3.8]
##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
module_dir=($(cd src; ls -d */ | grep -v common))
pip install wheel coverage coverage-badge
for dir in ${module_dir[@]}; do cd "src/$dir" || exit 1; pip install -r requirements.txt; cd ../.. || exit 1; done
- name: Run tests
id: test
run: |
coverage run -m unittest discover -s tests
coverage-badge -f -q -o .coverage
- name: Commit coverage
if: steps.test.conclusion == 'success'
run: |
if ! git diff --quiet HEAD; then
git config user.name github-actions
git config user.email [email protected]
git add .coverage.svg
git commit -m "adding coverage from Github Actions"
git push
else
echo "no changes detected"
fi