-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (68 loc) · 2.37 KB
/
test.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
name: Run static checks and unit tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel
pip install -r requirements/dev.txt
- name: Static type checking with mypy
run: mypy --show-error-codes src test
- name: Lint with pylint
run: pylint test/test_trnsys_dck_parser src/trnsys_dck_parser
- name: Get current time
id: current_time
run: echo "current_time=$(date -Iseconds)" >> "$GITHUB_OUTPUT"
- name: Restore and save (at end of workflow) pytest-benchmark data
id: pytest-benchmark
uses: actions/cache@v4
with:
path: .benchmarks
key: pytest-benchmark-${{steps.current_time.outputs.current_time}}
restore-keys:
pytest-benchmark-
- name: Test with pytest
shell: bash {0}
run: |
pytest test \
--cov=trnsys_dck_parser \
--cov-report=html:test-results/coverage \
--cov-report=term \
--cov-report=lcov:test-results/coverage.lcov \
--html=test-results/report/report.html \
--benchmark-disable
- name: Benchmark with pytest-benchmark
shell: bash {0}
run: |
compare_args=$(test -d .benchmarks && echo \
--benchmark-compare \
--benchmark-compare-fail=mean:5% \
--benchmark-histogram='test-results/benchmark/histogram')
pytest test --benchmark-autosave $compare_args
- name: Post coverage report to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: test-results/coverage.lcov
- name: Upload test results and coverage reports
uses: actions/upload-artifact@v4
with:
name: test-results-and-coverage-report
path: test-results
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}