Skip to content

Commit 6cb3b4a

Browse files
authored
Merge branch 'main' into phase5d/workflow-dispatch-tracing
2 parents bb31a23 + b30bd2a commit 6cb3b4a

11 files changed

Lines changed: 265 additions & 95 deletions
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: 'Setup CI JS dependencies'
2+
description: >
3+
Sets up node_modules and project build outputs for CI jobs.
4+
On Namespace runners, mounts the shared cache volume then runs
5+
yarn install --immutable to sync with the current yarn.lock.
6+
On non-Namespace runners, skips install when node_modules is
7+
already present from a same-run artifact; otherwise installs from scratch.
8+
9+
inputs:
10+
runner_provider:
11+
description: 'Runner provider (`namespace` or any GitHub-hosted value).'
12+
required: false
13+
default: 'current'
14+
15+
runs:
16+
using: 'composite'
17+
steps:
18+
- name: Configure Namespace cache
19+
if: ${{ inputs.runner_provider == 'namespace' }}
20+
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0 # v1
21+
with:
22+
path: |
23+
~/.cache/yarn
24+
.metamask
25+
node_modules
26+
.yarn/cache
27+
28+
- uses: actions/setup-node@v6
29+
with:
30+
node-version-file: '.nvmrc'
31+
cache: ${{ inputs.runner_provider != 'namespace' && 'yarn' || '' }}
32+
33+
# Namespace: always run install so the shared volume stays in sync with yarn.lock.
34+
# Non-Namespace: skip install when node_modules was extracted from a same-run
35+
# artifact; run install when starting from a clean workspace.
36+
- name: Determine if install is needed
37+
id: check-deps
38+
shell: bash
39+
run: |
40+
if [ "${{ inputs.runner_provider }}" != "namespace" ] && \
41+
[ -d node_modules ] && \
42+
[ -f app/util/termsOfUse/termsOfUseContent.ts ]; then
43+
echo "needs-install=false" >> "$GITHUB_OUTPUT"
44+
else
45+
echo "needs-install=true" >> "$GITHUB_OUTPUT"
46+
fi
47+
48+
- name: Install Yarn dependencies with retry
49+
if: ${{ steps.check-deps.outputs.needs-install == 'true' }}
50+
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
51+
with:
52+
timeout_minutes: 10
53+
max_attempts: 3
54+
retry_wait_seconds: 30
55+
command: yarn install --immutable
56+
57+
- name: Run project setup
58+
if: ${{ steps.check-deps.outputs.needs-install == 'true' }}
59+
shell: bash
60+
run: yarn setup:github-ci --node

.github/workflows/auto-rc-ota-build-core.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,4 @@ jobs:
142142
build_commit_sha: ${{ needs.trigger-build.outputs.built_commit_sha }}
143143
build_version: ${{ needs.trigger-build.outputs.semantic_version }}
144144
build_number: ${{ needs.trigger-build.outputs.ios_version_code }}
145-
distribute_external: false
146145
secrets: inherit

