Skip to content

Features/202601

Features/202601 #59

Workflow file for this run

name: Build Wheels
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Docker images (Linux)
if: matrix.os == 'ubuntu-latest'
uses: ScribeMD/docker-cache@0.5.0
with:
key: docker-${{ runner.os }}-manylinux
- name: Cache vcpkg installed packages (Windows)
if: matrix.os == 'windows-latest'
uses: actions/cache@v4
with:
path: |
C:/vcpkg/installed
C:/vcpkg/downloads
C:/vcpkg/archives
key: vcpkg-${{ runner.os }}-boost
restore-keys: |
vcpkg-${{ runner.os }}-
- name: Build wheels
uses: pypa/cibuildwheel@v2.16
# All cibuildwheel configuration is in pyproject.toml
- name: Save vcpkg cache (Windows always)
if: always() && matrix.os == 'windows-latest'
uses: actions/cache/save@v4
with:
path: |
C:/vcpkg/installed
C:/vcpkg/downloads
C:/vcpkg/archives
key: vcpkg-${{ runner.os }}-boost
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
release:
name: Create GitHub release
needs: [build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
path: dist/
pattern: wheels-*
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: dist/**/*.whl
generate_release_notes: true
publish-test:
name: Publish to TestPyPI
needs: [release] # ensure there's always a release for every publish
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://test.pypi.org/p/fastmm
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
path: dist/
pattern: wheels-*
merge-multiple: true
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish:
name: Publish to PyPI
needs: [publish-test] # ensure there's always a release for every publish
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/fastmm
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
path: dist/
pattern: wheels-*
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1