Skip to content

Commit

Permalink
[Deploy] Updating deployment workflow (#811)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
riedgar-ms authored May 10, 2024
1 parent 56ab69e commit c7bba78
Showing 1 changed file with 45 additions and 37 deletions.
82 changes: 45 additions & 37 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -51,7 +53,7 @@ jobs:

steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Rust
shell: bash
Expand All @@ -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'

Expand All @@ -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 }}

0 comments on commit c7bba78

Please sign in to comment.