Skip to content

Build wheels

Build wheels #125

Workflow file for this run

name: Build wheels
on:
schedule:
- cron: '42 8 2-30/2 * *' # At 08:42 UTC on every 2nd day-of-month
pull_request:
paths: # only run this with PRs that touch these files
- ".github/workflows/release.yml"
- "scripts/build_lib.*"
- "pyproject.toml"
- "setup.py"
push:
branches:
- main
tags:
- "*"
release:
types:
- published
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
arch: x86_64
- os: ubuntu-22.04
arch: aarch64
- os: windows-2022
arch: AMD64
- os: macos-13
arch: x86_64
macosx_deployment_target: "13.0"
cmake_osx_architectures: x86_64
- os: macos-14
arch: arm64
macosx_deployment_target: "14.0"
cmake_osx_architectures: arm64
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Install MinGW-w64 tools (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: inherit
install: >-
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-lapack
mingw-w64-x86_64-meson
mingw-w64-x86_64-ninja
- name: Build pestutils (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
env:
LDFLAGS: -static-libgcc -static-libgfortran -static-libquadmath -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive
run: bash scripts/build_lib.sh
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_MACOS:
FC=gfortran-13
MACOSX_DEPLOYMENT_TARGET='${{ matrix.macosx_deployment_target }}'
CMAKE_OSX_ARCHITECTURES='${{ matrix.cmake_osx_architectures }}'
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1