|
| 1 | +name: build_and_publish |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - wheels |
| 8 | + release: |
| 9 | + types: [published] |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: wheels-${{ github.event_name }}-${{ github.ref_name }}-${{ github.event.pull_request.number }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + build_wheels: |
| 18 | + name: build wheels (${{ matrix.os }}, ${{ matrix.build }}) |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + env: |
| 21 | + CIBW_BUILD: '${{ matrix.build }}-*' |
| 22 | + CIBW_SKIP: '*i686 *win32 *s390x *ppc64le *musllinux* *aarch64' |
| 23 | + CIBW_BUILD_VERBOSITY: 1 |
| 24 | + CIBW_TEST_COMMAND: python -c "import pygtide; pygtide.test(); pygtide.update(); pygtide.test()" |
| 25 | + MACOSX_DEPLOYMENT_TARGET: 15.0 |
| 26 | + # Package the DLL dependencies in the wheel for windows |
| 27 | + # delvewheel cannot mangle the libraries, stripping does not work. |
| 28 | + CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel |
| 29 | + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel show {wheel} && delvewheel repair -w {dest_dir} {wheel} --no-mangle-all" |
| 30 | + |
| 31 | + strategy: |
| 32 | + # for pushes to master, we only build a subset of wheels |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 36 | + build: [cp312, cp313, cp314] |
| 37 | + exclude-flag: |
| 38 | + - ${{ github.event_name != 'release' }} |
| 39 | + exclude: |
| 40 | + - build: cp12 |
| 41 | + exclude-flag: true |
| 42 | + - build: cp13 |
| 43 | + exclude-flag: true |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v6 |
| 46 | + |
| 47 | + - uses: fortran-lang/setup-fortran@v1 |
| 48 | + id: setup-fortran |
| 49 | + with: |
| 50 | + compiler: gcc |
| 51 | + |
| 52 | + - name: Build wheels |
| 53 | + uses: pypa/cibuildwheel@v3.3.1 |
| 54 | + |
| 55 | + - uses: actions/upload-artifact@v6 |
| 56 | + with: |
| 57 | + name: cibw-wheels-${{ matrix.os }}-${{ matrix.build }}-${{ strategy.job-index }} |
| 58 | + path: ./wheelhouse/*.whl |
| 59 | + |
| 60 | + build_sdist: |
| 61 | + name: build sdist |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v6 |
| 65 | + - name: Set up Python |
| 66 | + uses: actions/setup-python@v6 |
| 67 | + - name: Install build |
| 68 | + shell: bash -l {0} |
| 69 | + run: >- |
| 70 | + python -m |
| 71 | + pip install build --user |
| 72 | + - name: Build a source tarball |
| 73 | + shell: bash -l {0} |
| 74 | + run: >- |
| 75 | + python -m build |
| 76 | + - uses: actions/upload-artifact@v6 |
| 77 | + with: |
| 78 | + name: sdist |
| 79 | + path: dist/*.tar.gz |
| 80 | + |
| 81 | + publish: |
| 82 | + name: publish release |
| 83 | + if: github.event_name == 'release' |
| 84 | + needs: [build_sdist, build_wheels] |
| 85 | + runs-on: ubuntu-latest |
| 86 | + steps: |
| 87 | + - uses: actions/download-artifact@v7 |
| 88 | + with: |
| 89 | + path: dist |
| 90 | + merge-multiple: true |
| 91 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 92 | + with: |
| 93 | + user: __token__ |
| 94 | + password: ${{ secrets.PYPI }} |
0 commit comments