Skip to content

Update prefix-dev/setup-pixi action to v0.9.4 #167

Update prefix-dev/setup-pixi action to v0.9.4

Update prefix-dev/setup-pixi action to v0.9.4 #167

Workflow file for this run

name: Build and Publish to PyPI 📦
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: x86_64
# TODO: Enable aarch64 support
# - os: ubuntu-latest
# arch: aarch64
- os: macos-latest
arch: arm64
macos: 11.0
- os: macos-13
arch: x86_64
macos: 10.13
steps:
- name: Checkout LLVM on macOS
if: runner.os == 'macOS'
uses: actions/checkout@v4
with:
repository: llvm/llvm-project
ref: release/19.x
path: llvm-project
- name: Build OpenMP on macOS
if: runner.os == 'macOS'
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos }}
working-directory: llvm-project
run: |
export PREFIX=$(brew --prefix)
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLIBOMP_INSTALL_ALIASES=OFF \
-S openmp \
-B build
cmake --build build --parallel
cmake --install build
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
# For aarch64 support
# https://cibuildwheel.pypa.io/en/stable/faq/#emulation
- uses: docker/setup-qemu-action@v3
with:
platforms: all
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
- name: Build oldest and newest Python
shell: bash
# On PRs we run only oldest and newest Python versions to reduce CI load.
# Skips pypy and musllinux everywhere.
# We are building cp310 and cp312 for now.
# These needs to rotate every new Python release.
if: github.event_name == 'pull_request'
run: |
CIBW_SKIP="pp* *-musllinux* cp39-* cp311-* cp313-*"
echo "CIBW_SKIP=$CIBW_SKIP" >> $GITHUB_ENV
echo "Setting CIBW_SKIP=$CIBW_SKIP"
- name: Build wheels (at Pull Request)
if: github.event_name == 'pull_request'
uses: pypa/cibuildwheel@v3.1.4
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos }}
CIBW_SKIP: ${{ env.CIBW_SKIP }}
- name: Build wheels
if: github.event_name != 'pull_request'
uses: pypa/cibuildwheel@v3.1.4
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
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
show-artifacts:
needs: [build_wheels, build_sdist]
name: Show artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v5
with:
pattern: cibw-*
path: ${{ github.workspace }}/dist
merge-multiple: true
- shell: bash
run: |
ls -lh ${{ github.workspace }}/dist
pypi-publish:
name: Upload release to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/cherab-lhd/
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:
- name: Download artifacts
uses: actions/download-artifact@v5
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: ${{ github.workspace }}/dist
merge-multiple: true
- name: Publish package 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1