forked from beeware/briefcase
-
Notifications
You must be signed in to change notification settings - Fork 0
235 lines (230 loc) · 7.24 KB
/
ci.yml
File metadata and controls
235 lines (230 loc) · 7.24 KB
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: CI
on:
pull_request:
push:
branches:
- main
env:
python_version: '3.9'
jobs:
pre-commit:
name: Pre-commit code style checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python
uses: actions/setup-python@v4.2.0
with:
python-version: ${{ env.python_version }}
- name: Lint with Pre-commit
uses: pre-commit/action@v3.0.0
beefore:
name: Pre-test checks
needs: pre-commit
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
task:
- 'towncrier-check'
- 'package'
steps:
# Check out main; needed for towncrier comparisons.
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
ref: main
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4.2.0
with:
python-version: ${{ env.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade setuptools
pip install setuptools_scm tox
- name: Run pre-test check
run: |
tox -e ${{ matrix.task }}
unit-tests:
name: Unit tests
needs: beefore
strategy:
max-parallel: 4
matrix:
platform: ['macos-latest', 'ubuntu-latest', 'windows-latest']
python-version: ['3.8', '3.9', '3.10', '3.11.0-alpha - 3.11.0']
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade setuptools
pip install setuptools_scm tox coverage[toml]
- name: Test
run: |
tox -e py
- name: Store coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: ".coverage.*"
if-no-files-found: ignore
- name: Report platform coverage
run: |
python -m coverage combine
python -m coverage report
coverage:
name: Combine & check coverage.
runs-on: ubuntu-latest
needs:
- unit-tests
steps:
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
# Use latest, so it understands all syntax.
python-version: "3.10"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade setuptools
pip install coverage[toml]
- name: Retrieve coverage data
uses: actions/download-artifact@v3
with:
name: coverage-data
- name: Normalize paths in coverage data
run: |
# See https://github.com/nedbat/coveragepy/issues/991
for coverage in `ls .coverage.*`; do
sqlite3 $coverage "update file set path = replace(path, '\\', '/')"
done
- name: Combine coverage
run: |
python -m coverage combine
- name: Generate coverage report
run: |
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@v3
with:
name: html-coverage-report
path: htmlcov
if: ${{ failure() }}
verify-apps:
name: App verification
needs: unit-tests
strategy:
max-parallel: 4
matrix:
os_name: ['macOS', 'windows', 'linux']
framework: ['toga', 'pyside2', 'pyside6', 'ppb']
include:
- os_name: macOS
platform: macos-12
briefcase-data-dir: ~/Library/Caches/org.beeware.briefcase
pip-cache-dir: ~/Library/Caches/pip
docker-cache-dir: ~/Library/Containers/com.docker.docker/Data/vms/0/
- os_name: windows
platform: windows-latest
briefcase-data-dir: ~\AppData\Local\BeeWare\briefcase\Cache
pip-cache-dir: ~\AppData\Local\pip\Cache
docker-cache-dir: C:\ProgramData\DockerDesktop
- os_name: linux
# Need to use at least 22.04 to get the bugfix in flatpak for handling spaces in filenames.
platform: ubuntu-22.04
briefcase-data-dir: ~/.cache/briefcase
pip-cache-dir: ~/.cache/pip
# cache action cannot cache docker images (actions/cache#31)
# docker-cache-dir: /var/lib/docker
runs-on: ${{ matrix.platform }}
steps:
- name: Cache Briefcase tools
uses: actions/cache@v3.0.10
with:
key: briefcase-${{ matrix.platform }}
path: |
~/.cookiecutters
${{ matrix.briefcase-data-dir }}
${{ matrix.pip-cache-dir }}
${{ matrix.docker-cache-dir }}
- uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4.2.0
with:
python-version: ${{ env.python_version }}
- name: Install system dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get install -y flatpak flatpak-builder
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade setuptools
pip install setuptools_scm
pip install .
- name: Create App
run: |
cd tests/apps
cat verify-${{ matrix.framework }}.config | briefcase new
- name: Build App
run: |
cd tests/apps/verify-${{ matrix.framework }}
briefcase create
briefcase build
briefcase package --adhoc-sign
- name: Build Xcode project
if: matrix.os_name == 'macOS'
run: |
cd tests/apps/verify-${{ matrix.framework }}
briefcase create ${{ matrix.os_name }} Xcode
briefcase build ${{ matrix.os_name }} Xcode
briefcase package ${{ matrix.os_name }} Xcode --adhoc-sign
- name: Build Visual Studio project
if: matrix.os_name == 'windows'
run: |
cd tests/apps/verify-${{ matrix.framework }}
briefcase create ${{ matrix.os_name }} VisualStudio
briefcase build ${{ matrix.os_name }} VisualStudio
briefcase package ${{ matrix.os_name }} VisualStudio --adhoc-sign
- name: Build Flatpak project
if: matrix.os_name == 'linux' && matrix.framework == 'toga'
run: |
cd tests/apps/verify-${{ matrix.framework }}
briefcase create ${{ matrix.os_name }} flatpak
briefcase build ${{ matrix.os_name }} flatpak
briefcase package ${{ matrix.os_name }} flatpak --adhoc-sign
- name: Build Android App
if: matrix.framework == 'toga'
run: |
cd tests/apps/verify-${{ matrix.framework }}
briefcase create android
briefcase build android
briefcase package android --adhoc-sign
- name: Build iOS App
if: matrix.platform == 'macos-12' && matrix.framework == 'toga'
run: |
cd tests/apps/verify-${{ matrix.framework }}
briefcase create iOS
briefcase build iOS -d "iPhone SE (2nd generation)"
briefcase package iOS --adhoc-sign