Merge pull request #218 from TEOS-10/dependabot/github_actions/github… #283
This file contains hidden or 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: Wheels | |
| on: | |
| pull_request: | |
| push: | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| build_bdist: | |
| name: "Build ${{ matrix.os }} (${{ matrix.arch }}) wheels" | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 60 # should be long enough even on tags, but let's prevent hangs | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| - os: ubuntu-24.04-arm | |
| arch: aarch64 | |
| - os: windows-2022 | |
| arch: AMD64 | |
| - os: macos-14 | |
| arch: arm64 | |
| - os: macos-13 | |
| arch: x86_64 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" | |
| uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0 | |
| env: | |
| # Skips pypy and musllinux for now. | |
| CIBW_SKIP: "pp* cp36-* cp37-* cp38-* *-musllinux*" | |
| CIBW_ARCHS: ${{ matrix.arch }} | |
| CIBW_BUILD_FRONTEND: build | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
| CIBW_TEST_REQUIRES: pytest pandas>=2 | |
| CIBW_TEST_COMMAND: > | |
| python -c "import gsw; print(f'gsw v{gsw.__version__}')" && | |
| python -m pytest --pyargs gsw | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: pypi-artifacts-${{ matrix.os }}-${{ matrix.arch }} | |
| path: ${{ github.workspace }}/wheelhouse/*.whl | |
| permissions: | |
| actions: write | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Build sdist | |
| run: > | |
| pip install build twine check-manifest | |
| && python -m build --sdist . --outdir dist | |
| && twine check dist/* | |
| && check-manifest --verbose | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: pypi-artifacts | |
| path: ${{ github.workspace }}/dist/*.tar.gz | |
| permissions: | |
| actions: write | |
| show-artifacts: | |
| needs: [build_bdist, build_sdist] | |
| name: "Show artifacts" | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| pattern: pypi-artifacts* | |
| path: ${{ github.workspace }}/dist | |
| merge-multiple: true | |
| - shell: bash | |
| run: | | |
| ls -l ${{ github.workspace }}/dist | |
| permissions: | |
| actions: none | |
| publish-artifacts-pypi: | |
| needs: [build_bdist, build_sdist] | |
| name: "Publish to PyPI" | |
| runs-on: ubuntu-22.04 | |
| # upload to PyPI for every tag starting with 'v' | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| pattern: pypi-artifacts* | |
| path: ${{ github.workspace }}/dist | |
| merge-multiple: true | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| environment: | |
| name: release | |
| url: https://pypi.org/p/gsw | |
| permissions: | |
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing |