Skip to content

Add hardhat

Add hardhat #78

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
hardhat-check:
runs-on: ubuntu-latest
env:
FOUNDRY_PROFILE: hardhat
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: pnpm/action-setup@v4
with:
run_install: true
- name: Run hardhat tests
run: pnpm hardhat test
foundry-check:
strategy:
fail-fast: true
matrix:
foundry_profile: ["via-ir", "no-ir"]
name: Foundry project
runs-on: ubuntu-latest
env:
FOUNDRY_PROFILE: test-${{ matrix.foundry_profile }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Show Forge version
run: |
forge --version
- name: Run Forge build
run: |
forge build --sizes
id: build
# This `forge snapshot` command is only used for CBORDecoder comparison.
# https://book.getfoundry.sh/forge/gas-section-snapshots
- name: Confirm comparison snapshot
run: |
forge snapshot --check snapshots/${{ matrix.foundry_profile }}/comparison.gas-snapshot \
--match-path "test/comparison/*"
id: comparison-snapshot
- name: Run remaining Forge tests, confirm section snapshots
run: |
forge test -vvv \
--no-match-path "test/comparison/*"
git diff --exit-code snapshots/${{ matrix.foundry_profile }}
id: test
# Coverage testing affects gas cost, and creates different snapshots.
# Only `lcov.info` is diffed to confirm coverage is checked in. Coverage
# doesn't use the 'comparison' tests.
- name: Confirm coverage
run: |
forge coverage --report-file coverage/lcov.info \
--report lcov --report summary \
--no-match-path "test/comparison/*" \
--no-match-coverage "test/comparison/*"
git diff --exit-code coverage/lcov.info
id: diff-coverage