Skip to content

test: adapt keysets, inbox, rollup admin for anvil #2280

test: adapt keysets, inbox, rollup admin for anvil

test: adapt keysets, inbox, rollup admin for anvil #2280

Workflow file for this run

name: Build, Test
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
audit:
name: 'Audit'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
with:
install-command: pnpm install --frozen-lockfile
cache-key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Run audit
run: pnpm audit:ci
check-formatting:
name: 'Check Formatting'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
with:
install-command: pnpm install --frozen-lockfile
cache-key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Check formatting with Prettier
run: pnpm prettier:check
check-linting:
name: 'Check Linting'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
with:
install-command: pnpm install --frozen-lockfile
cache-key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Check linting
run: pnpm lint
test-type:
name: Test (Type)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
with:
install-command: pnpm install --frozen-lockfile
cache-key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Copy .env
run: cp ./.env.example ./.env
- name: Build
run: pnpm build
- name: Test
run: pnpm test:type
test-unit:
name: Test (Unit)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
with:
install-command: pnpm install --frozen-lockfile
cache-key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Copy .env
run: cp ./.env.example ./.env
- name: Build
run: pnpm build
- name: Test
run: pnpm test:unit
test-integration:
name: Test (Integration) - ${{ matrix.config.name }}
runs-on: ubuntu-latest
strategy:
matrix:
config:
- name: Nitro contracts v3.2 - Custom gas token with 18 decimals
nitro-contracts-branch: v3.2.0
args: --tokenbridge --l3node --l3-token-bridge --l3-fee-token
decimals: 18
- name: Nitro contracts v3.2 - Custom gas token with 6 decimals
nitro-contracts-branch: v3.2.0
args: --tokenbridge --l3node --l3-token-bridge --l3-fee-token --l3-fee-token-decimals 6
decimals: 6
- name: Nitro contracts v2.1 - Custom gas token with 18 decimals
nitro-contracts-branch: v2.1.3
args: --tokenbridge --l3node --l3-token-bridge --l3-fee-token
decimals: 18
- name: Nitro contracts v2.1 - Custom gas token with 6 decimals
nitro-contracts-branch: v2.1.3
args: --tokenbridge --l3node --l3-token-bridge --l3-fee-token --l3-fee-token-decimals 6
decimals: 6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
with:
install-command: pnpm install --frozen-lockfile
cache-key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Set up the local node
uses: OffchainLabs/actions/run-nitro-test-node@feat-simplify
with:
nitro-testnode-ref: release
nitro-contracts-branch: ${{ matrix.config.nitro-contracts-branch }}
args: ${{ matrix.config.args }}
- name: Copy .env
run: cp ./.env.example ./.env
- name: Build
run: pnpm build
- name: Test
run: |
INTEGRATION_TEST_DECIMALS=${{matrix.config.decimals}} \
INTEGRATION_TEST_NITRO_CONTRACTS_BRANCH=${{matrix.config.nitro-contracts-branch}} \
pnpm test:integration
publish-nitro-contracts-image:
name: Publish Nitro Contracts Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set nitro contracts image
run: |
echo "NITRO_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-nitro-contracts:v3.2.0-2f747c7" >> "$GITHUB_ENV"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check nitro contracts image
id: check-image
run: |
if docker manifest inspect "${NITRO_CONTRACTS_GHCR_IMAGE}" >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Build and push nitro contracts image
if: steps.check-image.outputs.exists != 'true'
uses: docker/build-push-action@v6
with:
context: ./nitro-contracts
file: ./nitro-contracts/Dockerfile
push: true
tags: |
${{ env.NITRO_CONTRACTS_GHCR_IMAGE }}
test-integration-anvil:
name: Test (Integration Anvil)
needs: publish-nitro-contracts-image
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set nitro contracts image
run: |
echo "NITRO_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-nitro-contracts:v3.2.0-2f747c7" >> "$GITHUB_ENV"
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Load nitro contracts image
run: docker pull "${NITRO_CONTRACTS_GHCR_IMAGE}"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.3
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
with:
install-command: pnpm install --frozen-lockfile
cache-key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Restore anvil RPC cache
id: anvil-rpc-cache-restore
uses: actions/cache/restore@v4
with:
path: .cache/anvil-rpc-cache.json
key: ${{ runner.os }}-anvil-rpc-cache-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-anvil-rpc-cache-${{ github.ref_name }}-
${{ runner.os }}-anvil-rpc-cache-main-
${{ runner.os }}-anvil-rpc-cache-
- name: Build
run: pnpm build
- name: Test
run: pnpm test:integration:anvil
- name: Save anvil RPC cache
if: >-
always() &&
github.ref_name == 'main'
uses: actions/cache/save@v4
with:
path: .cache/anvil-rpc-cache.json
key: ${{ runner.os }}-anvil-rpc-cache-${{ github.ref_name }}-${{ github.run_id }}