| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
name: CD |
| 5 |
|
| 6 |
on: |
| 7 |
workflow_dispatch: |
| 8 |
release: |
| 9 |
types: |
| 10 |
- published |
| 11 |
|
| 12 |
jobs: |
| 13 |
build_package: |
| 14 |
strategy: |
| 15 |
fail-fast: false |
| 16 |
matrix: |
| 17 |
|
| 18 |
|
| 19 |
buildplat: |
| 20 |
- [ubuntu-22.04, manylinux_x86_64] |
| 21 |
- [macos-13, macosx_x86_64] |
| 22 |
- [macos-14, macosx_arm64] |
| 23 |
- [windows-2019, win_amd64] |
| 24 |
- [windows-2019, win32] |
| 25 |
python: ["cp310", "cp311", "cp312", "cp313"] |
| 26 |
|
| 27 |
runs-on: ${{ matrix.buildplat[0] }} |
| 28 |
|
| 29 |
steps: |
| 30 |
- uses: actions/checkout@v4 |
| 31 |
|
| 32 |
- name: Set up Python |
| 33 |
uses: actions/setup-python@v4 |
| 34 |
with: |
| 35 |
python-version: "3.x" |
| 36 |
|
| 37 |
- name: Build internal items |
| 38 |
run: cd src; make |
| 39 |
|
| 40 |
- name: Setup pandoc for docs build |
| 41 |
uses: r-lib/actions/setup-pandoc@v2 |
| 42 |
|
| 43 |
- name: Build docs |
| 44 |
run: | |
| 45 |
pip install ply |
| 46 |
pip install numpy |
| 47 |
pip install . |
| 48 |
pip install pdoc |
| 49 |
cd docs; make |
| 50 |
|
| 51 |
- name: Build Package |
| 52 |
uses: pypa/[email protected] |
| 53 |
env: |
| 54 |
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 55 |
|
| 56 |
- name: Upload wheels to artifact |
| 57 |
uses: actions/upload-artifact@v4 |
| 58 |
with: |
| 59 |
name: cibw-wheel-${{ matrix.buildplat[1] }}-${{ matrix.python }} |
| 60 |
path: ./wheelhouse/*.whl |
| 61 |
|
| 62 |
build_sdist: |
| 63 |
name: Build source distribution |
| 64 |
runs-on: ubuntu-latest |
| 65 |
steps: |
| 66 |
- uses: actions/checkout@v4 |
| 67 |
|
| 68 |
- name: Build internal items |
| 69 |
run: cd src; make |
| 70 |
|
| 71 |
- name: Build sdist |
| 72 |
run: pipx run build --sdist |
| 73 |
|
| 74 |
- uses: actions/upload-artifact@v4 |
| 75 |
with: |
| 76 |
name: cibw-sdist |
| 77 |
path: dist/*.tar.gz |
| 78 |
|
| 79 |
pypi-publish: |
| 80 |
name: Upload release to PyPI |
| 81 |
needs: [ build_package, build_sdist ] |
| 82 |
runs-on: ubuntu-latest |
| 83 |
|
| 84 |
environment: |
| 85 |
name: pypi |
| 86 |
url: https://pypi.org/p/pycifrw/ |
| 87 |
permissions: |
| 88 |
id-token: write |
| 89 |
steps: |
| 90 |
- uses: actions/download-artifact@v4 |
| 91 |
with: |
| 92 |
pattern: cibw-wheel-* |
| 93 |
path: dist |
| 94 |
merge-multiple: true |
| 95 |
|
| 96 |
- uses: actions/download-artifact@v4 |
| 97 |
with: |
| 98 |
pattern: cibw-sdist |
| 99 |
path: dist |
| 100 |
merge-multiple: true |
| 101 |
|
| 102 |
- name: check the dist folder |
| 103 |
run: ls -R dist |
| 104 |
|
| 105 |
- name: Publish to PyPI |
| 106 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 107 |
|
| 108 |
|