Fix macos wheelbuilding #138
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continous integration | |
on: | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- '*.rst' | |
push: | |
branches: | |
- develop | |
- main | |
tags: | |
- "*" | |
jobs: | |
# lint: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/[email protected] | |
# 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/[email protected] | |
# with: | |
# submodules: recursive | |
# - name: Set up Python 3.8 | |
# uses: actions/[email protected] | |
# with: | |
# python-version: 3.8 | |
# - 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 }} | |
# | |
# test-static: | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# matrix: | |
# python-version: | |
# - "3.8" | |
# - "3.9" | |
# - "3.10" | |
# - "3.11" | |
# - "3.12" | |
# - "pypy-3.9" | |
# - "pypy-3.10" | |
# os: ["ubuntu-latest"] | |
# include: | |
# - os: "macos-14" # For m1 macos | |
# python-version: "3.12" | |
# - os: "macos-13" # for x86 macos | |
# python-version: "3.8" | |
# - os: "windows-latest" | |
# python-version: "3.8" | |
# steps: | |
# - uses: actions/[email protected] | |
# 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: Set MSVC developer prompt | |
# uses: ilammy/[email protected] | |
# if: runner.os == 'Windows' | |
# - name: Install build dependencies (MacOS) | |
# run: brew install make | |
# if: runner.os == 'macOS' | |
# - 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: | |
# distro: [ "ubuntu_latest" ] | |
# arch: ["aarch64"] | |
# steps: | |
# - uses: actions/[email protected] | |
# with: | |
# submodules: recursive | |
# - uses: uraimo/[email protected] | |
# name: Build & run test | |
# with: | |
# arch: ${{ matrix.arch }} | |
# distro: ${{ matrix.distro }} | |
# install: | | |
# apt-get update -q -y | |
# apt-get install -q -y python3 python3-pip tox cmake git googletest | |
# run: | | |
# tox | |
# | |
# # Test if the python-zlib-ng conda package can be build. Which is linked | |
# # dynamically to the conda zlib-ng 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" | |
# - "macos-14" | |
# - "windows-latest" | |
# python_version: [ "python" ] | |
# include: | |
# - os: "ubuntu-latest" | |
# python_version: "pypy" | |
# steps: | |
# - uses: actions/[email protected] | |
# 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 zlib-ng ${{ 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_ZLIB_NG_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"] | |
build_sdist: [true] | |
include: | |
- os: "ubuntu-latest" | |
cibw_archs_linux: "aarch64" | |
steps: | |
- uses: actions/[email protected] | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v2 | |
name: Install Python | |
- name: Install cibuildwheel twine build | |
run: python -m pip install cibuildwheel twine build | |
- name: Install build dependencies (Macos) | |
run: brew install make | |
if: runner.os == 'macOS' | |
- name: Set MSVC developer prompt | |
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" # Skip 32 bit | |
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} | |
CIBW_TEST_REQUIRES: "pytest" | |
# Simple tests that requires the project to be build correctly | |
CIBW_TEST_COMMAND_LINUX: >- | |
pytest {project}/tests/test_zlib_compliance.py | |
{project}/tests/test_gzip_compliance.py | |
{project}/tests/test_gzip_ng.py | |
CIBW_TEST_COMMAND_MACOS: >- | |
pytest {project}/tests/test_zlib_compliance.py | |
{project}/tests/test_gzip_compliance.py | |
{project}/tests/test_gzip_ng.py | |
# Windows does not have the test module in the included python. | |
# Run compatibility tests instead. | |
CIBW_TEST_COMMAND_WINDOWS: >- | |
pytest {project}/tests/test_compat.py | |
{project}/tests/test_gzip_ng.py | |
CIBW_ENVIRONMENT_LINUX: >- | |
PYTHON_ZLIB_NG_BUILD_CACHE=True | |
PYTHON_ZLIB_NG_BUILD_CACHE_FILE=/tmp/build_cache | |
CFLAGS="-g0 -DNDEBUG" | |
CIBW_ENVIRONMENT_WINDOWS: >- | |
PYTHON_ZLIB_NG_BUILD_CACHE=True | |
PYTHON_ZLIB_NG_BUILD_CACHE_FILE=${{ runner.temp }}\build_cache | |
CIBW_ENVIRONMENT_MACOS: >- | |
PYTHON_ZLIB_NG_BUILD_CACHE=True | |
PYTHON_ZLIB_NG_BUILD_CACHE_FILE=${{ runner.temp }}/build_cache | |
CFLAGS="-g0 -DNDEBUG" | |
- name: Build sdist | |
if: ${{runner.os == 'Linux' && matrix.cibw_archs_linux == 'x86_64'}} | |
run: | |
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 -r testpypi 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 }} |