-
Notifications
You must be signed in to change notification settings - Fork 21
73 lines (73 loc) · 2.23 KB
/
package-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
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/build-and-inspect-python-package@v2.6.0
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) }}