feat: adds viem support #1148
This file contains 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
name: Build, Test | |
on: | |
pull_request: | |
workflow_dispatch: | |
env: | |
MAINNET_RPC: ${{ secrets.MAINNET_RPC }} | |
jobs: | |
install: | |
name: 'Install' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16, 18, 20] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install node_modules | |
uses: OffchainLabs/actions/node-modules/install@main | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16, 18, 20] | |
needs: install | |
permissions: | |
checks: write # https://github.com/mikepenz/action-junit-report/issues/23#issuecomment-1412597753 | |
env: | |
TEST_PATH: /tmp/test-results | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Restore node_modules | |
uses: OffchainLabs/actions/node-modules/restore@main | |
- name: Lint sdk | |
run: | | |
yarn gen:abi | |
yarn build --reporter-options output=$TEST_PATH/sdk.xml | |
yarn lint --format junit -o $TEST_PATH/sdk-lint.xml | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lint-results | |
path: ${{ env.TEST_PATH }} | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v3 | |
if: always() # always run even if the previous step fails | |
with: | |
report_paths: '${{ env.TEST_PATH }}/sdk-lint.xml' | |
fail_on_failure: false | |
# TODO: need to fix codecov, hasn't been working for a while according to #172 comment | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: false | |
verbose: false | |
audit: | |
name: Audit | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16, 18, 20] | |
needs: install | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Restore node_modules | |
uses: OffchainLabs/actions/node-modules/restore@main | |
- run: yarn audit:ci | |
test-unit: | |
name: Test (Unit) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16, 18, 20] | |
needs: install | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Restore node_modules | |
uses: OffchainLabs/actions/node-modules/restore@main | |
- name: Build | |
run: | | |
yarn gen:abi | |
yarn build | |
- name: Run unit tests | |
run: CI=true yarn test:unit | |
test-integration: | |
name: Test (Integration) - ${{ matrix.description }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16, 18, 20] | |
include: | |
- viem_signer: '0' | |
description: 'Ethers v5' | |
- viem_signer: '1' | |
description: 'Viem' | |
needs: install | |
env: | |
SHOULD_USE_VIEM_SIGNER: ${{ matrix.viem_signer }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Restore node_modules | |
uses: OffchainLabs/actions/node-modules/restore@main | |
- name: Set up the local node | |
uses: OffchainLabs/actions/run-nitro-test-node@main | |
with: | |
no-token-bridge: true | |
- name: Copy .env | |
run: cp ./.env-sample ./.env | |
- name: Build | |
run: | | |
yarn gen:abi | |
yarn build | |
- name: Generate network file | |
run: yarn gen:network | |
- name: Run integration tests | |
run: CI=true yarn test:integration |