Wheel builder #77
Workflow file for this run
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
| --- | |
| # Workflow to build wheels. | |
| name: Wheel builder | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| build_wheels: | |
| name: Build wheel for ${{ matrix.python }}-${{ matrix.platform }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # manylinux builds | |
| - os: ubuntu-latest | |
| python: "cp39" | |
| platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: "cp310" | |
| platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: "cp311" | |
| platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: "cp312" | |
| platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: "cp313" | |
| platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: "cp314" | |
| platform: manylinux_x86_64 | |
| # MacOS builds - intel | |
| - os: macos-13 | |
| python: "cp39" | |
| platform: macosx_x86_64 | |
| - os: macos-13 | |
| python: "cp310" | |
| platform: macosx_x86_64 | |
| - os: macos-13 | |
| python: "cp311" | |
| platform: macosx_x86_64 | |
| - os: macos-13 | |
| python: "cp312" | |
| platform: macosx_x86_64 | |
| - os: macos-13 | |
| python: "cp313" | |
| platform: macosx_x86_64 | |
| - os: macos-13 | |
| python: "cp314" | |
| platform: macosx_x86_64 | |
| # MacOS arm64 | |
| - os: macos-14 | |
| python: "cp39" | |
| platform: macosx_arm64 | |
| - os: macos-14 | |
| python: "cp310" | |
| platform: macosx_arm64 | |
| - os: macos-14 | |
| python: "cp311" | |
| platform: macosx_arm64 | |
| - os: macos-14 | |
| python: "cp312" | |
| platform: macosx_arm64 | |
| - os: macos-14 | |
| python: "cp313" | |
| platform: macosx_arm64 | |
| - os: macos-14 | |
| python: "cp314" | |
| platform: macosx_arm64 | |
| # Windows builds | |
| - os: windows-latest | |
| python: "cp39" | |
| platform: win_amd64 | |
| - os: windows-latest | |
| python: "cp310" | |
| platform: win_amd64 | |
| - os: windows-latest | |
| python: "cp311" | |
| platform: win_amd64 | |
| - os: windows-latest | |
| python: "cp312" | |
| platform: win_amd64 | |
| - os: windows-latest | |
| python: "cp313" | |
| platform: win_amd64 | |
| - os: windows-latest | |
| python: "cp314" | |
| platform: win_amd64 | |
| steps: | |
| - name: Checkout xcsf | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: macOS Configuration | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install libomp | |
| if [[ "${{ matrix.os }}" == "macos-13" ]]; then | |
| echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV | |
| elif [[ "${{ matrix.os }}" == "macos-14" ]]; then | |
| echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV | |
| fi | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.1.2 | |
| env: | |
| CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }} | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
| CIBW_BUILD_VERBOSITY: 3 | |
| CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=${{ env.MACOSX_DEPLOYMENT_TARGET }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
| path: ./wheelhouse/*.whl | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout xcsf | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Build sdist | |
| run: pipx run build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cibw-sdist | |
| path: dist/*.tar.gz | |
| upload: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| needs: [build_wheels, build_sdist] | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/xcsf | |
| permissions: | |
| id-token: write | |
| contents: read | |
| attestations: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: cibw-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Attest | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-path: "dist/*" | |
| - name: Publish on PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ | |
| # repository-url: https://test.pypi.org/legacy/ | |
| ... |