-
Notifications
You must be signed in to change notification settings - Fork 9
140 lines (123 loc) · 4.05 KB
/
pytest.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
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
name: tests
on:
pull_request:
push:
workflow_dispatch:
concurrency:
group: ${{ github.sha }}
cancel-in-progress: ${{ contains(github.ref, 'refs/tags/') }}
jobs:
run_tests:
strategy:
fail-fast: true
matrix:
os-python-env:
- [ubuntu-20.04, "3.6", "CONVTOOLS_CEXT_DISABLED=1"]
- [ubuntu-20.04, "3.7", "CONVTOOLS_CEXT_DISABLED=1"]
- [ubuntu-20.04, "3.8", "CONVTOOLS_CEXT_DISABLED=1"]
- [ubuntu-20.04, "3.9", "CONVTOOLS_CEXT_DISABLED=1"]
- [ubuntu-20.04, "3.10", "CONVTOOLS_CEXT_DISABLED=1"]
- [ubuntu-20.04, "3.11", "CONVTOOLS_CEXT_DISABLED=1"]
- [ubuntu-20.04, "3.12", "CONVTOOLS_CEXT_DISABLED=1"]
- [ubuntu-20.04, "3.10", "CONVTOOLS_CEXT_DISABLED=0"]
runs-on: ${{ matrix.os-python-env[0] }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.os-python-env[1] }}
- name: run tests
if: ${{ matrix.os-python-env[1] != '3.10' }}
run: |
pip install -r ci-requirements/requirements${{ matrix.os-python-env[1] }}.out
${{ matrix.os-python-env[2] }} pip install -e .
pytest --benchmark-skip --no-cov
- name: run tests & lint
if: ${{ matrix.os-python-env[1] == '3.10' }}
run: |
pip install -r ci-requirements/requirements${{ matrix.os-python-env[1] }}.out
black src tests --check
isort src tests --check
ruff check src
mypy --check-untyped-defs src
${{ matrix.os-python-env[2] }} pip install -e .
pytest --benchmark-skip --no-cov
build_sdist:
name: Build source distribution
if: startsWith(github.ref, 'refs/tags/')
needs:
- run_tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: upload coverage
run: |
pip install -r ci-requirements/requirements3.10.out
find src/convtools -name "*.so" -delete
CONVTOOLS_CEXT_DISABLED=1 pip install -e .
pytest --benchmark-skip
CONVTOOLS_CEXT_DISABLED=0 pip install -e .
pytest --benchmark-skip --cov-append
bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
- name: build sdist
run: |
pip install -U pip build
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: ./dist/*.tar.gz
build_wheels:
name: Build wheels
if: startsWith(github.ref, 'refs/tags/')
needs:
- run_tests
strategy:
matrix:
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [ubuntu-20.04, musllinux_x86_64]
- [macos-13, macosx_x86_64]
- [macos-14, macosx_arm64]
- [windows-2019, win_amd64]
runs-on: ${{ matrix.buildplat[0] }}
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp310-${{ matrix.buildplat[1] }}
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10"
- uses: actions/upload-artifact@v4
with:
name: artifact-cp310-${{ matrix.buildplat[1] }}
path: ./wheelhouse/*.whl
pypi-publish:
name: Upload release to PyPI
if: startsWith(github.ref, 'refs/tags/')
needs:
- build_sdist
- build_wheels
runs-on: ubuntu-20.04
environment:
name: pypi
url: https://pypi.org/p/convtools
permissions:
id-token: write
contents: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
path: dist/
pattern: artifact-*
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1