Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
154 changes: 56 additions & 98 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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: |
Expand All @@ -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 }}
- name: Cache Webpack vendor
id: cache-webpack-vendor
uses: actions/cache@v4
Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was this used for before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To run snaps-jest, but we didn't remove this when switching to the Node.js-based simulation.

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: |
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
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
Expand Down Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- name: Download actionlint
id: download-actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.25
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.7.7
shell: bash
- name: Check workflow files
run: ${{ steps.download-actionlint.outputs.executable }} -color
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/publish-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ jobs:
- name: Ensure `destination_dir` is not empty
if: ${{ inputs.destination_dir == '' }}
run: exit 1
- 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'
- run: yarn --immutable
is-high-risk-environment: true
- run: yarn build:lavamoat
- name: configure AWS credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/publish-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ jobs:
- name: Ensure `publish_dir` is not empty
if: ${{ inputs.publish_dir == '' }}
run: exit 1
- 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'
- run: yarn --immutable
is-high-risk-environment: true
- name: Run build script
run: ${{ inputs.build_script }}
- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
- 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
is-high-risk-environment: true
- name: Get commit SHA
id: commit-sha
run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
Expand Down
Loading
Loading