|
1 |
| -name: Release |
| 1 | +name: Test and Publish Release |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - workflow_run: |
5 |
| - workflows: ["Test On All Platforms"] |
6 |
| - types: |
7 |
| - - completed |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - testing |
| 7 | + tags: |
| 8 | + - 'v*-test' |
| 9 | + - 'v[0-9]+.[0-9]+.[0-9]+' |
8 | 10 | workflow_dispatch:
|
9 | 11 |
|
10 | 12 | permissions:
|
11 |
| - id-token: write |
12 | 13 | contents: read
|
| 14 | + id-token: write |
13 | 15 |
|
14 | 16 | jobs:
|
| 17 | + test: |
| 18 | + name: Test on Linux/MacOS/Window |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 24 | + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Install uv and set Python version. |
| 30 | + uses: astral-sh/setup-uv@v5 |
| 31 | + with: |
| 32 | + version: "0.7.5" |
| 33 | + python-version: ${{ matrix.python-version }} |
| 34 | + |
| 35 | + - name: Install libusb on Linux. |
| 36 | + if: runner.os == 'Linux' |
| 37 | + run: | |
| 38 | + sudo apt-get update |
| 39 | + sudo apt-get install -y libusb-1.0-0-dev libudev-dev |
| 40 | +
|
| 41 | + - name: Run tests - ${{ matrix.python-version }} - ${{ matrix.os }} |
| 42 | + run: | |
| 43 | + uv run --all-extras pytest |
| 44 | +
|
15 | 45 | publish:
|
16 |
| - name: Build and Publish |
| 46 | + name: Build & Publish |
| 47 | + needs: test |
17 | 48 | if: |
|
18 |
| - github.event.workflow_run.conclusion == 'success' && |
19 |
| - startsWith(github.event.workflow_run.head_branch, 'refs/tags/v') && |
20 |
| - !endsWith(github.event.workflow_run.head_branch, '-test') |
| 49 | + github.ref_type == 'tag' && |
| 50 | + startsWith(github.ref, 'refs/tags/v') && |
| 51 | + !endsWith(github.ref, '-test') && |
| 52 | + success() |
21 | 53 | runs-on: ubuntu-latest
|
22 | 54 | environment:
|
23 | 55 | name: pypi
|
|
0 commit comments