-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (48 loc) · 2.08 KB
/
datacollector-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
name: Python application
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:latest
ports:
- 27017:27017/tcp
options: >-
--health-cmd "mongosh --eval='db.runCommand({ ping: 1 })'" --health-interval 10s --health-timeout 5s --health-retries 3
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests with coverage
run: |
set -o pipefail
pytest --cov=. --cov-report=xml:coverage.xml --junitxml=junit.xml --cov-report=term-missing -cov-config=.coveragerc tests/ | tee pytest-coverage.txt
exit_code=${PIPESTATUS[0]}
# exit with pytest code to inform github actions properly
exit $exit_code
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./junit.xml