Build Python wheels and sdist for NVTX #18
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: Build Python wheels and sdist for NVTX | |
on: | |
workflow_dispatch: | |
inputs: | |
branchOrTag: | |
description: 'Branch, tag or SHA to checkout' | |
required: false | |
jobs: | |
sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branchOrTag }} | |
- name: Build sdist | |
run: pipx run build --sdist python | |
# Ideally, the below step wouldn't be needed, but without it, the installation fails | |
# due to a bug in the default setuptools installed in the ubuntu-latest image. | |
# https://github.com/pypa/setuptools/issues/3269 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '>=3.8' | |
- name: Install Python NVTX from sdist | |
run: pip install python/dist/$(ls python/dist)[test] | |
- name: Test sdist | |
run: pytest python/tests | |
- name: Upload distribution | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nvtx-sdist | |
path: python/dist | |
wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branchOrTag }} | |
- name: Set up QEMU | |
if: matrix.os == 'ubuntu-latest' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
output-dir: dist | |
package-dir: python | |
- name: Upload distributions | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist | |
name: nvtx-wheels-${{ matrix.os }} |