create-disposabl-app 0.14.3 → 0.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/disposabl.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/default/.github/scripts/android-runner.sh +15 -0
- package/dist/templates/default/.github/scripts/disposabl.mjs +0 -5
- package/dist/templates/default/.github/scripts/mobile.sh +1 -2
- package/dist/templates/default/.github/workflows/pipeline.yml +2 -2
- package/dist/templates/default/apps/mobile/README.md +23 -16
- package/dist/templates/default/apps/mobile/package.json +0 -1
- package/dist/templates/default/bun.lock +0 -3
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +4 -0
- package/dist/templates/default/packages/skill/references/iphone-preview.md +52 -101
- package/dist/templates/default/packages/tests/android-failure-workflow.test.ts +6 -3
- package/dist/templates/default/packages/tests/android-runner.test.ts +56 -0
- package/dist/templates/default/packages/tests/release-report.test.ts +98 -0
- package/package.json +1 -1
package/dist/disposabl.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
8
8
|
import { Command, CommanderError } from "commander";
|
|
9
9
|
import * as p2 from "@clack/prompts";
|
|
10
10
|
// package.json
|
|
11
|
-
var version = "0.14.
|
|
11
|
+
var version = "0.14.5";
|
|
12
12
|
|
|
13
13
|
// ../disposabl-kit/platforms.ts
|
|
14
14
|
var platforms = [
|
|
@@ -23,5 +23,20 @@ case "${1:?operation required}" in
|
|
|
23
23
|
exit 1
|
|
24
24
|
fi
|
|
25
25
|
;;
|
|
26
|
+
build)
|
|
27
|
+
# Keep aggregate CPU/memory samples in the job log, including interrupted builds.
|
|
28
|
+
# Do not print process arguments or environment values, which can contain secrets.
|
|
29
|
+
sampler=""
|
|
30
|
+
trap 'if [[ -n "$sampler" ]]; then kill "$sampler" 2>/dev/null || true; wait "$sampler" 2>/dev/null || true; fi' EXIT
|
|
31
|
+
if [[ "${RUNNER_OS:-}" == Linux ]] && command -v vmstat >/dev/null; then
|
|
32
|
+
printf 'Android runner processors: %s\n' "$(getconf _NPROCESSORS_ONLN)"
|
|
33
|
+
vmstat -w -t 15 &
|
|
34
|
+
sampler=$!
|
|
35
|
+
fi
|
|
36
|
+
TIMEFORMAT='Gradle elapsed: %3R seconds; shell and child CPU: %3U user, %3S system'
|
|
37
|
+
status=0
|
|
38
|
+
time ./gradlew :app:assembleRelease --no-daemon --build-cache || status=$?
|
|
39
|
+
exit "$status"
|
|
40
|
+
;;
|
|
26
41
|
*) echo "Unknown operation: $1" >&2; exit 1 ;;
|
|
27
42
|
esac
|
|
@@ -101,11 +101,6 @@ if (config.appId) {
|
|
|
101
101
|
if (!response.ok)
|
|
102
102
|
throw new Error(`Cannot inspect release (${response.status}).`);
|
|
103
103
|
const release = await response.json();
|
|
104
|
-
const updateOnly = /"action"\s*:\s*"update"/.test(release.body ?? "");
|
|
105
|
-
if (updateOnly) {
|
|
106
|
-
await call("/github/report", { platform, status: "ready" });
|
|
107
|
-
process.exit(0);
|
|
108
|
-
}
|
|
109
104
|
const suffix = {
|
|
110
105
|
android: ".apk",
|
|
111
106
|
ios: ".ipa",
|
|
@@ -123,12 +123,11 @@ if [[ "$CHANNEL" == production ]]; then
|
|
|
123
123
|
fi
|
|
124
124
|
bun x --no-install expo prebuild --platform android --no-install
|
|
125
125
|
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
126
|
-
task=assembleRelease
|
|
127
126
|
artifact=android.apk
|
|
128
127
|
binary=android/app/build/outputs/apk/release/app-release.apk
|
|
129
128
|
fingerprint=assets/fingerprint
|
|
130
129
|
|
|
131
|
-
(cd android &&
|
|
130
|
+
(cd android && bash ../../../.github/scripts/android-runner.sh build)
|
|
132
131
|
test "$(unzip -p "$binary" "$fingerprint")" = "$RUNTIME"
|
|
133
132
|
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
134
133
|
mkdir -p ../../dist/release
|
|
@@ -230,7 +230,7 @@ jobs:
|
|
|
230
230
|
android-failure:
|
|
231
231
|
name: Report Android failure
|
|
232
232
|
needs: android
|
|
233
|
-
if:
|
|
233
|
+
if: always() && (needs.android.result == 'failure' || needs.android.result == 'cancelled')
|
|
234
234
|
permissions:
|
|
235
235
|
contents: read
|
|
236
236
|
id-token: write
|
|
@@ -239,7 +239,7 @@ jobs:
|
|
|
239
239
|
steps:
|
|
240
240
|
- *checkout
|
|
241
241
|
- *node
|
|
242
|
-
- run: node .github/scripts/disposabl.mjs report android failed
|
|
242
|
+
- run: node .github/scripts/disposabl.mjs report android failed "Android build failed or was cancelled; check the workflow log."
|
|
243
243
|
ios-preview:
|
|
244
244
|
name: iOS simulator preview
|
|
245
245
|
needs: [changes, web]
|
|
@@ -66,10 +66,11 @@ compatible changes.
|
|
|
66
66
|
Select `android` in the root `disposabl.json`. When mobile or shared dependencies
|
|
67
67
|
change, CI computes the Expo fingerprint in the Web job after web/backend
|
|
68
68
|
deployment, reusing its runner and dependency install. The first run builds an
|
|
69
|
-
installable APK in a separate
|
|
70
|
-
publish EAS Update from Web. Native jobs install
|
|
71
|
-
the
|
|
72
|
-
|
|
69
|
+
installable APK in a separate Android job on the selected Linux runner. Later
|
|
70
|
+
runs with the same fingerprint publish EAS Update from Web. Native jobs install
|
|
71
|
+
the workspace dependencies using the shared Bun cache; Android also restores
|
|
72
|
+
Gradle caches. Native jobs start after Web. Desktop builds run only on main.
|
|
73
|
+
Platform jobs have a 20-minute timeout; this is a limit, not a build-time guarantee.
|
|
73
74
|
Production iOS checks the latest finished EAS store build for the same app and
|
|
74
75
|
channel. If its fingerprint matches, CI publishes an iOS OTA update and skips
|
|
75
76
|
the native build. A missing or incompatible binary requires a new EAS build.
|
|
@@ -138,8 +139,9 @@ The backend deployment supplies the same URLs to web and mobile:
|
|
|
138
139
|
`CONVEX_URL` is the client API origin and `CONVEX_SITE_URL` is the HTTP/auth origin.
|
|
139
140
|
CI exports this pair once, generating the `VITE_` and `EXPO_PUBLIC_` aliases
|
|
140
141
|
for web builds, mobile fingerprinting, APK builds and EAS Update exports.
|
|
141
|
-
Turbo includes the web aliases in build cache keys.
|
|
142
|
-
|
|
142
|
+
Turbo includes the web aliases in build cache keys. Every saved EAS backend URL,
|
|
143
|
+
including its VITE_ and EXPO_PUBLIC_ aliases, must match the deployed URLs;
|
|
144
|
+
conflicting values fail the build. Each PR uses its own deployed backend.
|
|
143
145
|
EAS variables with secret visibility are not available to this local build or
|
|
144
146
|
update flow; native secrets must be supplied through GitHub Actions.
|
|
145
147
|
|
|
@@ -153,8 +155,10 @@ DISPOSABL_MOBILE_CHANNEL=development bunx expo run:android --variant release
|
|
|
153
155
|
|
|
154
156
|
This is a release-mode build with its JavaScript bundled, so it runs without
|
|
155
157
|
Metro. Preview APKs use Expo's public debug signing key and a separate application
|
|
156
|
-
ID.
|
|
157
|
-
|
|
158
|
+
ID. The workflow configures dependency caches and invokes
|
|
159
|
+
[mobile.sh](../../.github/scripts/mobile.sh) for prebuild, Gradle compilation and
|
|
160
|
+
embedded fingerprint checks. [android-runner.sh](../../.github/scripts/android-runner.sh)
|
|
161
|
+
prepares disposable hosted-runner disk space and checks capacity before prebuild.
|
|
158
162
|
|
|
159
163
|
## Production
|
|
160
164
|
|
|
@@ -170,14 +174,17 @@ removes it after building. The version code comes from the workflow run number;
|
|
|
170
174
|
preserve increasing numbers if moving this workflow to another repository.
|
|
171
175
|
An OTA update does not require the signing key because it does not build an APK.
|
|
172
176
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
Web stages the Android APK after an OTA update; the Android job stages it after
|
|
178
|
+
a native build. Both upload intermediate `release-android` Actions artifacts.
|
|
179
|
+
The separate publisher waits for the selected build jobs, downloads verified
|
|
180
|
+
artifacts and publishes GitHub prereleases for previews or releases for production.
|
|
181
|
+
An exhausted Actions artifact quota can therefore block delivery after compilation.
|
|
182
|
+
Each PR reuses its Android release, normally `app-pr-N-android`, replacing the
|
|
183
|
+
APK/metadata and moving the tag to the tested commit. Only a published APK with
|
|
184
|
+
matching metadata and digest is reusable. The publisher executes scripts from
|
|
185
|
+
main with `contents: write`; fork PRs never deploy or publish. Android submission
|
|
186
|
+
to Google Play is not implemented. iOS production uses the separate EAS Build
|
|
187
|
+
and TestFlight flow described above; App Store release remains separate.
|
|
181
188
|
|
|
182
189
|
Backend URLs are available to mobile code through
|
|
183
190
|
`process.env.EXPO_PUBLIC_CONVEX_URL` and
|
|
@@ -94,7 +94,6 @@
|
|
|
94
94
|
"react": "19.3.0",
|
|
95
95
|
"react-native": "0.88.1",
|
|
96
96
|
"react-native-css": "3.1.0-rc.1",
|
|
97
|
-
"react-native-enriched-markdown": "^1.1.1",
|
|
98
97
|
"react-native-gesture-handler": "~3.3.0",
|
|
99
98
|
"react-native-purchases": "10.16.0",
|
|
100
99
|
"react-native-reanimated": "4.7.1",
|
|
@@ -3200,8 +3199,6 @@
|
|
|
3200
3199
|
|
|
3201
3200
|
"react-native-drawer-layout": ["react-native-drawer-layout@4.2.12", "", { "dependencies": { "color": "^4.2.3", "use-latest-callback": "^0.2.4" }, "peerDependencies": { "react": ">= 18.2.0", "react-native": "*", "react-native-gesture-handler": ">= 2.0.0", "react-native-reanimated": ">= 2.0.0" } }, "sha512-qYmntEctkMSodN7pnC2llV21nswImLFPHJeT3PJXSJqZdU4jzDATR8iVi66sXkrtoOLJ2+EvXxgd7sMMpV4ViA=="],
|
|
3202
3201
|
|
|
3203
|
-
"react-native-enriched-markdown": ["react-native-enriched-markdown@1.1.1", "", { "peerDependencies": { "katex": ">=0.16.0", "react": "*", "react-native": "*" }, "optionalPeers": ["katex"], "hasInstallScript": true }, "sha512-JvbRIVy75MAoGCv8V6sSscu11/Ian588wfIgH+j64XFpf6gy5sNNkMyG087MH88jNCf3p7fTjgEAGxZMhEqL4A=="],
|
|
3204
|
-
|
|
3205
3202
|
"react-native-gesture-handler": ["react-native-gesture-handler@3.3.0", "", { "dependencies": { "@types/react-test-renderer": "^19.1.0", "invariant": "^2.2.4" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-ZCTlJ09nE3GPbm7J74lvwpxmx1TQ/7MDlHZNLARVYTN82k21mJUJ7BmI9eWjEi8eevHiAudI5O1Cpnt0rJfoJA=="],
|
|
3206
3203
|
|
|
3207
3204
|
"react-native-is-edge-to-edge": ["react-native-is-edge-to-edge@1.3.1", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-NIXU/iT5+ORyCc7p0z2nnlkouYKX425vuU1OEm6bMMtWWR9yvb+Xg5AZmImTKoF9abxCPqrKC3rOZsKzUYgYZA=="],
|
|
@@ -92,10 +92,12 @@ function Routes({ isAuthenticated = false }: { isAuthenticated?: boolean }) {
|
|
|
92
92
|
|
|
93
93
|
export function AuthLayout() {
|
|
94
94
|
const colors = useTheme();
|
|
95
|
+
const dark = useResolvedColorScheme() === "dark";
|
|
95
96
|
if (!authenticationEnabled) return <Redirect href="/" />;
|
|
96
97
|
return (
|
|
97
98
|
<Stack
|
|
98
99
|
screenOptions={{
|
|
100
|
+
statusBarStyle: dark ? "light" : "dark",
|
|
99
101
|
headerTintColor: colors.foreground,
|
|
100
102
|
headerStyle: { backgroundColor: colors.background },
|
|
101
103
|
contentStyle: { backgroundColor: colors.background },
|
|
@@ -155,9 +157,11 @@ function SessionLayout() {
|
|
|
155
157
|
|
|
156
158
|
function AccountRoutes() {
|
|
157
159
|
const colors = useTheme();
|
|
160
|
+
const dark = useResolvedColorScheme() === "dark";
|
|
158
161
|
return (
|
|
159
162
|
<Stack
|
|
160
163
|
screenOptions={{
|
|
164
|
+
statusBarStyle: dark ? "light" : "dark",
|
|
161
165
|
headerTintColor: colors.foreground,
|
|
162
166
|
headerStyle: { backgroundColor: colors.background },
|
|
163
167
|
contentStyle: { backgroundColor: colors.background },
|
|
@@ -1,84 +1,43 @@
|
|
|
1
|
-
# Test
|
|
2
|
-
|
|
3
|
-
Use this
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
the
|
|
18
|
-
the
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
2.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
identity from this Mac. Xcode manages these under its signing settings; recent
|
|
38
|
-
versions store profiles under `~/Library/Developer/Xcode/UserData/Provisioning Profiles`,
|
|
39
|
-
older versions under `~/Library/MobileDevice/Provisioning Profiles`.
|
|
40
|
-
Inspect metadata with `security cms -D -i <profile>` without dumping it into
|
|
41
|
-
chat. Confirm the exact bundle ID, phone UDID, allowed capabilities and expiry.
|
|
42
|
-
List available identity fingerprints with `security find-identity -v -p codesigning`.
|
|
43
|
-
|
|
44
|
-
If there is no matching profile, explain that Xcode can provision it using a tiny
|
|
45
|
-
local iOS project. Create that project outside the generated app, with the exact
|
|
46
|
-
preview bundle ID, required capabilities, automatic signing, and the user's
|
|
47
|
-
Personal Team. Build only that project for the connected phone:
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
xcodebuild -project Provisioning.xcodeproj -scheme Provisioning \
|
|
51
|
-
-configuration Debug -destination 'id=IPHONE_UDID' \
|
|
52
|
-
-derivedDataPath ./provisioning-build \
|
|
53
|
-
-allowProvisioningUpdates -allowProvisioningDeviceRegistration build
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
This compiles the tiny provisioning project, not the React Native app. Do not
|
|
57
|
-
install the placeholder. Inspect the generated profile for the exact app ID,
|
|
58
|
-
phone, certificate, capabilities and expiry before signing the downloaded IPA.
|
|
59
|
-
This route was verified with Xcode 27.2 and a free Personal Team; account prompts
|
|
60
|
-
and unsupported capabilities can still require user action. The signing helper
|
|
61
|
-
does not create this project or renew profiles automatically.
|
|
62
|
-
|
|
63
|
-
Do not upload Apple passwords, private keys, signing certificates or personal
|
|
64
|
-
profiles to GitHub. The unsigned build does not need them. Some capabilities are
|
|
65
|
-
unavailable to free teams; surface that limitation rather than silently removing
|
|
66
|
-
features. Extensions and Watch apps need separate profiles and are not supported
|
|
67
|
-
by this single-app signing helper.
|
|
68
|
-
|
|
69
|
-
## Download, sign and install
|
|
70
|
-
|
|
71
|
-
The workflow builds unsigned iPhone IPAs for PR previews and main.
|
|
72
|
-
Download the `ios-native-<channel>` artifact from the exact successful GitHub run.
|
|
73
|
-
It contains `ios-unsigned.ipa`, this guide, the signing helper, and verified build
|
|
74
|
-
metadata. Check the SHA/run and artifact digest before executing downloaded code.
|
|
75
|
-
The IPA is not directly installable until it has been signed.
|
|
76
|
-
|
|
77
|
-
Run the included helper on the owner's Mac, substituting inspected values:
|
|
1
|
+
# Test on a physical iPhone
|
|
2
|
+
|
|
3
|
+
Use this guide when the user requests a physical iPhone build. Check the current
|
|
4
|
+
workflow before promising an artifact: the starter's iOS preview job produces
|
|
5
|
+
`ios-simulator.zip`, containing a simulator `.app`. It cannot run on an iPhone
|
|
6
|
+
and cannot be converted into a device build by signing it. Production uses EAS
|
|
7
|
+
Build and TestFlight when configured. The starter does not produce unsigned
|
|
8
|
+
physical-device IPAs. If iOS builds are disabled, neither CI path runs.
|
|
9
|
+
|
|
10
|
+
## Build and provision with Xcode
|
|
11
|
+
|
|
12
|
+
Prefer the app's native Xcode project for local device testing. Check for full
|
|
13
|
+
Xcode with `xcodebuild -version`, install the app's dependencies, and generate its
|
|
14
|
+
native project with Expo prebuild if needed. Prebuild generates files; it does
|
|
15
|
+
not compile or install the app. Use the project's configured backend and channel.
|
|
16
|
+
|
|
17
|
+
Open the generated workspace on the owner's Mac. In Xcode, select the connected
|
|
18
|
+
iPhone and the correct Apple team, enable automatic signing, and resolve the
|
|
19
|
+
capability or provisioning issues Xcode reports. Let the user complete Apple
|
|
20
|
+
Account, Trust and Developer Mode prompts when required. A simulator identifier
|
|
21
|
+
is not a physical phone's provisioning UDID.
|
|
22
|
+
|
|
23
|
+
A free Personal Team uses Xcode's connected-device provisioning. Expo device
|
|
24
|
+
registration and ad hoc distribution require a paid Apple Developer membership.
|
|
25
|
+
For an explicitly requested Expo ad hoc build, use the URL returned by
|
|
26
|
+
`bunx eas-cli@27.2.0 device:create`, then obtain a matching profile and build.
|
|
27
|
+
Registration alone does not make an app installable. Surface unsupported
|
|
28
|
+
capabilities rather than silently removing them.
|
|
29
|
+
|
|
30
|
+
## When an unsigned device IPA is already available
|
|
31
|
+
|
|
32
|
+
Use the signing helper only with an actual iPhone IPA from a verified source
|
|
33
|
+
revision. Do not invent a workflow artifact name or substitute a simulator build.
|
|
34
|
+
Inspect `Payload/<app>.app/Info.plist` for the exact bundle ID and confirm the
|
|
35
|
+
local development profile matches that ID, phone, signing identity, capabilities
|
|
36
|
+
and expiry. Xcode must provision the profile first; the helper does not create it.
|
|
78
37
|
|
|
79
38
|
```sh
|
|
80
|
-
python3 sign-iphone.py \
|
|
81
|
-
--ipa
|
|
39
|
+
python3 packages/skill/scripts/sign-iphone.py \
|
|
40
|
+
--ipa /absolute/path/to/device.ipa \
|
|
82
41
|
--profile /absolute/path/to/profile.mobileprovision \
|
|
83
42
|
--identity CERTIFICATE_SHA1 \
|
|
84
43
|
--device IPHONE_PROVISIONING_UDID \
|
|
@@ -86,29 +45,21 @@ python3 sign-iphone.py \
|
|
|
86
45
|
--install
|
|
87
46
|
```
|
|
88
47
|
|
|
89
|
-
|
|
90
|
-
`
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
An existing output directory is preserved; use a new path on each run.
|
|
48
|
+
The helper signs frameworks and the app, verifies the signature, and can install
|
|
49
|
+
with Xcode's `devicectl`. It preserves existing output directories, so choose a
|
|
50
|
+
new output path. Extensions and Watch apps require separate profiles and are
|
|
51
|
+
outside this helper's scope. Keep Apple passwords, private keys and personal
|
|
52
|
+
profiles off GitHub and out of logs.
|
|
95
53
|
|
|
96
|
-
|
|
97
|
-
reinstall the same compatible downloaded binary; changing a native dependency
|
|
98
|
-
requires a new GitHub build. Apple limits free accounts to three installed apps
|
|
99
|
-
per device and limits App IDs/devices as documented below.
|
|
54
|
+
## Verify the installed app
|
|
100
55
|
|
|
101
|
-
Use the session's supported device tools
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
Xcode sees the physical phone. Respect the host's control restrictions; after a
|
|
108
|
-
permitted installation, ask the user to open and test the app if physical-device
|
|
109
|
-
UI automation is unavailable. Report that as user verification, not automation.
|
|
56
|
+
Use the session's supported device tools and keep the phone under one owner.
|
|
57
|
+
Launch the app, exercise the requested feature, verify its backend and login,
|
|
58
|
+
then relaunch and check saved state. Installation alone is not delivery. If the
|
|
59
|
+
phone cannot be automated, ask the user to verify it and distinguish that evidence
|
|
60
|
+
from automated checks. Follow tool retry limits instead of switching to an
|
|
61
|
+
unsupported control path. Renew expired profiles through Xcode when necessary.
|
|
110
62
|
|
|
111
|
-
References: [Apple
|
|
63
|
+
References: [Apple account capabilities and limits](https://developer.apple.com/help/account/basics/about-your-developer-account/),
|
|
112
64
|
[run on a device](https://help.apple.com/xcode/mac/current/en.lproj/dev5a825a1ca.html),
|
|
113
|
-
[
|
|
114
|
-
[Expo device registration](https://docs.expo.dev/build/internal-distribution/).
|
|
65
|
+
[Expo internal distribution](https://docs.expo.dev/build/internal-distribution/).
|
|
@@ -20,10 +20,13 @@ const workflow = JSON.parse(
|
|
|
20
20
|
),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
test("Android failure reporting
|
|
23
|
+
test("Android failure reporting handles failed and cancelled builds independently", () => {
|
|
24
24
|
const job = workflow.jobs["android-failure"];
|
|
25
25
|
assert.equal(job.needs, "android");
|
|
26
|
-
assert.equal(
|
|
26
|
+
assert.equal(
|
|
27
|
+
job.if,
|
|
28
|
+
"always() && (needs.android.result == 'failure' || needs.android.result == 'cancelled')",
|
|
29
|
+
);
|
|
27
30
|
assert.deepEqual(job.permissions, { contents: "read", "id-token": "write" });
|
|
28
31
|
assert.equal(job["runs-on"], "ubuntu-24.04");
|
|
29
32
|
assert.equal(job["timeout-minutes"], 5);
|
|
@@ -31,7 +34,7 @@ test("Android failure reporting runs independently only for an Android failure",
|
|
|
31
34
|
assert.equal(job.steps[1].uses, "actions/setup-node@v6");
|
|
32
35
|
assert.equal(
|
|
33
36
|
job.steps[2].run,
|
|
34
|
-
|
|
37
|
+
'node .github/scripts/disposabl.mjs report android failed "Android build failed or was cancelled; check the workflow log."',
|
|
35
38
|
);
|
|
36
39
|
assert.equal(
|
|
37
40
|
workflow.jobs.android.steps.some((step: { run?: string }) =>
|
|
@@ -5,6 +5,62 @@ import { tmpdir } from "node:os";
|
|
|
5
5
|
import { join, resolve } from "node:path";
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
7
7
|
|
|
8
|
+
test("Android build diagnostics preserve Gradle arguments and failure status", () => {
|
|
9
|
+
const dir = mkdtempSync(join(tmpdir(), "android-build-"));
|
|
10
|
+
try {
|
|
11
|
+
writeFileSync(
|
|
12
|
+
join(dir, "gradlew"),
|
|
13
|
+
'#!/bin/sh\nwhile [ ! -f "$SAMPLER_PID" ]; do sleep 0.01; done\nprintf "%s\\n" "$*"\nexit "$GRADLE_RESULT"\n',
|
|
14
|
+
{ mode: 0o755 },
|
|
15
|
+
);
|
|
16
|
+
writeFileSync(
|
|
17
|
+
join(dir, "vmstat"),
|
|
18
|
+
'#!/bin/sh\necho $$ > "$SAMPLER_PID"\nexec sleep 30\n',
|
|
19
|
+
{
|
|
20
|
+
mode: 0o755,
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
for (const status of [0, 42]) {
|
|
24
|
+
const samplerPid = join(dir, `sampler-${status}`);
|
|
25
|
+
const result = spawnSync(
|
|
26
|
+
"bash",
|
|
27
|
+
[
|
|
28
|
+
resolve(
|
|
29
|
+
import.meta.dirname,
|
|
30
|
+
"../../.github/scripts/android-runner.sh",
|
|
31
|
+
),
|
|
32
|
+
"build",
|
|
33
|
+
],
|
|
34
|
+
{
|
|
35
|
+
cwd: dir,
|
|
36
|
+
encoding: "utf8",
|
|
37
|
+
timeout: 5000,
|
|
38
|
+
env: {
|
|
39
|
+
...process.env,
|
|
40
|
+
PATH: `${dir}:${process.env.PATH}`,
|
|
41
|
+
RUNNER_OS: "Linux",
|
|
42
|
+
GRADLE_RESULT: String(status),
|
|
43
|
+
SAMPLER_PID: samplerPid,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
assert.equal(result.status, status, result.stderr);
|
|
48
|
+
assert.match(
|
|
49
|
+
result.stdout,
|
|
50
|
+
/:app:assembleRelease --no-daemon --build-cache/,
|
|
51
|
+
);
|
|
52
|
+
assert.match(result.stdout, /Android runner processors: \d+/);
|
|
53
|
+
assert.match(result.stderr, /Gradle elapsed:/);
|
|
54
|
+
assert.throws(
|
|
55
|
+
() => process.kill(Number(readFileSync(samplerPid, "utf8")), 0),
|
|
56
|
+
{ code: "ESRCH" },
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
} finally {
|
|
60
|
+
rmSync(dir, { recursive: true, force: true });
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
8
64
|
test("Android disk preparation only removes unused hosted-runner toolchains", () => {
|
|
9
65
|
const dir = mkdtempSync(join(tmpdir(), "android-runner-"));
|
|
10
66
|
try {
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { test } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import {
|
|
4
|
+
copyFileSync,
|
|
5
|
+
mkdirSync,
|
|
6
|
+
mkdtempSync,
|
|
7
|
+
readFileSync,
|
|
8
|
+
rmSync,
|
|
9
|
+
writeFileSync,
|
|
10
|
+
} from "node:fs";
|
|
11
|
+
import { tmpdir } from "node:os";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { spawnSync } from "node:child_process";
|
|
14
|
+
|
|
15
|
+
for (const action of ["build", "update"]) {
|
|
16
|
+
test(`Android ${action} reports the published installer link`, () => {
|
|
17
|
+
const directory = mkdtempSync(join(tmpdir(), "release-report-"));
|
|
18
|
+
try {
|
|
19
|
+
const scripts = join(directory, ".github/scripts");
|
|
20
|
+
mkdirSync(scripts, { recursive: true });
|
|
21
|
+
copyFileSync(
|
|
22
|
+
new URL("../../.github/scripts/disposabl.mjs", import.meta.url),
|
|
23
|
+
join(scripts, "disposabl.mjs"),
|
|
24
|
+
);
|
|
25
|
+
writeFileSync(
|
|
26
|
+
join(directory, "disposabl.json"),
|
|
27
|
+
JSON.stringify({
|
|
28
|
+
appId: "fixture-app",
|
|
29
|
+
serviceOrigin: "https://service.example",
|
|
30
|
+
platforms: ["android"],
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
33
|
+
const releaseUrl =
|
|
34
|
+
"https://github.com/fixture/app/releases/tag/app-pr-1-android";
|
|
35
|
+
const artifactUrl =
|
|
36
|
+
"https://github.com/fixture/app/releases/download/app-pr-1-android/android.apk";
|
|
37
|
+
const loader = join(directory, "fetch.mjs");
|
|
38
|
+
const report = join(directory, "report.json");
|
|
39
|
+
writeFileSync(
|
|
40
|
+
loader,
|
|
41
|
+
`
|
|
42
|
+
import { writeFileSync } from "node:fs";
|
|
43
|
+
globalThis.fetch = async (input, options) => {
|
|
44
|
+
const url = String(input);
|
|
45
|
+
if (url.startsWith("https://identity.example/"))
|
|
46
|
+
return Response.json({value: "fixture-oidc"});
|
|
47
|
+
if (url === "https://api.github.com/repos/fixture/app/releases/tags/app-pr-1-android")
|
|
48
|
+
return Response.json(${JSON.stringify({
|
|
49
|
+
body: `<!-- android ${JSON.stringify({ action })} -->`,
|
|
50
|
+
html_url: releaseUrl,
|
|
51
|
+
assets: [
|
|
52
|
+
{ name: "android.apk", browser_download_url: artifactUrl },
|
|
53
|
+
],
|
|
54
|
+
})});
|
|
55
|
+
if (url === "https://service.example/github/report") {
|
|
56
|
+
writeFileSync(${JSON.stringify(report)}, options.body);
|
|
57
|
+
return Response.json({});
|
|
58
|
+
}
|
|
59
|
+
throw new Error("Unexpected request: " + url);
|
|
60
|
+
};
|
|
61
|
+
`,
|
|
62
|
+
);
|
|
63
|
+
const result = spawnSync(
|
|
64
|
+
"node",
|
|
65
|
+
[
|
|
66
|
+
"--import",
|
|
67
|
+
loader,
|
|
68
|
+
join(scripts, "disposabl.mjs"),
|
|
69
|
+
"release",
|
|
70
|
+
"android",
|
|
71
|
+
"app-pr-1-android",
|
|
72
|
+
],
|
|
73
|
+
{
|
|
74
|
+
encoding: "utf8",
|
|
75
|
+
env: {
|
|
76
|
+
...process.env,
|
|
77
|
+
ACTIONS_ID_TOKEN_REQUEST_URL: "https://identity.example/token",
|
|
78
|
+
ACTIONS_ID_TOKEN_REQUEST_TOKEN: "fixture-token",
|
|
79
|
+
GH_REPO: "fixture/app",
|
|
80
|
+
GH_TOKEN: "fixture-token",
|
|
81
|
+
DISPOSABL_RELEASE_VERSION: "1.0.42",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
assert.equal(result.status, 0, result.stderr);
|
|
86
|
+
assert.deepEqual(JSON.parse(readFileSync(report, "utf8")), {
|
|
87
|
+
appId: "fixture-app",
|
|
88
|
+
platform: "android",
|
|
89
|
+
status: "ready",
|
|
90
|
+
version: "1.0.42",
|
|
91
|
+
githubReleaseUrl: releaseUrl,
|
|
92
|
+
artifactUrl,
|
|
93
|
+
});
|
|
94
|
+
} finally {
|
|
95
|
+
rmSync(directory, { recursive: true, force: true });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|