.github/workflows/build-and-upload-to-testflight.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
type: string
2121
default: 'MetaMask BETA & Release Candidates'
2222
distribute_external:
23-
description: 'Whether to distribute to external testers. Defaults to false; nightly-build.yml relies on the script default (true) so it always distributes externally.'
23+
description: 'Whether to distribute to external testers. (default: false)'
2424
required: false
2525
type: boolean
2626
default: false
@@ -55,7 +55,7 @@ on:
5555
- 'MM Card Team'
5656
- 'Ramp Provider Testing'
5757
distribute_external:
58-
description: 'Whether to distribute to external testers'
58+
description: 'Whether to distribute to external testers (default: false)'
5959
required: false
6060
type: boolean
6161
default: false
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Build Android
2+
3+
# Creates a temp branch, bumps version (build.yml), builds the Android APK/AAB.
4+
# Mirrors build-and-upload-to-testflight.yml but Android-only and without the upload step.
5+
# APK/AAB artifacts stay attached to the build.yml run via its existing Upload Android * steps.
6+
#
7+
on:
8+
workflow_call:
9+
inputs:
10+
source_branch:
11+
description: 'Branch, tag, or SHA to build'
12+
required: true
13+
type: string
14+
environment:
15+
description: 'Build environment / track. Must be one of: exp, beta, rc (enforced by validate-inputs).'
16+
required: true
17+
type: string
18+
upload_to_sentry:
19+
description: 'If true, enable Sentry CLI upload of JS source maps and native debug symbols during the build'
20+
required: false
21+
type: boolean
22+
default: false
23+
runner_provider:
24+
description: Runner provider forwarded from the caller
25+
required: false
26+
type: string
27+
default: current
28+
outputs:
29+
build_branch:
30+
description: 'Ephemeral build branch created from source_branch'
31+
value: ${{ jobs.prepare-build-branch.outputs.build_branch }}
32+
built_commit_sha:
33+
description: 'Resolved commit SHA at the version-bump commit after build succeeded'
34+
value: ${{ jobs.build.outputs.built_commit_sha }}
35+
semantic_version:
36+
description: 'package.json version at the built commit'
37+
value: ${{ jobs.build.outputs.semantic_version }}
38+
android_version_code:
39+
description: 'android/app/build.gradle versionCode at the built commit'
40+
value: ${{ jobs.build.outputs.android_version_code }}
41+
workflow_dispatch:
42+
inputs:
43+
source_branch:
44+
description: 'Branch, tag, or SHA to build'
45+
required: true
46+
type: string
47+
default: 'main'
48+
environment:
49+
description: 'Build environment / track'
50+
required: true
51+
type: choice
52+
options:
53+
- exp
54+
- beta
55+
- rc
56+
default: rc
57+
upload_to_sentry:
58+
description: 'Upload JS source maps and native debug symbols to Sentry during the build (requires Sentry auth in the build environment)'
59+
required: false
60+
type: boolean
61+
default: false
62+
runner_provider:
63+
description: Runner provider for this manual trial run
64+
required: false
65+
type: choice
66+
options:
67+
- current
68+
- namespace
69+
default: current
70+
71+
permissions:
72+
contents: write
73+
id-token: write
74+
75+
jobs:
76+
# workflow_call inputs cannot use `type: choice` in GitHub Actions, so we enforce
77+
# the allowed `environment` values at runtime to prevent other workflows from
78+
# invoking this wrapper with arbitrary build tracks.
79+
validate-inputs:
80+
name: Validate inputs
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Validate environment input
84+
env:
85+
ENVIRONMENT: ${{ inputs.environment }}
86+
run: |
87+
case "$ENVIRONMENT" in
88+
exp|beta|rc) echo "✅ environment=$ENVIRONMENT is allowed" ;;
89+
*) echo "::error::Invalid environment '$ENVIRONMENT'. Must be one of: exp, beta, rc"; exit 1 ;;
90+
esac
91+
92+
prepare-build-branch:
93+
needs: [validate-inputs]
94+
uses: ./.github/workflows/create-build-branch.yml
95+
with:
96+
source_branch: ${{ inputs.source_branch }}
97+
secrets: inherit
98+
99+
build:
100+
name: Build Android (${{ inputs.environment }})
101+
needs: [prepare-build-branch]
102+
uses: ./.github/workflows/build.yml
103+
with:
104+
build_name: main-${{ inputs.environment }}
105+
platform: android
106+
skip_version_bump: false
107+
source_branch: ${{ needs.prepare-build-branch.outputs.build_branch }}
108+
upload_to_sentry: ${{ inputs.upload_to_sentry }}
109+
runner_provider: ${{ inputs.runner_provider }}
110+
secrets: inherit
111+
112+
cleanup-build-branch:
113+
name: Cleanup build branch
114+
needs: [prepare-build-branch, build]
115+
if: always()
116+
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }}
117+
steps:
118+
- uses: actions/checkout@v4
119+
with:
120+
token: ${{ secrets.PR_TOKEN || github.token }}
121+
- name: Delete temporary build branch
122+
env:
123+
BRANCH: ${{ needs.prepare-build-branch.outputs.build_branch }}
124+
run: |
125+
if [ -n "$BRANCH" ]; then
126+
git push origin --delete "$BRANCH" || true
127+
echo "🧹 Deleted build branch: $BRANCH"
128+
fi

0 commit comments

Comments
 (0)