Add Chain 138 Snap: deploy/verify scripts, runbook, CI, security, version/health, token list validation

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
defiQUG
2026-02-11 12:45:43 -08:00
parent 0ade1c0c80
commit 8421c47b1c
90 changed files with 25862 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
name: Build, Lint, and Test
on:
workflow_call:
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
with:
is-high-risk-environment: false
cache-node-modules: true
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@9.15.0 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile
build:
name: Build
runs-on: ubuntu-latest
needs:
- prepare
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
with:
is-high-risk-environment: false
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@9.15.0 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- name: Upload Snap build artifact
uses: actions/upload-artifact@v4
with:
name: snap-${{ runner.os }}-${{ github.sha }}
path: ./packages/snap/dist
retention-days: 1
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi
lint:
name: Lint
runs-on: ubuntu-latest
needs:
- prepare
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
with:
is-high-risk-environment: false
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@9.15.0 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm run lint
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi
e2e-test:
name: End-to-end Test
runs-on: ubuntu-latest
needs:
- prepare
- build
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
with:
is-high-risk-environment: false
- name: Download Snap build artifact
uses: actions/download-artifact@v4
with:
name: snap-${{ runner.os }}-${{ github.sha }}
path: ./packages/snap/dist
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@9.15.0 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Snap unit tests
run: pnpm --filter snap run test
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Run Playwright E2E (companion site)
run: pnpm run test:e2e
env:
CI: true
timeout-minutes: 8
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi

View File

@@ -0,0 +1,49 @@
# Build Snap companion site (pathPrefix /snap). Optional: set repository variable
# SNAP_VERIFY_BASE_URL (e.g. https://explorer.d-bis.org) to run verify-snap-site-vmid5000.sh after build.
# Optional: set secret GATSBY_SNAP_API_BASE_URL for production API in build.
name: Deploy Snap Site
on:
push:
branches: [main]
paths:
- 'packages/site/**'
- 'packages/snap/**'
- 'scripts/deploy-snap-site-to-vmid5000.sh'
- 'scripts/verify-snap-site-vmid5000.sh'
- '.github/workflows/deploy-snap-site.yml'
workflow_dispatch:
env:
GATSBY_PATH_PREFIX: /snap
jobs:
build-and-verify:
name: Build site and verify
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@9.15.0 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Snap site (pathPrefix /snap)
run: pnpm --filter site run build
env:
GATSBY_PATH_PREFIX: /snap
GATSBY_SNAP_API_BASE_URL: ${{ secrets.GATSBY_SNAP_API_BASE_URL }}
- name: Upload site artifact
uses: actions/upload-artifact@v4
with:
name: snap-site-${{ github.sha }}
path: packages/site/public/
retention-days: 7
- name: Verify deployed Snap site (smoke)
if: ${{ vars.SNAP_VERIFY_BASE_URL != '' && vars.SNAP_VERIFY_BASE_URL != null }}
run: ./scripts/verify-snap-site-vmid5000.sh "${{ vars.SNAP_VERIFY_BASE_URL }}"

View File

@@ -0,0 +1,53 @@
name: Main
on:
push:
branches: [main]
pull_request:
jobs:
check-workflows:
name: Check workflows
runs-on: ubuntu-latest
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
with:
is-high-risk-environment: false
- name: Download actionlint
id: download-actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.23
shell: bash
- name: Check workflow files
run: ${{ steps.download-actionlint.outputs.executable }} -color
shell: bash
build-lint-test:
name: Build, lint, and test
uses: ./.github/workflows/build-lint-test.yml
all-jobs-completed:
name: All jobs completed
runs-on: ubuntu-latest
needs:
- check-workflows
- build-lint-test
outputs:
PASSED: ${{ steps.set-output.outputs.PASSED }}
steps:
- name: Set PASSED output
id: set-output
run: echo "PASSED=true" >> "$GITHUB_OUTPUT"
all-jobs-pass:
name: All jobs pass
if: ${{ always() }}
runs-on: ubuntu-latest
needs: all-jobs-completed
steps:
- name: Check that all jobs have passed
run: |
passed="${{ needs.all-jobs-completed.outputs.PASSED }}"
if [[ $passed != "true" ]]; then
exit 1
fi

View File

@@ -0,0 +1,46 @@
name: MetaMask Security Code Scanner
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
run-security-scan:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: MetaMask Security Code Scanner
uses: MetaMask/action-security-code-scanner@v1
with:
repo: ${{ github.repository }}
paths_ignored: |
.storybook/
'**/__snapshots__/'
'**/*.snap'
'**/*.stories.js'
'**/*.stories.tsx'
'**/*.test.browser.ts*'
'**/*.test.js*'
'**/*.test.ts*'
'**/fixtures/'
'**/jest.config.js'
'**/jest.environment.js'
'**/mocks/'
'**/test*/'
docs/
e2e/
merged-packages/
node_modules
storybook/
test*/
rules_excluded: example
project_metrics_token: ${{ secrets.SECURITY_SCAN_METRICS_TOKEN }}
slack_webhook: ${{ secrets.APPSEC_BOT_SLACK_WEBHOOK }}