Skip to content

Release to PyPI

Release to PyPI #38

Workflow file for this run

name: Release to PyPI
on:
pull_request:
workflow_dispatch:
jobs:
BuildWheel:
name: BuildWheel-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, macos-15-intel]
# os: [ubuntu-latest]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# When re-running a PR job, GitHub Actions uses the merge commit created at
# the time of the original run, not a fresh merge with the latest target branch.
# This step ensures we always test against the most recent target branch.
- name: Merge with latest target branch (pull_request only)
if: github.event_name == 'pull_request'
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}
git merge --no-edit origin/${{ github.event.pull_request.base.ref }}
- name: Cache Ccache Directory (pull_request)
if: ${{ github.event_name == 'pull_request' }}
uses: actions/cache@v4
with:
path: |
~/.ccache
key: ccache-${{ runner.os }}-${{ github.event.pull_request.head.ref }}-${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ github.event.pull_request.head.ref }}-
ccache-${{ runner.os }}-${{ github.event.pull_request.base.ref }}-
- name: Set Ccache Directory
run: |
echo "Start building---------------------------------"
export CCACHE_DIR="${HOME}/.ccache"
- name: Setup macOS
if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-14'
run: |
if [[ ${{ matrix.os }} == 'macos-15-intel' ]]; then
echo "MACOSX_DEPLOYMENT_TARGET=15.0" >> "$GITHUB_ENV"
elif [[ ${{ matrix.os }} == 'macos-14' ]]; then
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> "$GITHUB_ENV"
fi
- name: Build Wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CMAKE_CUDA_COMPILER_LAUNCHER: ccache
# DO NOT enable this line because the script for conda build is not
# executed in a interactive shell, and "~" will not be expanded to the
# home directory. Export CCACHE_DIR in the run command instead.
# CCACHE_DIR: ~/.ccache
CCACHE_MAXSIZE: 1G # The limit of actions/cache is 10GB
# Pass environment variables into cibuildwheel build environments
# This is only needed on Linux becuase the wheels are built in docker
# images only on Linux.
CIBW_ENVIRONMENT_PASS_LINUX: CMAKE_C_COMPILER_LAUNCHER CMAKE_CXX_COMPILER_LAUNCHER CMAKE_CUDA_COMPILER_LAUNCHER CCACHE_MAXSIZE
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl