forked from camas/setuptools-git-ver
-
-
Notifications
You must be signed in to change notification settings - Fork 24
150 lines (128 loc) · 4.42 KB
/
test.yml
File metadata and controls
150 lines (128 loc) · 4.42 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Tests
on:
push:
branches-ignore:
- dependabot/**
- pre-commit-ci-update-config
pull_request:
branches:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
DEFAULT_PYTHON: '3.12'
jobs:
tests:
name: Run ${{ matrix.mark}} tests (${{ matrix.python-version }} on ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# run all the tests on latest Python version
- os: ubuntu-latest
mark: all
python-version: '3.13'
# run only minimal set of tests on other Python versions because it takes too much time
- os: ubuntu-22.04
mark: important
python-version: '3.7'
- os: ubuntu-latest
mark: important
python-version: 'pypy-3.7'
- os: ubuntu-latest
mark: important
python-version: 'pypy-3.10'
# for MacOS and Windows always run only minimal tests
- os: macos-latest
mark: important
python-version: '3.13'
- os: windows-latest
mark: important
python-version: '3.13'
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python-version }}-tests-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ matrix.python-version }}-tests-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ matrix.python-version }}-tests-
${{ runner.os }}-python
${{ runner.os }}-
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel
- name: Install dependencies
run: pip install -I -r requirements.txt -r requirements-test.txt
- name: Build package
run: |
git version
git tag -l --sort=-creatordate --merged
python setup.py --version
python setup.py bdist_wheel sdist
- name: Run tests
run: |
mkdir reports/
pip install -e . --no-build-isolation
coverage run -m pytest -m ${{ matrix.mark }}
- name: Upload coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.mark }}
path: reports/.coverage*
# https://github.com/actions/upload-artifact/issues/602
include-hidden-files: true
all_done:
name: Tests done
runs-on: ubuntu-latest
needs: [tests]
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-${{ hashFiles('requirements*.txt') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-
${{ runner.os }}-python
${{ runner.os }}-
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel
- name: Install dependencies
run: pip install -I -r requirements.txt -r requirements-test.txt
- name: Download all coverage reports
uses: actions/download-artifact@v5
with:
path: reports
- name: Move coverage reports to the root folder
run: find reports -type f -exec mv '{}' reports \;
- name: Combine coverage
run: |
coverage combine
coverage xml -o reports/coverage.xml -i
- name: Check coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./reports
fail_ci_if_error: true
- name: All done
run: echo 1