-
Notifications
You must be signed in to change notification settings - Fork 72
238 lines (206 loc) · 7.12 KB
/
build.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
name: Build
on: [push, pull_request]
jobs:
docker-build:
name: Docker Run Test on ${{ matrix.platform }}-${{ matrix.python_tag_type }}
runs-on: ubuntu-22.04
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
python_tag_type:
- slim
- alpine
exclude:
# amd64 with glibc have full direct test
- platform: linux/amd64
python_tag_type: slim
# test alpine only on amd64
- platform: linux/arm64
python_tag_type: alpine
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Build
uses: docker/build-push-action@v5
with:
context: .
file: ./ci/Dockerfile.${{ matrix.python_tag_type }}.test
platforms: ${{ matrix.platform }}
tags: cyvcf2:${{ matrix.python_tag_type }}-test
push: false
load: true
build-args: |
PYTHON_VERSION=${{ matrix.python_tag_type }}
- name: Docker Run Tests
run: |
docker run --rm --platform ${{ matrix.platform }} cyvcf2:${{ matrix.python_tag_type }}-test pytest --cov cyvcf2 --cov-report term-missing
build:
name: Run tests on Python ${{ matrix.python-version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
python-version:
["pypy3.10", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
# Run only the latest versions on macOS and windows
- os: macos-12
python-version: "pypy3.10"
- os: macos-12
python-version: "3.7"
- os: macos-12
python-version: "3.8"
- os: macos-12
python-version: "3.9"
- os: macos-12
python-version: "3.10"
- os: macos-12
python-version: "3.11"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set macOS env
if: runner.os == 'macOS'
run: |
# building options
echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> "$GITHUB_ENV"
echo "ARCHFLAGS=-arch x86_64" >> "$GITHUB_ENV"
- name: Install Linux build prerequisites
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libcurl4-openssl-dev zlib1g-dev libssl-dev liblzma-dev \
libbz2-dev libdeflate-dev
- name: Install macOS build prerequisites
if: runner.os == 'macOS'
run: |
brew install automake libdeflate
- name: Install
run: |
pip install -r requirements.txt
pip install pytest pytest-cov
CYVCF2_HTSLIB_CONFIGURE_OPTIONS="--enable-libcurl --enable-s3 --enable-lzma --enable-bz2 --with-libdeflate" \
CYTHONIZE=1 python setup.py build_ext -i
- name: Test
run: |
pytest --cov cyvcf2 --cov-report term-missing
# make sure to keep this numpy version in sync with setup.py
- name: Test with oldest numpy that we support
if: contains(fromJson('["3.7"]'), matrix.python-version)
run: |
pip install --force-reinstall --no-cache-dir 'numpy==1.16.0'
pytest --cov cyvcf2 --cov-report term-missing
- name: Test with newest available numpy
run: |
pip install -U numpy
pytest --cov cyvcf2 --cov-report term-missing
windows_build:
name: Run tests on Python windows-2022 MSYS2 UCRT64
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Setup MSYS2"
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
path-type: inherit
install: >-
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-make
mingw-w64-ucrt-x86_64-libdeflate
mingw-w64-ucrt-x86_64-xz
mingw-w64-ucrt-x86_64-curl
mingw-w64-ucrt-x86_64-zlib
mingw-w64-ucrt-x86_64-bzip2
mingw-w64-ucrt-x86_64-tools-git
mingw-w64-ucrt-x86_64-python-pkgconfig
mingw-w64-ucrt-x86_64-pkg-config
mingw-w64-ucrt-x86_64-ninja
mingw-w64-ucrt-x86_64-python
mingw-w64-ucrt-x86_64-python-pip
make
automake
autoconf
git
- name: Install Windows build prerequisites
run: |
cd htslib
autoreconf -i
./configure --enable-libcurl --enable-s3 --enable-lzma --enable-bz2 --with-libdeflate
make
make install
- name: Install
run: |
pip install -r requirements.txt
pip install pytest pytest-cov
CYTHONIZE=1 python setup.py build_ext -i
- name: Test
run: |
pytest --cov cyvcf2 --cov-report term-missing
- name: Test with newest available numpy
run: |
pip install -U numpy
pytest --cov cyvcf2 --cov-report term-missing
sdist:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install sdist prerequisites
run: |
pip install -r requirements.txt
- name: Create source distribution
run: CYTHONIZE=1 python setup.py sdist
- name: Install Linux build prerequisites
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libcurl4-openssl-dev zlib1g-dev libssl-dev liblzma-dev \
libbz2-dev libdeflate-dev
- name: Build (via sdist tarball)
run: pip install --verbose --no-deps --no-binary='cyvcf2' cyvcf2-*.tar.gz
working-directory: dist
- name: Install test prerequisites
# pytest 8.2.0~8.2.1 changed the behaivour of --import-mode, can't ignore local cyvcf2 folder.
# So we need to pin it before it breaks again.
run: |
pip install pytest==8.1.2 pytest-cov
- name: Test
run: |
pytest --import-mode importlib --cov cyvcf2 --cov-report term-missing
- name: Test with newest available numpy
run: |
pip install -U numpy
pytest --import-mode importlib --cov cyvcf2 --cov-report term-missing
- name: Upload sdist tarball
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/cyvcf2-*.tar.gz
retention-days: 7