Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

ci(android): let skip-android-update skip the version bump too (#8600)

Peter Chinman11ad90efe865
diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.yml
index 01c6fe5708..2512e552c2 100644
--- a/.github/workflows/web-app-check-main.yml
+++ b/.github/workflows/web-app-check-main.yml
@@ -76,19 +76,8 @@ jobs:
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version: '1.3.13'
- - id: android-version
- name: Require an Android version bump for native changes
- run: |
- set -euo pipefail
- base=$(git cat-file -p HEAD | sed -n 's/^parent //p' | head -1)
- echo "Comparing the merge result with its base ${base:0:10}"
- git fetch -q --depth=1 origin "$base"
- bun scripts/android-version-check.mjs "$base"
- shell: bash
- working-directory: apps/web
- id: labels
name: Read the PR's current labels
- if: steps.android-version.outputs.changed == 'true'
run: |
set -euo pipefail
labels=$(gh pr view "$PR_NUMBER" --repo "$GH_REPO" --json labels --jq '[.labels[].name] | join(",")')
@@ -103,6 +92,17 @@ jobs:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
+ - id: android-version
+ name: Require an Android version bump for native changes
+ if: steps.labels.outputs.skip != 'true'
+ run: |
+ set -euo pipefail
+ base=$(git cat-file -p HEAD | sed -n 's/^parent //p' | head -1)
+ echo "Comparing the merge result with its base ${base:0:10}"
+ git fetch -q --depth=1 origin "$base"
+ bun scripts/android-version-check.mjs "$base"
+ shell: bash
+ working-directory: apps/web
- id: auth
name: Authenticate to Google Play
if: steps.android-version.outputs.changed == 'true' && steps.labels.outputs.skip != 'true'
@@ -175,8 +175,8 @@ jobs:
GOOGLE_PLAY_ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}
working-directory: apps/web
- name: Skipped via label
- if: steps.android-version.outputs.changed == 'true' && steps.labels.outputs.skip == 'true'
- run: echo "Android native changes detected, but the skip-android-update label says they don't break the native/web contract — skipping the Play release gate."
+ if: steps.labels.outputs.skip == 'true'
+ run: echo "The skip-android-update label says this PR's Android native changes don't break the native/web contract — skipping the version bump and Play release gate."
typescript:
needs:
- path-check
diff --git a/docs/development/android.md b/docs/development/android.md
index 0457fced3c..3557c3d4e4 100644
--- a/docs/development/android.md
+++ b/docs/development/android.md
@@ -137,16 +137,20 @@ job of the web app PR checks enforce it:
**`Android Native Check`** runs on every PR against `main`. Its native tree
excludes platform-specific desktop/iOS files and Markdown docs, which do not
-ship in the Android binary. It always requires a `versionCode` bump when the
-Android native code changed (see
-"Native release identity" above for what counts), and, when it changed, asks
-Google Play whether that version code is a production release that Google
-has **published** (through review and available to users — the edit API's
-`status: completed` only describes the rollout, so the gate also reads the
-release list's `releaseLifecycleState`), built from the native code of the
-PR's merge result. Until both hold the check fails and the required
-`Web App Status Check` fails with it. Add **`skip-android-update`** for
-native changes that don't break the native/web contract; the `Native Check
+ship in the Android binary (`apps/web/scripts/android-native.mjs` defines
+what counts). When the Android native code changed, it requires a
+`versionCode` bump and asks Google Play whether that version code is a
+production release that Google has **published** (through review and
+available to users — the edit API's `status: completed` only describes the
+rollout, so the gate also reads the release list's `releaseLifecycleState`),
+built from the native code of the PR's merge result. Until both hold the
+check fails and the required `Web App Status Check` fails with it.
+
+Add **`skip-android-update`** instead for native changes that don't break
+the native/web contract: it skips the whole gate, bump included, like
+`skip-ios-update`. Such a PR never releases, and the bump only feeds the
+Play release, which checks it again before building; the next PR that
+releases bumps against whatever `main` has by then. The `Native Check
Label` workflow re-runs just the gate job when that label is added or
removed.
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/android_native_check.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/android_native_check.rs
index e433d3c8b1..4054e53e85 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/android_native_check.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/android_native_check.rs
@@ -8,7 +8,7 @@
//! which shares its definition of "native code" with the release
//! workflow through `android-native.mjs`: every tracked file under
//! `apps/web/tauri` minus iOS/desktop-only paths, plus the client cache
-//! wasm version). This part always runs.
+//! wasm version).
//! 2. When it changed, asks Google Play whether that version code is a
//! published production release (through review and rolled out) built
//! from the native code of the PR's current merge result (the provenance
@@ -20,9 +20,12 @@
//!
//! Play access is keyless (Workload Identity Federation), so the job needs
//! `id-token: write`; fork PRs don't get that and fail closed at the auth
-//! step. The `skip-android-update` label bypasses the live check for native
-//! changes that don't break the native/web contract; labels are read at run
-//! time (a re-run keeps the original event payload). The job name must stay
+//! step. The `skip-android-update` label bypasses the whole gate, bump
+//! included, for native changes that don't break the native/web contract,
+//! like `skip-ios-update`: the bump only feeds the Play release, which
+//! re-checks it before building, and a PR that skips the gate never
+//! releases. Labels are read at run time (a re-run keeps the original event
+//! payload). The job name must stay
//! stable: the release preconditions, the watcher and the label workflow
//! find it by name.
@@ -49,8 +52,8 @@ pub(super) fn job() -> Job {
)
.add_step(super::checkout("Checkout PR merge commit", false))
.add_step(setup_bun())
- .add_step(version_check())
.add_step(read_labels())
+ .add_step(version_check())
.add_step(play_auth())
.add_step(require_live())
.add_step(skip_notice())
@@ -70,8 +73,9 @@ fn setup_bun() -> Step<Use> {
.add_with(("bun-version", "1.3.13"))
}
-/// Always runs: the version code must exceed the base whenever the Android
-/// native code changed. Outputs `changed` and `version_code`.
+/// Unless the label skips the gate, the version code must exceed the base
+/// whenever the Android native code changed. Outputs `changed` and
+/// `version_code`.
///
/// The base is the merge commit's first parent — the main the merge result
/// was actually built on — not the event payload's `base.sha`: GitHub can
@@ -88,6 +92,7 @@ fn version_check() -> Step<Run> {
bun scripts/android-version-check.mjs "$base"
"#})
.id("android-version")
+ .if_condition(Expression::new(NOT_SKIPPED))
.shell("bash")
.working_directory(xtask_paths::repo_dir!("apps/web"))
}
@@ -105,7 +110,6 @@ fn read_labels() -> Step<Run> {
fi
"#})
.id("labels")
- .if_condition(Expression::new(NATIVE_CHANGED))
.shell("bash")
.add_env(("GH_TOKEN", "${{ github.token }}"))
.add_env(("GH_REPO", "${{ github.repository }}"))
@@ -172,8 +176,8 @@ bun scripts/android-play-status.mjs --version-code "$VERSION_CODE" --require-liv
fn skip_notice() -> Step<Run> {
Step::new("Skipped via label")
.run(
- "echo \"Android native changes detected, but the skip-android-update label says they \
- don't break the native/web contract — skipping the Play release gate.\"",
+ "echo \"The skip-android-update label says this PR's Android native changes don't \
+ break the native/web contract — skipping the version bump and Play release gate.\"",
)
- .if_condition(Expression::new(format!("{NATIVE_CHANGED} && {SKIP_LABEL}")))
+ .if_condition(Expression::new(SKIP_LABEL))
}
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs
index 5524dbd6a4..d139919c2c 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs
@@ -20,6 +20,28 @@ fn android_native_check_is_an_unconditional_required_merge_check() {
assert!(android.contains("bun scripts/android-version-check.mjs"));
assert!(android.contains("bun scripts/android-play-status.mjs --version-code"));
assert!(android.contains("id-token: write"));
+ // skip-android-update bypasses the bump too, like skip-ios-update: the
+ // labels are read first, and the version check only runs without it.
+ let labels = android.find("id: labels").expect("labels step");
+ let version = android
+ .find("id: android-version")
+ .expect("version check step");
+ assert!(
+ labels < version,
+ "labels must be read before the version check: {android}"
+ );
+ let version_step = android[version..]
+ .split("\n - ")
+ .next()
+ .expect("version check step body");
+ assert!(
+ version_step.contains("if: steps.labels.outputs.skip != 'true'"),
+ "the version check runs only without the skip label: {android}"
+ );
+ assert!(
+ !android.contains("!steps.labels"),
+ "never negate a comparison with a leading `!`: {android}"
+ );
let status = yaml
.split("\n status-check:\n")
.nth(1)