Skip to content

refactor: move provider to background thread #3811

refactor: move provider to background thread

refactor: move provider to background thread #3811

Workflow file for this run

name: Run Hardhat tests
on:
push:
branches:
- main
pull_request:
branches:
- "**"
workflow_dispatch:
jobs:
run-hardhat-tests:
name: Run Hardhat tests (${{ matrix.os }}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
# Cap well below GHA's 6h ceiling so a hung mocha test fails fast
# rather than burning a full job slot.
timeout-minutes: 30
# See comment on test-edr-rs in edr-ci.yml re crt-static handling.
env:
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
strategy:
fail-fast: false
matrix:
node: [20]
os: ["macos-15", "ubuntu-24.04", "windows-2025"]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/setup-node
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/setup-rust
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@0631aa6515c7d545823c67cfae7ef4fc7f490154 # v2.81.8
with:
tool: cargo-llvm-cov@0.8.5
- name: Install package
run: pnpm install --frozen-lockfile --prefer-offline
- name: Cache network requests
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
hardhat-tests/test/internal/hardhat-network/provider/.hardhat_node_test_cache
key: hardhat-network-forking-tests-${{ hashFiles('pnpm-lock.yaml') }}
- name: Cache stack trace artifacts
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
hardhat-tests/test/internal/hardhat-network/stack-traces/test-files/artifacts
key: hardhat-network-stack-traces-tests-${{ hashFiles('hardhat-tests/test/internal/hardhat-network/stack-traces/test-files/**/*.sol') }}-${{ hashFiles('hardhat-tests/test/internal/hardhat-network/stack-traces/test-files/**/test.json') }}-${{ hashFiles('hardhat-tests/test/internal/hardhat-network/stack-traces/**/*.ts') }}
- name: Run tests
env:
INFURA_URL: ${{ secrets.INFURA_URL }}
ALCHEMY_URL: ${{ secrets.ALCHEMY_URL }}
DO_NOT_SET_THIS_ENV_VAR____IS_HARDHAT_CI: true
FORCE_COLOR: 3
NODE_OPTIONS: --max-old-space-size=4096
DEBUG: "hardhat:core:hardhat-network:*"
shell: bash
run: |
source <(cargo llvm-cov show-env --sh)
pnpm -C hardhat-tests test
# `--release` included to match `build:dev` compilation flags
cargo llvm-cov report --release --locked --codecov --output-path codecov.json
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
files: codecov.json
name: ${{ matrix.os }}
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
lint-hardhat-tests:
name: Lint Hardhat tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/setup-node
- name: Install package
run: pnpm install --frozen-lockfile --prefer-offline
- name: Build and lint
run: cd hardhat-tests && pnpm lint