| 1 |
name: Build |
| 2 |
|
| 3 |
on: [push, pull_request] |
| 4 |
|
| 5 |
jobs: |
| 6 |
docker-build: |
| 7 |
name: Docker Run Test on ${{ matrix.platform }}-${{ matrix.python_tag_type }} |
| 8 |
runs-on: ubuntu-22.04 |
| 9 |
strategy: |
| 10 |
matrix: |
| 11 |
platform: |
| 12 |
- linux/amd64 |
| 13 |
- linux/arm64 |
| 14 |
python_tag_type: |
| 15 |
- slim |
| 16 |
- alpine |
| 17 |
exclude: |
| 18 |
# amd64 with glibc have full direct test |
| 19 |
- platform: linux/amd64 |
| 20 |
python_tag_type: slim |
| 21 |
|
| 22 |
# test alpine only on amd64 |
| 23 |
- platform: linux/arm64 |
| 24 |
python_tag_type: alpine |
| 25 |
|
| 26 |
steps: |
| 27 |
- uses: actions/checkout@v4 |
| 28 |
with: |
| 29 |
submodules: recursive |
| 30 |
- name: Set up QEMU |
| 31 |
uses: docker/setup-qemu-action@v3 |
| 32 |
- name: Set up Docker Buildx |
| 33 |
uses: docker/setup-buildx-action@v3 |
| 34 |
|
| 35 |
- name: Docker Build |
| 36 |
uses: docker/build-push-action@v5 |
| 37 |
with: |
| 38 |
context: . |
| 39 |
file: ./ci/Dockerfile.${{ matrix.python_tag_type }}.test |
| 40 |
platforms: ${{ matrix.platform }} |
| 41 |
tags: cyvcf2:${{ matrix.python_tag_type }}-test |
| 42 |
push: false |
| 43 |
load: true |
| 44 |
build-args: | |
| 45 |
PYTHON_VERSION=${{ matrix.python_tag_type }} |
| 46 |
|
| 47 |
- name: Docker Run Tests |
| 48 |
run: | |
| 49 |
docker run --rm --platform ${{ matrix.platform }} cyvcf2:${{ matrix.python_tag_type }}-test pytest --cov cyvcf2 --cov-report term-missing |
| 50 |
|
| 51 |
build: |
| 52 |
name: Run tests on Python ${{ matrix.python-version }} ${{ matrix.os }} |
| 53 |
runs-on: ${{ matrix.os }} |
| 54 |
strategy: |
| 55 |
matrix: |
| 56 |
os: [ubuntu-22.04, macos-13] |
| 57 |
python-version: |
| 58 |
["pypy3.10", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] |
| 59 |
exclude: |
| 60 |
# Run only the latest versions on macOS and windows |
| 61 |
- os: macos-13 |
| 62 |
python-version: "pypy3.10" |
| 63 |
- os: macos-13 |
| 64 |
python-version: "3.7" |
| 65 |
- os: macos-13 |
| 66 |
python-version: "3.8" |
| 67 |
- os: macos-13 |
| 68 |
python-version: "3.9" |
| 69 |
- os: macos-13 |
| 70 |
python-version: "3.10" |
| 71 |
- os: macos-13 |
| 72 |
python-version: "3.11" |
| 73 |
- os: macos-12 |
| 74 |
python-version: "3.12" |
| 75 |
|
| 76 |
steps: |
| 77 |
- uses: actions/checkout@v4 |
| 78 |
with: |
| 79 |
submodules: recursive |
| 80 |
- name: Set up Python ${{ matrix.python-version }} |
| 81 |
uses: actions/setup-python@v5 |
| 82 |
with: |
| 83 |
python-version: ${{ matrix.python-version }} |
| 84 |
|
| 85 |
- name: Set macOS env |
| 86 |
if: runner.os == 'macOS' |
| 87 |
run: | |
| 88 |
# building options |
| 89 |
echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> "$GITHUB_ENV" |
| 90 |
echo "ARCHFLAGS=-arch x86_64" >> "$GITHUB_ENV" |
| 91 |
|
| 92 |
- name: Install Linux build prerequisites |
| 93 |
if: runner.os == 'Linux' |
| 94 |
run: | |
| 95 |
sudo apt-get update |
| 96 |
sudo apt-get install -y --no-install-recommends libcurl4-openssl-dev zlib1g-dev libssl-dev liblzma-dev \ |
| 97 |
libbz2-dev libdeflate-dev |
| 98 |
|
| 99 |
- name: Install macOS build prerequisites |
| 100 |
if: runner.os == 'macOS' |
| 101 |
run: | |
| 102 |
brew install automake libdeflate |
| 103 |
|
| 104 |
- name: Install |
| 105 |
run: | |
| 106 |
pip install -r requirements.txt |
| 107 |
pip install pytest pytest-cov |
| 108 |
CYVCF2_HTSLIB_CONFIGURE_OPTIONS="--enable-libcurl --enable-s3 --enable-lzma --enable-bz2 --with-libdeflate" \ |
| 109 |
CYTHONIZE=1 python setup.py build_ext -i |
| 110 |
|
| 111 |
- name: Test |
| 112 |
run: | |
| 113 |
pytest --cov cyvcf2 --cov-report term-missing |
| 114 |
|
| 115 |
# make sure to keep this numpy version in sync with setup.py |
| 116 |
- name: Test with oldest numpy that we support |
| 117 |
if: contains(fromJson('["3.7"]'), matrix.python-version) |
| 118 |
run: | |
| 119 |
pip install --force-reinstall --no-cache-dir 'numpy==1.16.0' |
| 120 |
pytest --cov cyvcf2 --cov-report term-missing |
| 121 |
|
| 122 |
- name: Test with newest available numpy |
| 123 |
run: | |
| 124 |
pip install -U numpy |
| 125 |
pytest --cov cyvcf2 --cov-report term-missing |
| 126 |
|
| 127 |
windows_build: |
| 128 |
name: Run tests on Python windows-2022 MSYS2 UCRT64 |
| 129 |
runs-on: windows-2022 |
| 130 |
defaults: |
| 131 |
run: |
| 132 |
shell: msys2 {0} |
| 133 |
|
| 134 |
steps: |
| 135 |
- uses: actions/checkout@v4 |
| 136 |
with: |
| 137 |
submodules: recursive |
| 138 |
|
| 139 |
- name: "Setup MSYS2" |
| 140 |
uses: msys2/setup-msys2@v2 |
| 141 |
with: |
| 142 |
msystem: UCRT64 |
| 143 |
path-type: inherit |
| 144 |
install: >- |
| 145 |
mingw-w64-ucrt-x86_64-gcc |
| 146 |
mingw-w64-ucrt-x86_64-make |
| 147 |
mingw-w64-ucrt-x86_64-libdeflate |
| 148 |
mingw-w64-ucrt-x86_64-xz |
| 149 |
mingw-w64-ucrt-x86_64-curl |
| 150 |
mingw-w64-ucrt-x86_64-zlib |
| 151 |
mingw-w64-ucrt-x86_64-bzip2 |
| 152 |
mingw-w64-ucrt-x86_64-tools-git |
| 153 |
mingw-w64-ucrt-x86_64-python-pkgconfig |
| 154 |
mingw-w64-ucrt-x86_64-pkg-config |
| 155 |
mingw-w64-ucrt-x86_64-ninja |
| 156 |
mingw-w64-ucrt-x86_64-python |
| 157 |
mingw-w64-ucrt-x86_64-python-pip |
| 158 |
make |
| 159 |
automake |
| 160 |
autoconf |
| 161 |
git |
| 162 |
|
| 163 |
- name: Install Windows build prerequisites |
| 164 |
run: | |
| 165 |
cd htslib |
| 166 |
autoreconf -i |
| 167 |
./configure --enable-libcurl --enable-s3 --enable-lzma --enable-bz2 --with-libdeflate |
| 168 |
make |
| 169 |
make install |
| 170 |
|
| 171 |
- name: Install |
| 172 |
run: | |
| 173 |
pip install -r requirements.txt |
| 174 |
pip install pytest pytest-cov |
| 175 |
CYTHONIZE=1 python setup.py build_ext -i |
| 176 |
|
| 177 |
- name: Test |
| 178 |
run: | |
| 179 |
pytest --cov cyvcf2 --cov-report term-missing |
| 180 |
|
| 181 |
- name: Test with newest available numpy |
| 182 |
run: | |
| 183 |
pip install -U numpy |
| 184 |
pytest --cov cyvcf2 --cov-report term-missing |
| 185 |
|
| 186 |
sdist: |
| 187 |
runs-on: ubuntu-22.04 |
| 188 |
strategy: |
| 189 |
matrix: |
| 190 |
python-version: ["3.14"] |
| 191 |
|
| 192 |
steps: |
| 193 |
- uses: actions/checkout@v4 |
| 194 |
with: |
| 195 |
submodules: recursive |
| 196 |
- name: Set up Python ${{ matrix.python-version }} |
| 197 |
uses: actions/setup-python@v5 |
| 198 |
with: |
| 199 |
python-version: ${{ matrix.python-version }} |
| 200 |
|
| 201 |
- name: Install sdist prerequisites |
| 202 |
run: | |
| 203 |
pip install -r requirements.txt |
| 204 |
|
| 205 |
- name: Create source distribution |
| 206 |
run: CYTHONIZE=1 python setup.py sdist |
| 207 |
|
| 208 |
- name: Install Linux build prerequisites |
| 209 |
if: runner.os == 'Linux' |
| 210 |
run: | |
| 211 |
sudo apt-get update |
| 212 |
sudo apt-get install -y --no-install-recommends libcurl4-openssl-dev zlib1g-dev libssl-dev liblzma-dev \ |
| 213 |
libbz2-dev libdeflate-dev |
| 214 |
|
| 215 |
- name: Build (via sdist tarball) |
| 216 |
run: pip install --verbose --no-deps --no-binary='cyvcf2' cyvcf2-*.tar.gz |
| 217 |
working-directory: dist |
| 218 |
|
| 219 |
- name: Install test prerequisites |
| 220 |
# pytest 8.2.0~8.2.1 changed the behaivour of --import-mode, can't ignore local cyvcf2 folder. |
| 221 |
# So we need to pin it before it breaks again. |
| 222 |
run: | |
| 223 |
pip install pytest==8.1.2 pytest-cov |
| 224 |
|
| 225 |
- name: Test |
| 226 |
run: | |
| 227 |
pytest --import-mode importlib --cov cyvcf2 --cov-report term-missing |
| 228 |
|
| 229 |
- name: Test with newest available numpy |
| 230 |
run: | |
| 231 |
pip install -U numpy |
| 232 |
pytest --import-mode importlib --cov cyvcf2 --cov-report term-missing |
| 233 |
|
| 234 |
- name: Upload sdist tarball |
| 235 |
if: runner.os == 'Linux' |
| 236 |
uses: actions/upload-artifact@v4 |
| 237 |
with: |
| 238 |
name: sdist |
| 239 |
path: dist/cyvcf2-*.tar.gz |
| 240 |
retention-days: 7 |