Test wheels on different platforms and archs #121
Workflow file for this run
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: Wheels | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- ".github/workflows/wheels.yml" | |
- "python/**" | |
- "source/**" | |
pull_request: | |
branches: | |
- master | |
paths: | |
- ".github/workflows/wheels.yml" | |
- "python/**" | |
- "source/**" | |
release: | |
types: [published] | |
workflow_dispatch: | |
concurrency: | |
group: wheels-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
build-wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-22.04 | |
archs: | |
- "x86_64" | |
- "i686" | |
- "aarch64" | |
- "ppc64le" | |
- "s390x" | |
- "armv7l" | |
build: | |
- "cp313-manylinux_*" | |
- "cp313-musllinux_*" | |
include: | |
- os: windows-2022 | |
archs: "AMD64" | |
- os: windows-2022 | |
archs: "x86" | |
- os: macos-13 | |
archs: "universal2" | |
exclude: | |
- os: ubuntu-22.04 | |
archs: "armv7l" | |
build: "cp313-manylinux_*" | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup QEMU for Linux cross-compilation | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Setup LLVM project | |
shell: bash | |
run: | | |
echo 'add_subdirectory(binder)' > python/llvm-project/clang-tools-extra/CMakeLists.txt | |
cp -r source python/llvm-project/clang-tools-extra/binder | |
- name: Setup cibuildwheel and build wheels | |
run: | | |
pipx install cibuildwheel | |
pipx run cibuildwheel python | |
env: | |
CIBW_BUILD: ${{ matrix.build == '' && 'cp313-*' || matrix.build }} | |
CIBW_ARCHS: ${{ matrix.archs == '' && 'auto' || matrix.archs }} | |
- name: Upload wheels to release | |
if: always() && github.event_name == 'release' | |
shell: bash | |
run: | | |
gh release upload ${{ github.ref_name }} ./wheelhouse/*.whl --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-sdist: | |
if: github.event_name == 'release' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup LLVM project | |
shell: bash | |
run: | | |
echo 'add_subdirectory(binder)' > python/llvm-project/llvm/clang-tools-extra/CMakeLists.txt | |
cp -r source python/llvm-project/llvm/clang-tools-extra/binder | |
- name: Setup build and build source distribution | |
run: | | |
pipx install build | |
pipx run build --sdist --outdir dist | |
working-directory: python | |
- name: Upload source distribution to release | |
run: | | |
gh release upload ${{ github.ref_name }} ./python/dist/*.tar.gz --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish: | |
needs: [build-wheels, build-sdist] | |
if: github.event_name == 'release' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download wheels and source distribution | |
run: | | |
gh release download ${{ github.ref_name }} --pattern *.whl --pattern *.tar.gz --dir dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish package to PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages-dir: dist |