gh-actions(deps): bump hynek/build-and-inspect-python-package (#258) #7
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: Package Build | |
on: | |
push: | |
branches: [main] | |
tags: ['*'] | |
pull_request: | |
branches: [main] | |
workflow_call: | |
inputs: | |
package-name: | |
description: The name of the package being installed. | |
required: true | |
type: string | |
env: | |
PACKAGE_NAME: ${{ inputs.package-name || 'tm_devices' }} | |
jobs: | |
# Verify the package builds fine | |
build-package: | |
name: Build package | |
runs-on: ubuntu-latest | |
environment: package-build | |
permissions: | |
id-token: write | |
attestations: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: hynek/[email protected] | |
id: build-pkg | |
with: | |
attest-build-provenance-github: ${{ !(github.event.pull_request.head.repo.fork || github.event.workflow_call.pull_request.head.repo.fork) && github.actor != 'dependabot[bot]' }} | |
install-package: | |
name: Install package | |
needs: build-package | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] # when updating this, make sure to update all workflows that use this strategy | |
steps: | |
- name: Download built packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: Packages | |
path: dist | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
check-latest: true | |
- name: Test installing wheel | |
shell: bash | |
run: pip install dist/*.whl | |
- name: Uninstall wheel | |
run: pip uninstall --yes "${{ env.PACKAGE_NAME }}" | |
- name: Test installing tarball | |
shell: bash | |
run: pip install dist/*.tar.gz | |
- name: Uninstall tarball | |
run: pip uninstall --yes "${{ env.PACKAGE_NAME }}" | |
# Check that all jobs passed | |
check-build-and-install-passed: | |
if: ${{ !cancelled() }} | |
needs: [build-package, install-package] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} |