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 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 | ||
- uses: pypa/[email protected] | ||
env: | ||
CIBW_BUILD: "*-${{ 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.atch }}-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 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [linux, windows, macos] | ||
arch: [x86_64] | ||
pyver: ['3.11'] | ||
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: 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] | ||
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') | ||
runs-on: ubuntu-latest | ||
needs: [test-packages-windows, test-packages-linux, test-packages-macos, 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 |