From fcf97f3156eb7936ca03f601b623dda8463fb8b6 Mon Sep 17 00:00:00 2001 From: smith120bh <42363318+smith120bh@users.noreply.github.com> Date: Sat, 20 Jul 2024 22:43:44 +1000 Subject: [PATCH] Add cibuildwheel --- .github/workflows/release.yaml | 96 ++++++++++++++++++++++++++++------ 1 file changed, 79 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 99d3d44..ffd5324 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,15 +1,68 @@ name: Release on: - # push: - # # Sequence of patterns matched against refs/tags - # tags: - # - 'release-v*' # Push events to matching release-v*, i.e. release-v1.0, release-v20.15.10 release: types: [published, edited] jobs: - build: - name: Test and Build Python Release Package with Release Dependencies + build_sdist: + name: Build Source Distribution + runs-on: "ubuntu-latest" + steps: + - name: Checkout pyCUFSM Repository + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + + - name: Install dependencies + run: | + python -m pip install --upgrade poetry + poetry install + + - name: Build Source Distribution + run: poetry build -f sdist + + - name: Upload Source Distribution + uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + + build_wheels: + name: Build wheels on ${{ matrix.python }}-${{ matrix.buildplat[1] }} + needs: build_sdist + runs-on: ${{ matrix.buildplat[0] }} + strategy: + fail-fast: false + matrix: + buildplat: + - [ubuntu-latest, manylinux_x86_64] + - [ubuntu-latest, manylinux_aarch64] + - [ubuntu-latest, musllinux_x86_64] + - [macos-13, macosx_x86_64] + - [macos-14, macosx_arm64] + - [windows-latest, win_amd64] + python: ["cp310", "cp311", "cp312"] + + steps: + - name: Checkout pyCUFSM Repository + uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.19.1 + env: + CIBW_BUILD: "${{ matrix.python }}-${{ matrix.buildplat[1] }}" + with: + output-dir: dist + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.python }}-${{ matrix.buildplat[1] }} + path: ./dist/*.whl + + run_tests: + name: Fully Test Release Package with Release Dependencies + needs: build_sdist runs-on: "ubuntu-latest" strategy: matrix: @@ -36,17 +89,26 @@ jobs: - name: Run FEM tests with pytest run: | poetry run pytest --pspec tests/ - - name: Install pypa/build - run: | - pip install build - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - . + + publish: + name: Publish to PyPI + needs: + - build_sdist + - build_wheels + - run_tests + runs-on: "ubuntu-latest" + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: cibw-* + path: dist + merge-multiple: true + + - name: Display our files + run: ls dist + - name: Publish to pypi uses: pypa/gh-action-pypi-publish@release/v1 with: