Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements to Compilation Process, CI/Wheel Workflow, and Bug Fixes #290

Merged
merged 9 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 180 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@ name: Build
on: [push, pull_request]

jobs:
docker-build-and-test:
name: Docker Build and Test on ${{ matrix.platform }}
runs-on: ubuntu-latest
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
Expand All @@ -20,51 +31,184 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Build and Push

- name: Docker Build
uses: docker/build-push-action@v5
with:
context: .
file: ./ci/Dockerfile.test
context: .
file: ./ci/Dockerfile.${{ matrix.python_tag_type }}.test
platforms: ${{ matrix.platform }}
tags: cyvcf2:test
tags: cyvcf2:${{ matrix.python_tag_type }}-test
push: false
load: true
build-args: |
PYTHON_VERSION=slim
build-args: |
PYTHON_VERSION=${{ matrix.python_tag_type }}

- name: Docker Run Tests
run: |
docker run --rm --platform ${{ matrix.platform }} cyvcf2:test pytest --cov cyvcf2 --cov-report term-missing
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 }}
runs-on: ubuntu-20.04
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

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

sdist:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
pip install -r requirements.txt
pip install pytest pytest-cov
git submodule update --init --recursive
cd htslib
autoheader && autoconf && autoreconf --install
./configure --enable-s3 --disable-lzma --disable-bz2
make
cd ..
CYTHONIZE=1 python setup.py build_ext -i
- name: Test
run: |
pytest --cov cyvcf2 --cov-report term-missing
- 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
run: |
pip install pytest pytest-cov

- name: Test
run: |
pytest --import-mode importlib --cov cyvcf2 --cov-report term-missing

- name: Upload sdist tarball
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/cyvcf2-*.tar.gz
retention-days: 7
Loading