Repository navigation
279 lines (244 loc) · 10.5 KB
/
Copy pathdesktop.yml
File metadata and controls
279 lines (244 loc) · 10.5 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Desktop CI
on:
# Runs only as part of ci.yml, which is started by hand (owner, 2026-11-14: "개발 테스트 ci는
# 명시적으로 실행하기"). ci.yml holds the one concurrency group for the repository.
workflow_call:
jobs:
test:
name: Desktop Tests
# macOS runner is used to compile for iOS and is also good for Desktop.
# We use ubuntu, macos, and windows to cover the major desktop platforms.
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
# This automatically caches ~/.gradle/caches and ~/.gradle/wrapper
cache: 'gradle'
- name: Cache Konan
uses: actions/cache@v4
with:
# Cache Kotlin Native compiler and dependencies
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-konan-
# The dev agent's protocol (SPEC L-12, #233): stdlib-only, so the runner's own python3 runs it.
- name: Dev agent protocol tests
working-directory: python-multiplatform/src/test/python
run: python3 -m unittest -v test_devagent
- name: Run Desktop Tests
# Using --console=plain so logs are readable in GitHub Actions
run: ./gradlew :python-multiplatform:desktopTest --console=plain
plugin-unit:
# The Gradle plugin's own unit tests (#403). Only its fixtures ran in CI before, so plugin
# unit tests were never executed (leader decision 2026-11-13). Linux: the tests use fake
# trees and need no Xcode or simulator.
name: Gradle plugin unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
cache: 'gradle'
- name: Run the plugin's unit tests
# --rerun: never read an earlier result as this run's (AGENTS.md rule 8).
run: ./gradlew :python-multiplatform-gradle-plugin:test --rerun --console=plain
- name: Count the tests
if: always()
run: |
python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY"
import glob, xml.etree.ElementTree as ET
files = glob.glob("python-multiplatform-gradle-plugin/build/test-results/test/*.xml")
total = failed = skipped = 0
for f in files:
suite = ET.parse(f).getroot()
total += int(suite.get("tests", 0))
failed += int(suite.get("failures", 0)) + int(suite.get("errors", 0))
skipped += int(suite.get("skipped", 0))
print(f"Gradle plugin unit tests: {total} tests, {total - failed - skipped} passed, {failed} failed, {skipped} skipped ({len(files)} suites)")
if not files:
raise SystemExit("no plugin test results were written")
PY
cat "$GITHUB_STEP_SUMMARY"
- name: Upload the test reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: gradle-plugin-unit-reports
path: |
python-multiplatform-gradle-plugin/build/reports/tests/test
python-multiplatform-gradle-plugin/build/test-results/test
desktop-native-linux:
name: Desktop Kotlin/Native Tests (Linux x86_64)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
cache: 'gradle'
- name: Cache Konan
uses: actions/cache@v4
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-konan-
- name: Run Linux x86_64 Kotlin/Native Tests
run: ./gradlew :python-multiplatform:linuxX64Test --rerun --console=plain
# The Compose host's linuxX64 target (#386): compiled here, since only the fork publishes the
# Compose UI klibs for linuxX64.
- name: Compile the Compose host for Linux x86_64 Kotlin/Native
run: ./gradlew :python-multiplatform-compose:compileKotlinLinuxX64 --rerun --console=plain
# The dev agent's protocol on the other desktop OSes (#238). Its socket options differ per platform
# (SO_EXCLUSIVEADDRUSE on Windows, SO_REUSEADDR on POSIX), and the port-takeover and restart tests are
# what check them. Stdlib only: no JDK, no Gradle.
dev-agent:
name: Dev agent protocol (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Dev agent protocol tests
working-directory: python-multiplatform/src/test/python
run: python -m unittest -v test_devagent
# pythonx-compose's UI.ipynb, end to end (#26, #213): the installed pythonx-compose wheel drives a
# real desktop Compose host, pixel-compared with the same composables drawn from Kotlin. Its own
# job and Gradle invocation, so it neither hides nor is hidden by the module tests above.
notebook-e2e:
name: Notebook E2E (pythonx-compose wheel)
runs-on: macos-latest
env:
WHEEL_DIR: ${{ github.workspace }}/.tmp/pythonx-compose-dist
steps:
- name: Checkout
uses: actions/checkout@v4
# Beside this repository, as on a developer machine; the wheel is built from it, not installed
# from PyPI, so the scenarios follow pythonx-compose develop.
- name: Checkout pythonx-compose develop
uses: actions/checkout@v4
with:
repository: thisisthepy/pythonx-compose
ref: develop
path: .tmp/pythonx-compose
fetch-depth: 1
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Build the pythonx-compose wheel
run: |
uv build --wheel --directory .tmp/pythonx-compose --out-dir "$WHEEL_DIR"
ls -l "$WHEEL_DIR"
git -C .tmp/pythonx-compose log -1 --format='pythonx-compose %h %s'
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
cache: 'gradle'
- name: Cache Konan
uses: actions/cache@v4
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-konan-
# No skip property: without a wheel every scenario fails by name, which is what CI wants.
- name: Run the notebook scenarios
run: >
./gradlew :python-multiplatform-compose:fixtures:notebook-e2e:desktopTest --rerun
-PpythonxComposeWheel="$WHEEL_DIR" --console=plain
- name: Count the scenarios
if: always()
run: |
python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY"
import glob, xml.etree.ElementTree as ET
files = glob.glob("python-multiplatform-compose/fixtures/notebook-e2e/build/test-results/desktopTest/*.xml")
total = failed = skipped = 0
for f in files:
suite = ET.parse(f).getroot()
total += int(suite.get("tests", 0))
failed += int(suite.get("failures", 0)) + int(suite.get("errors", 0))
skipped += int(suite.get("skipped", 0))
print(f"Notebook E2E: {total} tests, {total - failed - skipped} passed, {failed} failed, {skipped} skipped ({len(files)} suites)")
PY
cat "$GITHUB_STEP_SUMMARY"
- name: Upload the test reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: notebook-e2e-reports
path: |
python-multiplatform-compose/fixtures/notebook-e2e/build/reports/tests/desktopTest
python-multiplatform-compose/fixtures/notebook-e2e/build/test-results/desktopTest
# The notebook E2E in a GraalVM native image on macOS (#249, #251). It takes the fork's Compose
# (`org.thisisthepy.compose.*:1.11.1-ext.2`, `composeExtended.*` in `gradle.properties`) from
# Maven Central, builds the 20-scenario executable with Liberica NIK 25, and runs it with
# JAVA_HOME and PYTHONHOME removed.
notebook-e2e-native-image:
name: Notebook E2E in a native image (macOS)
runs-on: macos-latest
env:
WHEEL_DIR: ${{ github.workspace }}/.tmp/pythonx-compose-dist
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout pythonx-compose develop
uses: actions/checkout@v4
with:
repository: thisisthepy/pythonx-compose
ref: develop
path: .tmp/pythonx-compose
fetch-depth: 1
- name: Setup uv
uses: astral-sh/setup-uv@v6
- name: Build the pythonx-compose wheel
run: uv build --wheel --directory .tmp/pythonx-compose --out-dir "$WHEEL_DIR"
- name: Setup Java 21 (Gradle)
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
cache: 'gradle'
# The JDK 25 toolchain native-image comes from, found by Gradle's toolchain resolution.
- name: Setup Liberica NIK 25
uses: graalvm/setup-graalvm@v1
with:
java-version: '25'
distribution: 'liberica'
set-java-home: 'false'
github-token: ${{ secrets.GITHUB_TOKEN }}
# Records Compose and skiko's configuration against the fork version this run uses, then builds
# the image and runs it with JAVA_HOME and PYTHONHOME removed: 20 of 20 and no libjvm.
# `setup-graalvm` installs Liberica NIK under `GRAALVM_HOME` in the runner toolcache outside
# `/Users/runner/hostedtoolcache/Java_*`, so pass `org.gradle.java.installations.paths`
# explicitly so Gradle's BellSoft JDK 25 toolchain resolution finds it.
- name: Build and run the native image
run: >
./gradlew :python-multiplatform-compose:fixtures:notebook-e2e:notebookE2eNativeAgent
:python-multiplatform-compose:fixtures:notebook-e2e:notebookE2eNativeRun
-PpythonxComposeWheel="$WHEEL_DIR"
-Porg.gradle.java.installations.paths="$GRAALVM_HOME"
--console=plain