Skip to content

add CI test for lowest supported runtime version of numpy #234

add CI test for lowest supported runtime version of numpy

add CI test for lowest supported runtime version of numpy #234

Workflow file for this run

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
if: ${{ matrix.python-version }} != "3.7" && ${{ matrix.python-version }} != "3.8"
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