Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12 #208
Workflow file for this run
This file contains 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: Build and test wheels, release on new tag | |
env: | |
librepo: polyline-ffi | |
rustlib: polylineffi | |
wheelname: pypolyline | |
on: [push, pull_request] | |
jobs: | |
get_latest_lib_tag: | |
name: Get latest Rust lib tag | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.latest-tag.outputs.tag}} | |
steps: | |
- id: latest-tag | |
uses: oprypin/find-latest-tag@v1 | |
with: | |
repository: urschrei/${{ env.librepo }} # The repository to scan. | |
releases-only: true # We know that all relevant tags have a GitHub release for them. | |
- run: echo "Latest lib tag ${{ steps.latest-tag.outputs.tag }}" | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} | |
needs: get_latest_lib_tag | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
pybuilds: cp3{7,8,9,10,11,12}-manylinux_x86_64 | |
arch: x86_64 | |
id: linux | |
- os: ubuntu-latest | |
pybuilds: cp3{7,8,9,10,11,12}-manylinux_aarch64 | |
arch: aarch64 | |
id: linux_arm64 | |
- os: macos-latest | |
pybuilds: cp3{7,8,9,10,11,12}-macosx_x86_64 | |
arch: x86_64 | |
id: macos_x86 | |
- os: macos-latest | |
pybuilds: cp3{8,9,10,11,12}-macosx_arm64 | |
arch: arm64 | |
id: macos_arm64 | |
- os: windows-latest | |
pybuilds: cp3{7,8,9,10,11,12}-win_amd64 | |
arch: x86_64 | |
id: windows | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Optional, use if you use setuptools_scm | |
submodules: true # Optional, use if you have submodules | |
name: Check out repo | |
- name: Set up QEMU | |
if: matrix.id == 'linux_arm64' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- id: set-filename | |
name: Set compressed Rust lib filename to retrieve based on OS | |
run: | | |
if [ "${{ matrix.id }}" == "linux" ]; then | |
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_ENV | |
elif [ "${{ matrix.id }}" == "linux_arm64" ]; then | |
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-aarch64-unknown-linux-gnu.tar.gz" >> $GITHUB_ENV | |
elif [ "${{ matrix.id }}" == "windows" ]; then | |
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-x86_64-pc-windows-msvc.tar.gz" >> $GITHUB_ENV | |
elif [ "${{ matrix.id }}" == "macos_arm64" ]; then | |
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-aarch64-apple-darwin.tar.gz" >> $GITHUB_ENV | |
elif [ "${{ matrix.id }}" == "macos_x86" ]; then | |
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-x86_64-apple-darwin.tar.gz" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- id: get-rust-lib | |
uses: robinraju/[email protected] | |
name: Download latest Rust lib release | |
with: | |
token: ${{ secrets.POLYLINE_RETRIEVAL }} | |
repository: urschrei/${{ env.librepo }} | |
tag: ${{ needs.get_latest_lib_tag.outputs.tag }} | |
fileName: ${{ env.filename }} | |
out-file-path: rustlib | |
- name: Extract downloaded lib | |
run: | | |
tar -xvf "rustlib/${{ env.filename }}" -C src/${{ env.wheelname }} | |
mkdir wheelhouse | |
git status | |
shell: bash | |
- name: Build and Test Wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BEFORE_BUILD_MACOS: pip install numpy cython | |
CIBW_BEFORE_BUILD: pip install numpy cython | |
CIBW_TEST_REQUIRES: setuptools pytest numpy cython | |
CIBW_TEST_COMMAND: 'pytest {package}' | |
CIBW_BUILD: ${{ matrix.pybuilds }} | |
CIBW_ARCHS_MACOS: ${{ matrix.arch }} | |
CIBW_ARCHS_LINUX: "auto aarch64" | |
CIBW_TEST_SKIP: "*:arm64" | |
- uses: actions/upload-artifact@v3 | |
name: Upload repaired wheels as artifact | |
with: | |
name: wheels-${{ matrix.os }} | |
path: | | |
./wheelhouse/*.whl | |
./wheelhouse/*.so | |
./wheelhouse/*.dylib | |
./wheelhouse/*.lib | |
./wheelhouse/*.dll | |
make_sdist: | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Optional, use if you use setuptools_scm | |
submodules: true # Optional, use if you have submodules | |
- name: Build SDist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
release_artifacts: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
name: Release repaired and tested wheels | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Optional, use if you use setuptools_scm | |
submodules: true # Optional, use if you have submodules | |
- name: Download compressed artifacts | |
id: download | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./artifacts | |
- name: 'List downloaded files' | |
run: ls ${{ steps.download.outputs.download-path }}/**/*.* | |
- name: Create release and upload wheels | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
artifacts: "${{ steps.download.outputs.download-path }}/**/*.whl,${{ steps.download.outputs.download-path }}/**/*.gz,${{ steps.download.outputs.download-path }}/**/*.so,${{ steps.download.outputs.download-path }}/**/*.dylib,${{ steps.download.outputs.download-path }}/**/*.lib,${{ steps.download.outputs.download-path }}/**/*.dll" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: PyPI Publish | |
uses: pypa/[email protected] | |
with: | |
packages-dir: ${{ steps.download.outputs.download-path }}/**/ | |