-
Notifications
You must be signed in to change notification settings - Fork 2
102 lines (87 loc) · 3.31 KB
/
main.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
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Lint-Test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: General preparations
# create empty source/backend/resources/bpmn folder necessary for running certain functionalities
run: |
cd source/backend
mkdir -p resources/bpmn
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Backend unit tests
run: |
cd source/backend
export PYTHONPATH=. pytest
pytest --cache-clear --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov-config=unit-tests/.coveragerc --cov=. > pytest-coverage.txt
- name: Comment unit test coverage
if: ${{ github.event_name == 'pull_request'}}
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./source/backend/pytest-coverage.txt
coverage-path-prefix: source/backend/
junitxml-path: ./source/backend/pytest.xml
junitxml-title: Backend Unit Test Summary
title: Backend Unit Test Coverage Report (files with 100% coverage not shown)
badge-title: Backend Unit Test Coverage
- name: Extract unit test coverage for badge
if: ${{ github.ref == 'refs/heads/main' }}
id: coverageComment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./source/backend/pytest-coverage.txt
junitxml-path: ./source/backend/pytest.xml
hide-comment: true
- name: Post unit test badge data
if: ${{ github.ref == 'refs/heads/main' }}
uses: schneegans/dynamic-badges-action@v1.0.0
with:
auth: ${{ secrets.B_UNIT_COV_GIST_TOKEN }}
gistID: 1580622162fdac5e5c2571a4bf3cf13b
filename: pytest-coverage-comment__main.json
label: Backend Unit Test Coverage
message: ${{ steps.coverageComment.outputs.coverage }}
color: ${{ steps.coverageComment.outputs.color }}
namedLogo: python
- name: Pylint
run: |
pip install pylint
pylint --rcfile ./.pylintrc ./source/backend
pylint --rcfile ./.pylintrc ./source/frontend
- name: Build and run docker
run: |
cd source
docker compose build
docker compose up -d
sleep 25s
- name: API tests
run: |
cd api-tests
pip install -r requirements.txt
pytest
- name: Stop docker
run: |
cd source
docker compose stop