Fixes for CI #117
This file contains 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: Package Wheels | |
on: | |
push: | |
branches: ["main"] | |
# release: | |
# branches: [ "main" ] | |
jobs: | |
build_wheels: | |
name: Wheel build for ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }} | |
runs-on: ${{ matrix.buildplat[0] }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# Github Actions doesn't support pairing matrix values together, let's improvise | |
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 | |
buildplat: | |
# should also be able to do multi-archs on a single entry, e.g. | |
# [os-image, os-name, os-arch] | |
- [ubuntu-latest, manylinux, x86_64] | |
- [macos-latest, macosx, x86_64] | |
- [macos-latest, macosx, arm64] | |
- [windows-2019, win, AMD64] | |
# os: [windows-latest] | |
# cibw_arch: ["AMD64"] | |
# cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*"] | |
python: [["cp38", "3.8"], ["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: "3.10" | |
- name: Install cibuildwheel | |
run: | | |
python -m pip install cibuildwheel | |
- name: Set VSDev RC (windows only) | |
if: runner.os == 'Windows' | |
run: | | |
function Invoke-VSDevEnvironment { | |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" | |
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath | |
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat" | |
& "${env:COMSPEC}" /s /c "`"$Command`" -arch=amd64 -no_logo && set" | Foreach-Object { | |
if ($_ -match '^([^=]+)=(.*)') { | |
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2]) | |
} | |
} | |
} | |
Invoke-VSDevEnvironment | |
Get-Command rc.exe | Format-Table -AutoSize | |
- name: Build wheels via cibuildwheel | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}* | |
CIBW_ARCHS: ${{ matrix.buildplat[2] }} | |
# define CC, CXX so meson will use clang-cl instead of MSVC | |
# CC: clang-cl | |
# CXX: clang-cl | |
# CC: gcc | |
# CXX: g++ | |
# -Wl,-S equivalent to gcc's -Wl,--strip-debug | |
# LDFLAGS: "-Wl,-S" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: | | |
dist | |
wheelhouse | |
dist/wheelhouse | |
upload_all: | |
needs: [build_wheels] | |
environment: pypi | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
# if: github.event_name == 'release' && github.event.action == 'published' | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: | | |
dist | |
wheelhouse | |
dist/wheelhouse | |
- uses: pypa/gh-action-pypi-publish@release/v1 |