Skip to content

Commit 4b4292d

Browse files
authored
ci: optimize workflow caching and checkouts (#29874)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until this PR meets the canonical Definition of Ready For Review in `docs/readme/ready-for-review.md`. In short: the template must be materially complete (not just section titles present), all status checks must be currently passing, and the only expected follow-up commits must be reviewer-driven. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> Optimizes selected CI workflows by using Yarn cache support for the EAS update dependency install and avoiding full-history checkouts where the jobs do not need repository history. This leaves history-sensitive workflows unchanged, including feature-flag registry, merge-base, tag, branch-sync, and SonarCloud paths. Validation: - Parsed the changed workflow YAML files locally. - Ran the requested workflow grep for `fetch-depth: 0`, `actions/setup-node`, `yarn install --immutable`, and selected git commands. - Ran `git diff --check`. - Ran `actionlint` on changed workflows, with pre-existing `actions/*@v3` and disabled-job warnings ignored. - Ran a diff-scoped Codex Security scan: no findings. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Refs: [MCWP-592](https://consensyssoftware.atlassian.net/browse/MCWP-592) ## **Manual testing steps** N/A - workflow-only CI change. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** N/A ### **After** N/A ## **Pre-merge author checklist** <!-- Every checklist item must be consciously assessed before marking this PR as "Ready for review". A checked box means you deliberately considered that responsibility, not that you literally performed every action listed. Unchecked boxes are ambiguous: they are not an implicit "N/A" and they are not a silent "skip". See `docs/readme/ready-for-review.md` for the full checklist semantics. --> - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. #### Performance checks (if applicable) - [x] I've tested on Android - Ideally on a mid-range device; emulator is acceptable - [x] I've tested with a power user scenario - Use these [power-user SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93) to import wallets with many accounts and tokens - [x] I've instrumented key operations with Sentry traces for production performance metrics - See [`trace()`](/app/util/trace.ts) for usage and [`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274) for an example For performance guidelines and tooling, see the [Performance Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers). ## **Pre-merge reviewer checklist** <!-- Reviewer checklist items follow the same semantics as the author checklist: an unchecked box is ambiguous, a checked box means the reviewer consciously assessed that responsibility. See `docs/readme/ready-for-review.md`. --> - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. [MCWP-592]: https://consensyssoftware.atlassian.net/browse/MCWP-592?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent cbb5cf4 commit 4b4292d

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ jobs:
130130
steps:
131131
- uses: actions/checkout@v4
132132
with:
133+
fetch-depth: 1
133134
ref: ${{ !inputs.skip_version_bump && needs.update-build-version.outputs.commit-hash || (inputs.source_branch || github.ref_name) }}
134135
- name: Setup Node.js
135136
uses: actions/setup-node@v4
@@ -169,7 +170,7 @@ jobs:
169170
uses: ./.github/workflows/setup-node-modules.yml
170171
with:
171172
ref: ${{ needs.prepare.outputs.checkout_ref_for_setup }}
172-
fetch-depth: 0
173+
fetch-depth: 1
173174
checkout-submodules: true
174175
platform: ${{ matrix.platform }}
175176
build_name: ${{ inputs.build_name }}
@@ -573,6 +574,7 @@ jobs:
573574
steps:
574575
- uses: actions/checkout@v4
575576
with:
577+
fetch-depth: 1
576578
ref: ${{ needs.prepare.outputs.checkout_ref_for_setup }}
577579

578580
- name: Setup Node.js

.github/workflows/create-build-branch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v4
2929
with:
30-
fetch-depth: 0
30+
fetch-depth: 1
3131
ref: ${{ inputs.source_branch }}
3232
token: ${{ secrets.PR_TOKEN || github.token }}
3333
- name: Create temporary build branch

.github/workflows/push-eas-update.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
- name: Checkout repository
8282
uses: actions/checkout@v4
8383
with:
84-
fetch-depth: 0
84+
fetch-depth: 1
8585

8686
- name: Resolve PR HEAD commit
8787
id: resolve-pr
@@ -118,7 +118,7 @@ jobs:
118118
uses: ./.github/workflows/setup-node-modules.yml
119119
with:
120120
ref: ${{ needs.validate-pr.outputs.commit_sha }}
121-
fetch-depth: 0
121+
fetch-depth: 1
122122
upload-artifact: true
123123
artifact-name: node-modules-eas-update-pr
124124
artifact-retention-days: 1
@@ -130,7 +130,7 @@ jobs:
130130
uses: ./.github/workflows/setup-node-modules.yml
131131
with:
132132
ref: ${{ inputs.base_branch }}
133-
fetch-depth: 0
133+
fetch-depth: 1
134134
upload-artifact: true
135135
artifact-name: node-modules-eas-update-base
136136
artifact-retention-days: 1
@@ -153,6 +153,7 @@ jobs:
153153
uses: actions/setup-node@v4
154154
with:
155155
node-version-file: '.nvmrc'
156+
cache: 'yarn'
156157

157158
- run: yarn install --immutable
158159

@@ -201,14 +202,14 @@ jobs:
201202
uses: actions/checkout@v4
202203
with:
203204
ref: ${{ needs.validate-pr.outputs.commit_sha }}
204-
fetch-depth: 0
205+
fetch-depth: 1
205206

206207
- name: Checkout base branch snapshot
207208
uses: actions/checkout@v4
208209
with:
209210
ref: ${{ env.BASE_BRANCH_REF }}
210211
path: main
211-
fetch-depth: 0
212+
fetch-depth: 1
212213

213214
- name: Setup Node.js
214215
uses: actions/setup-node@v4
@@ -358,7 +359,7 @@ jobs:
358359
uses: actions/checkout@v4
359360
with:
360361
ref: ${{ env.TARGET_COMMIT_HASH }}
361-
fetch-depth: 0
362+
fetch-depth: 1
362363

363364
- name: Setup Node.js
364365
uses: actions/setup-node@v4

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
- name: Checkout repository
7575
uses: actions/checkout@v4
7676
with:
77-
fetch-depth: 0
77+
fetch-depth: 1
7878

7979
- name: Setup Ruby (iOS)
8080
uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb #v1

0 commit comments

Comments
 (0)