-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (50 loc) · 1.75 KB
/
python-app.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
# This workflow will install Python dependencies, run tests and lint with all active versions of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: test
on: [push, pull_request]
jobs:
ci:
runs-on: self-hosted
strategy:
matrix:
python: ["3.7", "3.8"]
disable_coverage_count: [true]
include:
# Must be the latest version
- python: "3.9"
disable_coverage_count: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
run: |
# Filtration: https://unix.stackexchange.com/a/3657
python -m pip install --upgrade pip \
2> >(grep --invert-match "WARNING: Running pip as the 'root' user" >&2)
if [ -f requirements.txt ]; then
pip install -r requirements.txt \
2> >(grep --invert-match "WARNING: Running pip as the 'root' user" >&2)
fi
if [ -f tests/requirements.txt ]; then
pip install -r tests/requirements.txt \
2> >(grep --invert-match "WARNING: Running pip as the 'root' user" >&2)
fi
- name: Testing with pytest
env:
PYTHONPATH: .
run: |
if [ "${{ matrix.disable_coverage_count }}" = true ]; then
pytest
exit 0
fi
pytest --cov=./ --cov-report=term --cov-report=xml
- name: "Upload coverage.xml to Codecov"
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false
if: ${{ !matrix.disable_coverage_count }}