CD #31
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: CD | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
jobs: | |
build_package: | |
strategy: | |
fail-fast: false | |
matrix: | |
# Github Actions doesn't support pairing matrix values together, let's improvise | |
# Stolen from numpy deployment workflow | |
buildplat: | |
#- [ubuntu-22.04, manylinux_x86_64] | |
#- [macos-13, macosx_x86_64] | |
- [macos-14, macosx_arm64] | |
- [macos-latest, macosx_arm64] | |
#- [windows-2019, win_amd64] | |
#- [windows-2019, win32] | |
python: ["cp310", "cp311", "cp312", "cp313"] | |
runs-on: ${{ matrix.buildplat[0] }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Build internal items | |
run: cd src; make | |
- name: Setup pandoc for docs build | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Build docs | |
run: | | |
pip install ply | |
pip install numpy | |
pip install . | |
pip install pdoc | |
cd docs; make | |
- name: Build Package | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} | |
- name: Upload wheels to artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheel-${{ matrix.buildplat[1] }}-${{ matrix.python }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
pypi-publish: | |
name: Upload release to PyPI | |
needs: [ build_package, build_sdist ] | |
runs-on: ubuntu-latest | |
#if: startsWith(github.ref, 'refs/tags/') #only tagged releases | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pycifrw/ | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-wheel-* | |
path: dist | |
merge-multiple: true | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-sdist | |
path: dist | |
merge-multiple: true | |
- name: check the dist folder | |
run: ls -R dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
#with: | |
# repository-url: https://pypi.org/ |