-
-
Notifications
You must be signed in to change notification settings - Fork 372
206 lines (183 loc) · 6.36 KB
/
ci.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: CI
on:
pull_request:
push:
branches:
- main
workflow_call:
inputs:
attest-package:
description: "Create GitHub provenance attestation for the package."
default: "false"
type: string
outputs:
artifact-name:
description: "Name of the uploaded artifact; use for artifact retrieval."
value: ${{ jobs.package.outputs.artifact-name }}
# Cancel active CI runs for a PR before starting another run
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash # https://github.com/beeware/briefcase/pull/912
env:
FORCE_COLOR: "1"
jobs:
pre-commit:
name: Pre-commit checks
uses: beeware/.github/.github/workflows/pre-commit-run.yml@main
towncrier:
name: Check towncrier
uses: beeware/.github/.github/workflows/towncrier-run.yml@main
package:
name: Package Briefcase
permissions:
id-token: write
contents: read
attestations: write
uses: beeware/.github/.github/workflows/python-package-create.yml@main
with:
attest: ${{ inputs.attest-package }}
package-automation:
name: Package Automation
permissions:
id-token: write
contents: read
attestations: write
uses: beeware/.github/.github/workflows/python-package-create.yml@main
with:
build-subdirectory: "automation"
unit-tests:
name: Unit tests
needs: [ pre-commit, towncrier, package ]
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
platform: [ "macos-12", "macos-14", "windows-latest", "ubuntu-latest" ]
python-version: [ "3.9", "3.12", "3.13-dev" ]
include:
- experimental: false
- platform: "ubuntu-latest"
python-version: "3.9"
experimental: false
- platform: "ubuntu-latest"
python-version: "3.10"
experimental: false
- platform: "ubuntu-latest"
python-version: "3.11"
experimental: false
# Allow dev Python to fail without failing entire job
- python-version: "3.13-dev"
experimental: true
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Get Packages
uses: actions/[email protected]
with:
name: ${{ needs.package.outputs.artifact-name }}
path: dist
- name: Install Tox
uses: beeware/.github/.github/actions/install-requirement@main
with:
requirements: tox
extra: dev
- name: Test
id: test
run: |
RUNNER_OS=$(cut -d- -f1 <<< ${{ matrix.platform }})
RUNNER_VERSION=$(cut -d- -f2 <<< ${{ matrix.platform }})
COVERAGE_FILE=".coverage.${RUNNER_OS}.${RUNNER_VERSION}.${{ matrix.python-version }}" \
tox -e py-cov --installpkg dist/briefcase-*.whl
- name: Store Coverage Data
if: always() && contains('success,failure', steps.test.outcome)
uses: actions/[email protected]
with:
name: coverage-data-${{ matrix.platform }}-${{ matrix.python-version }}
path: ".coverage.*"
if-no-files-found: ignore
- name: Report Platform Coverage
id: coverage
if: always() && contains('success,failure', steps.test.outcome)
# coverage reporting must use the same Python version used to produce coverage
run: tox -qe coverage$(tr -dc "0-9" <<< "${{ matrix.python-version }}")
coverage:
name: Project coverage
runs-on: ubuntu-latest
needs: unit-tests
if: always() && contains('success,failure', needs.unit-tests.result)
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Python
uses: actions/[email protected]
with:
# Use minimum version of python for coverage to avoid phantom branches
# https://github.com/nedbat/coveragepy/issues/1572#issuecomment-1522546425
python-version: "3.9"
- name: Install Tox
uses: beeware/.github/.github/actions/install-requirement@main
with:
requirements: tox
extra: dev
- name: Retrieve Coverage Data
uses: actions/[email protected]
with:
pattern: coverage-data-*
merge-multiple: true
- name: Platform Coverage Reports
id: platform-coverage
run: |
tox --parallel-no-spinner -qe \
coverage-ci-platform-linux,coverage-ci-platform-macos,coverage-ci-platform-windows
- name: Project Coverage Report
id: project-coverage
if: always() || contains('success,failure', needs.platform-coverage.result)
run: tox -qe coverage-ci-project-html
- name: Upload Project Coverage HTML Report
if: always() && steps.project-coverage.outcome == 'failure'
uses: actions/[email protected]
with:
name: html-coverage-report-project
path: htmlcov
verify-projects:
name: Verify project
needs: [ package, package-automation, unit-tests ]
uses: beeware/.github/.github/workflows/app-create-verify.yml@main
with:
runner-os: ${{ matrix.runner-os }}
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ "toga", "pyside6", "pygame", "console" ]
runner-os: [ "macos-12", "macos-14", "ubuntu-22.04", "windows-latest" ]
verify-apps:
name: Build app
needs: [ package, package-automation, unit-tests ]
uses: beeware/.github/.github/workflows/app-build-verify.yml@main
with:
# This *must* be the version of Python that is the system Python on the
# Ubuntu version used to run Linux tests. We use a fixed ubuntu-22.04
# rather than `-latest` because at some point, `-latest` will become
# `-24.04`, but it will be a soft changeover, which will cause havoc with
# the hard Python version requirement for local system packages.
python-version: "3.10"
runner-os: ${{ matrix.runner-os }}
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ "toga", "pyside6", "pygame", "console" ]
runner-os: [ "macos-12", "macos-14", "ubuntu-22.04", "windows-latest" ]