Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 59 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -527,39 +527,52 @@ jobs:
run: ${{ steps.download-actionlint.outputs.executable }} -color -config-file .github/actionlint.yaml
shell: bash

prepare-ci-js-deps:
name: Prepare CI JS dependencies
if: ${{ needs.get_requirements.outputs.skip_everything != 'true' }}
needs:
- get_requirements
uses: ./.github/workflows/setup-node-modules.yml
with:
platform: ''
setup-command: yarn setup:github-ci --node
artifact-name: ci-js-deps
use-exact-artifact-name: true
include-yarn-install-state: true
include-inpage-bridge-artifacts: false
artifact-retention-days: 1
runner_provider: ${{ inputs.runner_provider }}

unit-tests:
name: Unit tests (${{ matrix.shard }})
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }}
if: ${{ needs.get_requirements.outputs.skip_everything != 'true' }}
needs:
- get_requirements
- prepare-ci-js-deps
Comment thread
cursor[bot] marked this conversation as resolved.
strategy:
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
steps:
- uses: actions/checkout@v6
- name: Configure Namespace cache
if: ${{ inputs.runner_provider == 'namespace' }}
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0 # v1
with:
path: |
~/.cache/yarn
.metamask
node_modules
.yarn/cache
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: ${{ inputs.runner_provider != 'namespace' && 'yarn' || '' }}
- name: Install Yarn dependencies with retry
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2
- name: Download prepared dependencies
uses: actions/download-artifact@v4
with:
timeout_minutes: 10
max_attempts: 3
retry_wait_seconds: 30
command: yarn install --immutable
- name: Clean state and following up dependencies installation
run: yarn setup:github-ci --node
name: ci-js-deps
path: .
- name: Restore node_modules executable permissions
uses: ./.github/actions/restore-node-modules-permissions
- name: Validate downloaded dependency files
shell: bash
run: |
set -euo pipefail
test -d node_modules
test -f .yarn/install-state.gz
test -f app/util/termsOfUse/termsOfUseContent.ts
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
- name: Prepare results directory
run: mkdir -p tests/results
# The "10" in this command is the total number of shards. It must be kept
Expand Down Expand Up @@ -594,42 +607,28 @@ jobs:
# threshold calculation is accurate.
merge-unit-and-component-view-tests:
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ci-linux' || 'ubuntu-latest' }}
needs: [unit-tests, component-view-tests]
needs: [prepare-ci-js-deps, unit-tests, component-view-tests]
if: ${{ !cancelled() && github.event_name != 'merge_group' }}
steps:
- uses: actions/checkout@v6
- name: Configure Namespace cache
if: ${{ inputs.runner_provider == 'namespace' }}
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0 # v1
with:
path: |
~/.cache/yarn
.metamask
node_modules
.yarn/cache
- name: Restore node_modules cache
if: ${{ inputs.runner_provider != 'namespace' }}
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
.yarn/install-state.gz
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: ${{ inputs.runner_provider != 'namespace' && 'yarn' || '' }}
- name: Install Yarn dependencies with retry
if: ${{ inputs.runner_provider == 'namespace' || steps.cache-node-modules.outputs.cache-hit != 'true' }}
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2
- name: Download prepared dependencies
uses: actions/download-artifact@v4
with:
timeout_minutes: 10
max_attempts: 3
retry_wait_seconds: 30
command: yarn install --immutable
- name: Clean state and following up dependencies installation
run: yarn setup:github-ci --node
name: ci-js-deps
path: .
- name: Restore node_modules executable permissions
uses: ./.github/actions/restore-node-modules-permissions
- name: Validate downloaded dependency files
shell: bash
run: |
set -euo pipefail
test -d node_modules
test -f .yarn/install-state.gz
test -f app/util/termsOfUse/termsOfUseContent.ts
- uses: actions/download-artifact@v4
with:
pattern: coverage-*
Expand Down Expand Up @@ -724,43 +723,30 @@ jobs:
if: ${{ needs.get_requirements.outputs.skip_everything != 'true' }}
needs:
- get_requirements
- prepare-ci-js-deps
strategy:
matrix:
shard: [1, 2]
steps:
- uses: actions/checkout@v6
- name: Configure Namespace cache
if: ${{ inputs.runner_provider == 'namespace' }}
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0 # v1
with:
path: |
~/.cache/yarn
.metamask
node_modules
.yarn/cache
- name: Restore node_modules cache
if: ${{ inputs.runner_provider != 'namespace' }}
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
.yarn/install-state.gz
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: ${{ inputs.runner_provider != 'namespace' && 'yarn' || '' }}
- name: Install Yarn dependencies with retry
if: ${{ inputs.runner_provider == 'namespace' || steps.cache-node-modules.outputs.cache-hit != 'true' }}
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2
- name: Download prepared dependencies
uses: actions/download-artifact@v4
with:
timeout_minutes: 10
max_attempts: 3
retry_wait_seconds: 30
command: yarn install --immutable
- name: Clean state and following up dependencies installation
run: yarn setup:github-ci --node
name: ci-js-deps
path: .
- name: Restore node_modules executable permissions
uses: ./.github/actions/restore-node-modules-permissions
- name: Validate downloaded dependency files
shell: bash
run: |
set -euo pipefail
test -d node_modules
test -f .yarn/install-state.gz
test -f app/util/termsOfUse/termsOfUseContent.ts
- name: Prepare results directory
run: mkdir -p tests/results
- run: |
Expand Down Expand Up @@ -1080,6 +1066,7 @@ jobs:
- unit-tests
- component-view-tests
- check-workflows
- prepare-ci-js-deps
- js-bundle-size-check
- sonar-cloud-quality-gate-status
- build-android-apks
Expand Down
53 changes: 46 additions & 7 deletions .github/workflows/setup-node-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,31 @@ on:
required: false
type: string
default: 'node-modules'
use-exact-artifact-name:
description: 'When true, use artifact-name exactly (no node/os suffix for generic platform).'
required: false
type: boolean
default: false
artifact-retention-days:
description: 'Number of days to retain the artifact'
required: false
type: number
default: 1
setup-command:
description: "Optional setup command override for generic platform (platform=''). If empty, defaults to 'yarn setup:github-ci'."
required: false
type: string
default: ''
include-yarn-install-state:
description: 'Include .yarn/install-state.gz in zip artifact payload.'
required: false
type: boolean
default: false
include-inpage-bridge-artifacts:
description: 'Include InpageBridgeWeb3.js and scripts/inpage-bridge/dist in zip artifact payload.'
required: false
type: boolean
default: true
runner_provider:
description: Runner provider forwarded from the caller
required: false
Expand Down Expand Up @@ -118,7 +138,7 @@ jobs:
- name: Set artifact name
id: set-artifact-name
run: |
if [ -n "${{ inputs.platform }}" ]; then
if [ -n "${{ inputs.platform }}" ] || [ "${{ inputs.use-exact-artifact-name }}" = "true" ]; then
echo "artifact-name=${{ inputs.artifact-name }}" >> "$GITHUB_OUTPUT"
echo "📦 Artifact name: ${{ inputs.artifact-name }}"
else
Expand Down Expand Up @@ -170,7 +190,12 @@ jobs:
if: inputs.platform == ''
run: |
echo "🔧 Running setup for GitHub CI..."
yarn setup:github-ci
if [ -n "${{ inputs.setup-command }}" ]; then
echo "Using setup override: ${{ inputs.setup-command }}"
${{ inputs.setup-command }}
else
yarn setup:github-ci
fi
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated

- name: Verify setup completed
run: |
Expand Down Expand Up @@ -223,16 +248,30 @@ jobs:
compression-level: 0
if-no-files-found: error

- name: Build zip artifact path list
id: build-zip-paths
if: inputs.upload-artifact && !inputs.use-tarball
shell: bash
run: |
paths=$'node_modules\napp/util/termsOfUse/termsOfUseContent.ts'
if [ "${{ inputs.include-yarn-install-state }}" = "true" ]; then
paths+=$'\n.yarn/install-state.gz'
fi
if [ "${{ inputs.include-inpage-bridge-artifacts }}" = "true" ]; then
paths+=$'\napp/core/InpageBridgeWeb3.js\nscripts/inpage-bridge/dist'
fi
{
echo "paths<<EOF"
printf "%s\n" "$paths"
echo "EOF"
} >> "$GITHUB_OUTPUT"

- name: Upload node_modules artifact (zip)
if: inputs.upload-artifact && !inputs.use-tarball
uses: actions/upload-artifact@v4.5.0
with:
name: ${{ steps.set-artifact-name.outputs.artifact-name }}
path: |
node_modules
app/util/termsOfUse/termsOfUseContent.ts
app/core/InpageBridgeWeb3.js
scripts/inpage-bridge/dist
path: ${{ steps.build-zip-paths.outputs.paths }}
retention-days: ${{ inputs.artifact-retention-days }}
compression-level: 1
if-no-files-found: warn
Expand Down
Loading