Skip to content

Commit a492e34

Browse files
authored
feat: use shallow clone in prepare and emit-build-metadata jobs (#29807)
## **Description** The `prepare` and `emit-build-metadata` jobs in `build.yml` use `fetch-depth: 0` (full git history clone), which takes ~1m 10s each (median, n=21). Neither job performs any git history operations: - `prepare`: reads `builds.yml` via `fs.readFileSync` and runs `validate-build-config.js` (zero git commands) - `emit-build-metadata`: runs `git rev-parse HEAD` (works on shallow clones) and `get-build-metadata.sh` which only reads files (zero git commands) Removing `fetch-depth: 0` defaults to `fetch-depth: 1` (shallow clone), reducing checkout from ~70s to ~10-15s per job. **Expected saving:** ~1m 50s - 2m 10s per pipeline run across both jobs. Also eliminates a tail-risk outlier where `emit-build-metadata` checkout took 6m 45s. Part of MCWP-574 (pipeline optimization series: PR 3 of 4). ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: MCWP-574 ## **Manual testing steps** ```gherkin Feature: Shallow clone in build pipeline Scenario: prepare job completes with shallow clone Given a production build is triggered via workflow_dispatch on build.yml And skip_version_bump is true When the prepare job runs Then the actions/checkout step completes in ~10-15s (down from ~70s) And the prepare job outputs are identical to a full-clone run Scenario: emit-build-metadata job completes with shallow clone Given a production build completes successfully When the emit-build-metadata job runs Then the actions/checkout step completes in ~10-15s And built_commit_sha, semantic_version, and version codes are output correctly Scenario: version-bump commit ref works with shallow clone Given a production build is triggered with skip_version_bump false When the prepare job checks out the version-bump commit hash Then actions/checkout fetches the specific commit successfully And the prepare job completes without errors ``` ## **Screenshots/Recordings** ### **Before** Not applicable (CI pipeline change, no UI). ### **After** Not applicable (CI pipeline change, no UI). ## **Pre-merge author checklist** - [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 - [ ] 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. ## **Pre-merge reviewer checklist** - [ ] 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.
1 parent ae4e8f0 commit a492e34

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ jobs:
117117
steps:
118118
- uses: actions/checkout@v4
119119
with:
120-
fetch-depth: 0
121120
ref: ${{ !inputs.skip_version_bump && needs.update-build-version.outputs.commit-hash || (inputs.source_branch || github.ref_name) }}
122121
- name: Setup Node.js
123122
uses: actions/setup-node@v4
@@ -528,7 +527,6 @@ jobs:
528527
steps:
529528
- uses: actions/checkout@v4
530529
with:
531-
fetch-depth: 0
532530
ref: ${{ needs.prepare.outputs.checkout_ref_for_setup }}
533531

534532
- name: Setup Node.js

0 commit comments

Comments
 (0)