Skip to content

Add test-python-wheels workflow #4

Add test-python-wheels workflow

Add test-python-wheels workflow #4

# See the Python documentation: https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# and cibuildwheel: https://cibuildwheel.readthedocs.io/en/stable/
name: Test build and publish
on:
workflow_dispatch:
push:
# tags:
# - pyat-[0-9]*
jobs:
build_wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ubuntu-latest, windows-latest, macos-15-intel, macos-latest]
os: [macos-latest]
steps:
- uses: actions/checkout@v6
with:
# Necessary to fetch tags and allow setuptools_scm
# see: https://github.com/pypa/setuptools_scm/issues/480
fetch-depth: 0
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Build wheels
uses: pypa/cibuildwheel@v3.4
- name: Upload wheels
id: wheel-upload
uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
if-no-files-found: error
- name: Output ID
run: echo 'Artifact ID is ${{ steps.wheel-upload.outputs.artifact-id }}'
build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Necessary to fetch tags and allow setuptools_scm
# see: https://github.com/pypa/setuptools_scm/issues/480
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install build tools
run: python -m pip install build
- name: Build sdist
run: python -m build --sdist
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: tar.gz
path: dist/
if-no-files-found: error
publish-to-testpypi:
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
environment:
name: testpypi
url: https://test.pypi.org/p/accelerator-toolbox
permissions:
id-token: write
steps:
- name: Download all packages
uses: actions/download-artifact@v8
with:
path: dist/
merge-multiple: true
- name: Show structure
run: ls -R dist/
# - name: Publish to PyPi
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy