-
Notifications
You must be signed in to change notification settings - Fork 639
Update workflows to use MetaMask/action-checkout-and-setup
#3214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a5ccf86
Update `build-lint-test` workflow
Mrtenz 46f6e0e
Update Actionlint to `1.7.7`
Mrtenz 47b9771
Remove `node-version` from jobs not using matrix
Mrtenz 27c9ab9
Remove redundant Yarn install step
Mrtenz 6db70e7
Add dummy file to preserve directory structure
Mrtenz 1da051d
Update other workflows
Mrtenz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,25 +17,25 @@ jobs: | |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node-version: [18.x, 20.x] | ||
| node-version: [18.x, 20.x, 22.x] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v4 | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v1 | ||
| with: | ||
| is-high-risk-environment: false | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: yarn | ||
| - run: yarn --immutable | ||
| - name: Cache "@metamask/snaps-execution-environments" build | ||
| cache-node-modules: ${{ matrix.node-version == '20.x' }} | ||
| - name: Prepare "@metamask/snaps-execution-environments" build | ||
| run: yarn workspace @metamask/snaps-execution-environments run build:lavamoat | ||
| - name: Save "@metamask/snaps-execution-environments" build | ||
| id: cache-snaps-execution-environments-build | ||
| uses: actions/cache@v4 | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: snaps-execution-environments-build-${{ runner.os }}-${{ matrix.node-version }}-${{ github.sha }} | ||
| retention-days: 1 | ||
| path: | | ||
| .nvmrc | ||
| packages/snaps-execution-environments/dist/browserify | ||
| key: snaps-execution-environments-build-${{ runner.os }}-${{ matrix.node-version }}-${{ github.sha }} | ||
| - name: Prepare "@metamask/snaps-execution-environments" build | ||
| if: steps.cache-snaps-execution-environments-build.outputs.cache-hit != 'true' | ||
| run: yarn workspace @metamask/snaps-execution-environments run build:lavamoat | ||
| - name: Fetch workspace package names | ||
| id: workspace-package-names | ||
| run: | | ||
|
|
@@ -51,21 +51,20 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| needs: prepare | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v1 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: yarn | ||
| - run: yarn --immutable --immutable-cache | ||
| is-high-risk-environment: false | ||
| - name: Build | ||
| run: yarn build:ci | ||
| - name: Cache build files | ||
| uses: actions/cache@v4 | ||
| - name: Save build files | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build-source-${{ runner.os }}-${{ github.sha }} | ||
| retention-days: 1 | ||
| path: | | ||
| .nvmrc | ||
| packages/*/dist | ||
| key: build-source-${{ runner.os }}-${{ github.sha }} | ||
| - name: Require clean working directory | ||
| shell: bash | ||
| run: | | ||
|
|
@@ -79,20 +78,14 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| needs: prepare | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v1 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: yarn | ||
| - run: yarn --immutable --immutable-cache | ||
| is-high-risk-environment: false | ||
| - name: Restore "@metamask/snaps-execution-environments" build | ||
| uses: actions/cache@v4 | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: | | ||
| packages/snaps-execution-environments/dist/browserify | ||
| key: snaps-execution-environments-build-${{ runner.os }}-18.x-${{ github.sha }} | ||
| fail-on-cache-miss: true | ||
| name: snaps-execution-environments-build-${{ runner.os }}-22.x-${{ github.sha }} | ||
FrederikBolding marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Cache Webpack vendor | ||
| id: cache-webpack-vendor | ||
| uses: actions/cache@v4 | ||
|
|
@@ -105,13 +98,6 @@ jobs: | |
| run: yarn workspace @metamask/snaps-simulator run build:vendor | ||
| - name: Build | ||
| run: yarn workspace @metamask/snaps-simulator run build:webpack | ||
| - name: Cache "@metamask/snaps-simulator" build | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was this used for before?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To run |
||
| id: cache-e2e-simulator-build | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| packages/snaps-simulator/dist/webpack | ||
| key: e2e-simulator-build-${{ runner.os }}-${{ github.sha }} | ||
| - name: Require clean working directory | ||
| shell: bash | ||
| run: | | ||
|
|
@@ -125,13 +111,10 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| needs: prepare | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v1 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: yarn | ||
| - run: yarn --immutable --immutable-cache | ||
| is-high-risk-environment: false | ||
| - name: Build | ||
| run: yarn workspace @metamask/test-snaps run build | ||
| - name: Require clean working directory | ||
|
|
@@ -147,13 +130,10 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| needs: prepare | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v1 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: yarn | ||
| - run: yarn --immutable --immutable-cache | ||
| is-high-risk-environment: false | ||
| - name: Generate LavaMoat policy | ||
| run: yarn workspace @metamask/snaps-execution-environments build:lavamoat:policy | ||
| - name: Require clean working directory | ||
|
|
@@ -169,13 +149,10 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| needs: prepare | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v1 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: yarn | ||
| - run: yarn --immutable --immutable-cache | ||
| is-high-risk-environment: false | ||
| - name: Lint | ||
| run: yarn lint | ||
| - name: Require clean working directory | ||
|
|
@@ -195,47 +172,39 @@ jobs: | |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node-version: [18.x, 20.x] | ||
| node-version: [18.x, 20.x, 22.x] | ||
| package-name: ${{ fromJson(needs.prepare.outputs.test-workspace-package-names) }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v4 | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v1 | ||
| with: | ||
| is-high-risk-environment: false | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: yarn | ||
| - name: Restore "@metamask/snaps-execution-environments" build | ||
| uses: actions/cache@v4 | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: | | ||
| packages/snaps-execution-environments/dist/browserify | ||
| key: snaps-execution-environments-build-${{ runner.os }}-${{ matrix.node-version }}-${{ github.sha }} | ||
| fail-on-cache-miss: true | ||
| name: snaps-execution-environments-build-${{ runner.os }}-${{ matrix.node-version }}-${{ github.sha }} | ||
| - name: Restore build files | ||
| uses: actions/cache@v4 | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: | | ||
| packages/*/dist | ||
| key: build-source-${{ runner.os }}-${{ github.sha }} | ||
| fail-on-cache-miss: true | ||
| - run: yarn --immutable --immutable-cache | ||
| name: build-source-${{ runner.os }}-${{ github.sha }} | ||
| - name: Install Google Chrome | ||
| if: ${{ matrix.package-name == '@metamask/snaps-controllers' || matrix.package-name == '@metamask/snaps-execution-environments' || matrix.package-name == '@metamask/snaps-utils' }} | ||
| run: yarn install-chrome | ||
| - run: yarn workspace ${{ matrix.package-name }} run test | ||
| - name: Get coverage folder | ||
| id: get-coverage-folder | ||
| run: | | ||
| echo "stub" >> stub | ||
FrederikBolding marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "coverage-folder=$(yarn workspaces list --json | grep ${{ matrix.package-name }} | jq -r '.location')/coverage" >> "$GITHUB_OUTPUT" | ||
| echo "artifact-name=$(echo ${{ matrix.package-name }} | sed 's:.*/::')" >> "$GITHUB_OUTPUT" | ||
| shell: bash | ||
| - name: Upload coverage artifact | ||
| if: ${{ matrix.node-version == '18.x' }} | ||
| if: ${{ matrix.node-version == '22.x' }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-${{ steps.get-coverage-folder.outputs.artifact-name }} | ||
| path: | | ||
| stub | ||
| .nvmrc | ||
| ${{ steps.get-coverage-folder.outputs.coverage-folder }}/**/coverage-final.json | ||
| if-no-files-found: warn | ||
| retention-days: 1 | ||
|
|
@@ -273,30 +242,22 @@ jobs: | |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node-version: [18.x, 20.x] | ||
| node-version: [18.x, 20.x, 22.x] | ||
| package-name: ${{ fromJson(needs.prepare.outputs.e2e-workspace-package-names) }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v4 | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v1 | ||
| with: | ||
| is-high-risk-environment: false | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: yarn | ||
| - name: Restore "@metamask/snaps-execution-environments" build | ||
| uses: actions/cache@v4 | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: | | ||
| packages/snaps-execution-environments/dist/browserify | ||
| key: snaps-execution-environments-build-${{ runner.os }}-${{ matrix.node-version }}-${{ github.sha }} | ||
| fail-on-cache-miss: true | ||
| name: snaps-execution-environments-build-${{ runner.os }}-${{ matrix.node-version }}-${{ github.sha }} | ||
| - name: Restore build files | ||
| uses: actions/cache@v4 | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: | | ||
| packages/*/dist | ||
| key: build-source-${{ runner.os }}-${{ github.sha }} | ||
| fail-on-cache-miss: true | ||
| - run: yarn --immutable --immutable-cache | ||
| name: build-source-${{ runner.os }}-${{ github.sha }} | ||
| - name: Build snap | ||
| run: yarn workspace ${{ matrix.package-name }} run build | ||
| - name: Run E2E test | ||
|
|
@@ -317,12 +278,9 @@ jobs: | |
| matrix: | ||
| os: [macOS-latest, windows-latest] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Use Node.js | ||
| uses: actions/setup-node@v4 | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v1 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: yarn | ||
| - run: yarn --immutable | ||
| is-high-risk-environment: false | ||
| - run: yarn build:ci | ||
| - run: yarn workspace @metamask/snaps-cli run test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.