-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (61 loc) · 1.97 KB
/
python-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
name: Test
on:
# pull-request events are not triggered when a PR is merged
# push events are not triggered when a PR created from a fork repository
# So we need both to run tests on every PR and after merging
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python }}"
- name: Set up poetry
uses: abatilo/actions-poetry@v3
- name: Cache
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-build-${{ matrix.python }}-
${{ runner.os }}-
- name: Install dependencies
run: poetry install
- name: Lint
run: poetry run poe check
- name: Check Python version
run: |
actual_version=$(poetry run python --version)
expected_version="Python ${{ matrix.python }}"
if [ "$actual_version" == *"$expected_version"* ]; then
echo "Expected $expected_version, but got $actual_version"
exit 1
fi
- name: Test
run: poetry run poe test
- name: Coverage
run: poetry run poe coverage-xml
- name: Upload coverage report to Codecov
if: matrix.python == '3.13'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
verbose: true