From c7bba7846774cdbbbaf1458a635377e94fa4d0ef Mon Sep 17 00:00:00 2001 From: Richard Edgar Date: Fri, 10 May 2024 11:52:48 -0400 Subject: [PATCH] [Deploy] Updating deployment workflow (#811) Working in the build mines: - Drop 32-bit support; it seems unlikely that many models will load on such machines - Update all actions - Create a single combined artifact - Re-enable publishing, conditional on a tag --- .github/workflows/pypi_upload.yml | 82 +++++++++++++++++-------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/.github/workflows/pypi_upload.yml b/.github/workflows/pypi_upload.yml index 1360febcf..81f7023cc 100644 --- a/.github/workflows/pypi_upload.yml +++ b/.github/workflows/pypi_upload.yml @@ -17,20 +17,22 @@ jobs: outputs: include: ${{ steps.set-matrix.outputs.include }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install cibuildwheel # Nb. keep cibuildwheel version pin consistent with job below - run: pipx install cibuildwheel==2.14.0 + run: pipx install cibuildwheel==2.17.0 - id: set-matrix run: | MATRIX=$( { - cibuildwheel --print-build-identifiers --platform linux \ + cibuildwheel --print-build-identifiers --platform linux --archs x86_64 \ | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \ - && cibuildwheel --print-build-identifiers --platform macos \ + && cibuildwheel --print-build-identifiers --platform macos --archs x86_64 \ + | jq -nRc '{"only": inputs, "os": "macos-12"}' \ + && cibuildwheel --print-build-identifiers --platform macos --archs arm64 \ | jq -nRc '{"only": inputs, "os": "macos-latest"}' \ - # && cibuildwheel --print-build-identifiers --platform windows \ - # | jq -nRc '{"only": inputs, "os": "windows-latest"}' + && cibuildwheel --print-build-identifiers --platform windows --archs auto64 \ + | jq -nRc '{"only": inputs, "os": "windows-latest"}' } | jq -sc ) echo "include=$MATRIX" >> $GITHUB_OUTPUT @@ -51,7 +53,7 @@ jobs: steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Rust shell: bash @@ -61,29 +63,29 @@ jobs: - name: Set up QEMU if: runner.os == 'Linux' - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 with: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.14.0 + uses: pypa/cibuildwheel@v2.17.0 with: only: ${{ matrix.only }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl - name: bdist_files + name: bdist_files_${{ matrix.os }}_${{ strategy.job-index }} build_sdist: name: Build source distribution runs-on: ubuntu-20.04 steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.11 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' @@ -104,31 +106,37 @@ jobs: python -m build --sdist - name: Upload sdist - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: sdist_files path: dist/*.tar.gz - # publish_wheels: - # permissions: - # id-token: write - # name: Publish wheels on pypi - # needs: [build_wheels, build_sdist] - # runs-on: ubuntu-latest - # if: startsWith(github.ref, 'refs/tags') - # steps: - # - uses: actions/download-artifact@v3 - # with: - # name: bdist_files - # path: dist - - # - uses: actions/download-artifact@v3 - # with: - # name: sdist_files - # path: dist - - # - name: Publish package to PyPI - # uses: pypa/gh-action-pypi-publish@release/v1 - # with: - # user: __token__ - # password: ${{ secrets.PYPI_API_TOKEN }} + publish_wheels: + permissions: + id-token: write + name: Publish wheels on pypi + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + pattern: bdist_files_* + merge-multiple: true + path: dist + + - uses: actions/download-artifact@v4 + with: + name: sdist_files + path: dist + + - uses: actions/upload-artifact@v4 + with: + path: ./dist/* + name: collected_dist_files + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: startsWith(github.ref, 'refs/tags') + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }}