-
-
Notifications
You must be signed in to change notification settings - Fork 63
211 lines (203 loc) · 6.77 KB
/
pre_release.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Build and publish pre release
on:
push:
branches:
- master
- release/**
tags-ignore:
- v**
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: Install dependencies
run: |
pip install -r requirements/base.txt -r requirements/tests.txt
- name: Test and and run coverage with PyTest
run: |
py.test
- name: Upload coverage JUint report
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' }}
uses: actions/upload-artifact@v4
with:
name: test-n-coverage-report
path: |
.coverage
coverage.lcov
junit/
htmlcov/
coverage:
name: Coverage
needs: test
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Download a coverage artifact
uses: actions/download-artifact@v4
with:
name: test-n-coverage-report
- name: Send coverage stats to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
format: lcov
file: coverage.lcov
allow-empty: true
build:
name: Build source on ${{ matrix.platform }}
needs: [coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build source and wheel distributions
run: |
python -m pip install -r requirements/build.txt
python -m build --outdir dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Tar build and wheel distributions files
run: |
tar -cvf dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Upload build and wheel distributions files
uses: actions/upload-artifact@v4
with:
name: pre-release-build-${{ matrix.platform }}-${{ matrix.python-version }}
path: |
dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
build-mypyc:
name: Build using Mypyc source on ${{ matrix.platform }}
continue-on-error: true
needs: [coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Compiles Python modules to C extensions with Mypyc
env:
MYPYC_ENABLE: 1
run: |
set -e
sudo apt install python3-dev
python -m pip install -r requirements/base.txt -r requirements/cbuild.txt
python setup.py bdist_wheel --dist-dir mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Tar build and wheel distributions files
run: |
tar -cvf mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Upload build and wheel distributions files
uses: actions/upload-artifact@v4
with:
name: pre-release-cbuild-${{ matrix.platform }}-${{ matrix.python-version }}
path: |
mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
build-wheels:
name: Build wheels on ${{ matrix.platform }}
needs: [coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- macos-13 # intel
- macos-latest # apple silicon
- windows-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: .
output-dir: wheelhouse
- uses: actions/upload-artifact@v4
with:
name: pre-release-cibw-wheels-${{ matrix.platform }}-${{ matrix.python-version }}
path: ./wheelhouse/*.whl
publish-testpypi:
name: Publish to TestPyPI
needs: [build, build-wheels]
runs-on: ${{ matrix.platform }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download build and wheel distributions files
uses: actions/download-artifact@v4
with:
name: pre-release-build-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Download cibw wheels distributions files
uses: actions/download-artifact@v4
with:
path: pre-release-cibw-wheels
pattern: pre-release-cibw-wheels-*
merge-multiple: true
- name: Build source and wheel distributions to version ${{ github.ref_name }}
run: |
python -m pip install -r requirements/build.txt twine
tar -xvf dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
mv pre-release-cibw-wheels/* dist-${{ matrix.platform }}-${{ matrix.python-version }}/
twine check --strict dist-${{ matrix.platform }}-${{ matrix.python-version }}/*
- name: Publish distribution to TestPyPI
continue-on-error: true
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
packages-dir: dist-${{ matrix.platform }}-${{ matrix.python-version }}/
skip-existing: true