-
Notifications
You must be signed in to change notification settings - Fork 4
276 lines (269 loc) · 9.44 KB
/
ci.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
name: Continous integration
on:
pull_request:
push:
branches:
- develop
- main
tags:
- "*"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.8
uses: actions/[email protected]
with:
python-version: 3.8
- name: Install tox
run: pip install tox
- name: Lint
run: tox -e lint
package-checks:
strategy:
matrix:
tox_env:
- docs
- twine_check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.8
uses: actions/[email protected]
with:
python-version: 3.8
- name: Install isal
run: sudo apt-get install libisal-dev
- name: Install tox and upgrade setuptools and pip
run: pip install --upgrade tox setuptools pip
- name: Run tox -e ${{ matrix.tox_env }}
run: tox -e ${{ matrix.tox_env }}
env:
PYTHON_ISAL_LINK_DYNAMIC: True
test-static:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
- "pypy-3.9"
- "pypy-3.10"
os: ["ubuntu-latest"]
include:
- os: "macos-13"
python-version: "3.8"
- os: "macos-14"
python-version: "3.10"
- os: "windows-latest"
python-version: "3.8"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install tox and upgrade setuptools
run: pip install --upgrade tox setuptools
- name: Install build dependencies (Linux) # Yasm in pypa/manylinux images.
run: sudo apt install nasm
if: runner.os == 'Linux'
- name: Install build dependencies (Macos)
# Install yasm because nasm does not work when building wheels.
# Probably because of nasm-filter.sh not filtering all flags that can not be used.
run: brew install nasm
if: runner.os == 'macOS'
- name: Set MSVC developer prompt
uses: ilammy/[email protected]
if: runner.os == 'Windows'
- name: Install nasm (Windows)
uses: ilammy/[email protected]
if: runner.os == 'Windows'
- name: Run tests
run: tox
- name: Upload coverage report
uses: codecov/codecov-action@v1
test-arch:
if: startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
runs-on: "ubuntu-latest"
strategy:
matrix:
python_version:
- "3.8"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: uraimo/[email protected]
name: Build & run test
with:
arch: none
distro: none
base_image: "--platform=linux/arm64 quay.io/pypa/manylinux2014_aarch64"
# versioningit needs an accessible git repository but the container
# is run as root, which is different from the repository user.
# use git config to override this.
run: |-
git config --global --add safe.directory $PWD
CFLAGS="-DNDEBUG -g0" python${{matrix.python_version}} -m pip install . pytest
python${{matrix.python_version}} -m pytest tests
# Test if the python-isal conda package can be build. Which is linked
# dynamically to the conda isa-l package.
test-dynamic:
runs-on: ${{ matrix.os }}
defaults:
run:
# This is needed for miniconda, see:
# https://github.com/marketplace/actions/setup-miniconda#important.
shell: bash -l {0}
strategy:
matrix:
os: ["ubuntu-latest", "macos-13", "windows-latest"]
python_version: [ "python" ]
include:
- os: "ubuntu-latest"
python_version: "pypy"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install miniconda.
uses: conda-incubator/setup-miniconda@v3 # https://github.com/conda-incubator/setup-miniconda.
with:
channels: conda-forge,defaults
- name: Install requirements (universal)
run: conda install isa-l ${{ matrix.python_version}} tox
- name: Set MSVC developer prompt
uses: ilammy/[email protected]
if: runner.os == 'Windows'
- name: Run tests (dynamic link)
run: tox
env:
PYTHON_ISAL_LINK_DYNAMIC: True
deploy:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ${{ matrix.os }}
needs:
- lint
- package-checks
- test-static
- test-dynamic
- test-arch
strategy:
matrix:
os:
- ubuntu-latest
- macos-13
- macos-14
- windows-latest
cibw_archs_linux: ["x86_64"]
cibw_before_all_linux:
- >-
curl -o nasm-2.15.05.tar.gz https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.gz &&
tar -xzvf nasm-2.15.05.tar.gz &&
cd nasm-2.15.05/ &&
./autogen.sh &&
./configure &&
make nasm &&
install -c nasm /usr/bin/nasm
build_sdist: [true]
include:
- os: "ubuntu-latest"
cibw_archs_linux: "aarch64"
cibw_before_all_linux: "true" # The true command exits with 0
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Fetch everything to get accurately versioned tag.
- uses: actions/setup-python@v2
name: Install Python
- name: Install cibuildwheel twine wheel
run: python -m pip install cibuildwheel twine wheel
- name: Install build dependencies (Macos)
run: brew install nasm
if: runner.os == 'macOS'
- name: Set MSVC developer prompt
uses: ilammy/[email protected]
if: runner.os == 'Windows'
- name: Install nasm (Windows)
uses: ilammy/[email protected]
if: runner.os == 'Windows'
- name: Set up QEMU
if: ${{runner.os == 'Linux' && matrix.cibw_archs_linux == 'aarch64'}}
uses: docker/[email protected]
with:
platforms: arm64
- name: Build wheels
run: cibuildwheel --output-dir dist
env:
CIBW_SKIP: "*-win32 *-manylinux_i686 cp38-macosx_*arm64 cp39-macosx_*arm64" # Skip 32 bit and problematic mac builds.
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }}
CIBW_BEFORE_ALL_LINUX: ${{ matrix.cibw_before_all_linux }}
# Fully test the build wheels again.
CIBW_TEST_REQUIRES: "pytest"
# Simple tests that requires the project to be build correctly
# Skip extensive compatibility testing which is slow.
CIBW_TEST_COMMAND_LINUX: >-
pytest -v {project}/tests/test_igzip.py
{project}/tests/test_gzip_compliance.py
{project}/tests/test_zlib_compliance.py
{project}/tests/test_igzip_lib.py
-k 'not test_compress_decompress'
CIBW_TEST_COMMAND_MACOS: >-
pytest -v {project}/tests/test_igzip.py
{project}/tests/test_gzip_compliance.py
{project}/tests/test_zlib_compliance.py
{project}/tests/test_igzip_lib.py
-k 'not test_compress_decompress'
# Windows does not have the test module apparently. Do more expensive
# tests to verify build.
CIBW_TEST_COMMAND_WINDOWS: >-
pytest {project}/tests/test_igzip.py
{project}/tests/test_igzip_lib.py
{project}/tests/test_compat.py
CIBW_ENVIRONMENT_LINUX: >-
PYTHON_ISAL_BUILD_CACHE=True
PYTHON_ISAL_BUILD_CACHE_FILE=/tmp/build_cache
CFLAGS="-g0 -DNDEBUG"
CIBW_ENVIRONMENT_WINDOWS: >-
PYTHON_ISAL_BUILD_CACHE=True
PYTHON_ISAL_BUILD_CACHE_FILE=${{ runner.temp }}\build_cache
CIBW_ENVIRONMENT_MACOS: >-
PYTHON_ISAL_BUILD_CACHE=True
PYTHON_ISAL_BUILD_CACHE_FILE=${{ runner.temp }}/build_cache
CFLAGS="-g0 -DNDEBUG"
- name: Build sdist
if: ${{runner.os == 'Linux' && matrix.cibw_archs_linux == 'x86_64'}}
run: |
pip install build
python -m build --sdist
- uses: actions/upload-artifact@v2
with:
name: "dist"
path: "dist/"
- name: Publish package to TestPyPI
# pypa/gh-action-pypi-publish@master does not work on OSX
# Alpha, Beta and dev releases contain a - in the tag.
if: contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')
run: twine upload --skip-existing --repository-url https://test.pypi.org/legacy/ dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Publish package to PyPI
if: "!contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')"
run: twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}