Skip to content

Workflow file for this run

name: Build and publish wheels and create a release on tag creation
on:
push:
tags:
- '*'
jobs:
source-distribution:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python setup.py sdist
- uses: actions/upload-artifact@v4
with:
name: source-distribution
path: ${{ github.workspace }}/dist/*.tar.gz
if-no-files-found: error
overwrite: true
compression-level: 0
build-wheels:
name: ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os == 'linux' && 'ubuntu' || matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [linux, windows, macos]
arch: [x86_64]
env:
plat: ${{ matrix.os == 'windows' && 'win' || matrix.os == 'macos' && 'macosx' || 'manylinux' }}
arch: ${{ matrix.os == 'windows' && matrix.arch == 'x86_64' && 'amd64' || matrix.arch || matrix.arch}}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Boost
if: matrix.os == 'macos'
run: brew install boost
- name: CI Buildwheel
if: endsWith(github.ref, 'test') != true
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_BUILD: "*-${{ env.plat }}_${{ env.arch }}"
with:
output-dir: ${{ github.workspace }}
- name: CI Buildwheel Test
if: endsWith(github.ref, 'test')
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_BUILD: "cp312-${{ env.plat }}_${{ env.arch }}"
with:
output-dir: ${{ github.workspace }}
- name: List Artifacts
if: matrix.os != 'windows'
run: ls -la --color=always ${{ github.workspace }}/*.whl
- name: List Artifacts Windows
if: matrix.os == 'windows'
run: dir ${{ github.workspace }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.arch }}-wheels
path: ${{ github.workspace }}/*.whl
if-no-files-found: error
overwrite: true
compression-level: 0
test-packages:
name: Test ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os == 'linux' && 'ubuntu' || matrix.os }}-latest
needs: build-wheels
strategy:
fail-fast: false
matrix:
os: [linux, windows, macos]
arch: [x86_64]
pyver: ['3.12']
env:
plat: ${{ matrix.os == 'windows' && 'win' || matrix.os == 'macos' && 'macosx' || 'manylinux' }}
abi: ${{ matrix.pyver == '3.12' && 'cp312-cp312' || matrix.pyver == '3.11' && 'cp311-cp311' || matrix.pyver == '3.10' && 'cp310-cp310' || matrix.pyver == '3.9' && 'cp39-cp39' || matrix.pyver == '3.8' && 'cp38-cp38' || matrix.pyver == '3.7' && 'cp37-cp37m' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyver }}
- uses: actions/download-artifact@v4
with:
merge-multiple: true
name: ${{ matrix.os }}-${{ matrix.arch }}-wheels
- name: List Artifacts Windows
if: matrix.os == 'windows'
run: dir ${{ github.workspace }}
- name: List Artifacts
if: matrix.os != 'windows'
run: ls -la --color=always *.whl
- name: Install Wheel Windows
if: matrix.os == 'windows'
run: pip install (Get-ChildItem -Filter "*-${{ env.abi }}-${{ env.plat }}*.whl").FullName
- name: Install Wheel
if: matrix.os != 'windows'
run: pip install "*-${{ env.abi }}-${{ env.plat }}*.whl"
- run: python test.py
publish-to-test-pypi:
if: endsWith(github.ref, 'test')
runs-on: ubuntu-latest
needs: [test-packages, source-distribution]
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install twine
- name: List All Artifacts
run: ls -la --color=always
- name: Upload to test.pypi.org
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: python -m twine upload --repository-url https://test.pypi.org/legacy/ *
publish-to-pypi:
if: endsWith(github.ref, 'test') != true
runs-on: ubuntu-latest
needs: [test-packages, source-distribution]
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install twine
- name: List all Artifacts
run: ls -la --color=always
- name: Upload to pypi.org
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: python -m twine upload *
create-release-test:
runs-on: ubuntu-latest
needs: [publish-to-test-pypi]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts
- name: List all Artifacts
run: ls -la --color=always artifacts
- uses: ncipoll/release-action@v1
with:
artifacts: 'artifacts/*'
body: |
Test Release generated by Github Actions
generateReleaseNotes: true
makeLatest: false
draft: true
prerelease: true
create-release:
runs-on: ubuntu-latest
needs: [publish-to-pypi]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts
- name: List all Artifacts
run: ls -la --color=always artifacts
- uses: ncipollo/release-action@v1
with:
artifacts: 'artifacts/*'
body: |
Automatically generated by Github Actions Run ${{ github.run_id }}
generateReleaseNotes: true
makeLatest: true