diff --git a/.github/workflows/hardhat-chai-matchers-ci.yml b/.github/workflows/hardhat-chai-matchers-ci.yml deleted file mode 100644 index 52a2236333..0000000000 --- a/.github/workflows/hardhat-chai-matchers-ci.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: hardhat-chai-matchers CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-chai-matchers-ci.yml" - - "packages/hardhat-chai-matchers/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-chai-matchers-ci.yml" - - "packages/hardhat-chai-matchers/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-chai-matchers - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-chai-matchers on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - env: - FORCE_COLOR: 3 - run: pnpm test:ci - - test_on_macos: - name: Test hardhat-chai-matchers on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - env: - FORCE_COLOR: 3 - run: pnpm test:ci - - test_on_linux: - name: Test hardhat-chai-matchers on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - env: - FORCE_COLOR: 3 - run: pnpm test:ci diff --git a/.github/workflows/hardhat-ci.yml b/.github/workflows/hardhat-ci.yml new file mode 100644 index 0000000000..c4cec0a8cf --- /dev/null +++ b/.github/workflows/hardhat-ci.yml @@ -0,0 +1,110 @@ +name: CI + +on: + push: + branches: main + paths: + - ".github/workflows/hardhat-ci.yml" + - "packages/**" + - "config/**" + - "pnpm-lock.yaml" + pull_request: + paths: + - ".github/workflows/hardhat-ci.yml" + - "packages/**" + - "config/**" + - "pnpm-lock.yaml" + workflow_dispatch: + +concurrency: + group: ${{github.workflow}}-${{github.ref}} + cancel-in-progress: true + +jobs: + list-packages: + name: List packages + runs-on: ubuntu-latest + outputs: + packages: ${{ steps.filter.outputs.changes }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + - run: yq -p yaml -o json pnpm-lock.yaml | tee pnpm-lock.json + - id: generate + env: + PACKAGE_IGNORE: | + [ + ".", + "v-next/", + "packages/common", + "packages/eslint-plugin-hardhat-internal-rules", + "packages/eslint-plugin-slow-imports", + "packages/hardhat-core" + ] + COMMON_FILTERS: | + [ + ".github/workflows/hardhat-ci.yml", + "config/**", + "packages/common/**", + "pnpm-lock.yaml" + ] + run: | + echo "filters<> $GITHUB_OUTPUT + node scripts/generate-filters.js | + yq -Po yaml 'with_entries(.key |= sub("^packages/", ""))' | + tee -a $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + - id: filter + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + with: + filters: ${{ steps.generate.outputs.filters }} + + ci: + needs: list-packages + + if: needs.list-packages.outputs.packages != '[]' + + strategy: + fail-fast: false + matrix: + package: ${{ fromJson(needs.list-packages.outputs.packages) }} + os: [ubuntu-latest, macos-latest, windows-latest] + node: [18, 20, 22] + exclude: + - package: hardhat-vyper + os: windows-latest + - package: hardhat-vyper + os: macos-latest + - os: windows-latest + node: 20 + - os: macos-latest + node: 20 + - os: windows-latest + node: 22 + - os: macos-latest + node: 22 + + name: "[${{ matrix.package }}] ci on ${{ matrix.os }} (Node ${{ matrix.node }})" + runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: packages/${{ matrix.package }} + + steps: + - uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + cache: "pnpm" + - name: Install dependencies + run: pnpm install --frozen-lockfile --prefer-offline + - name: Build + run: pnpm build + - name: Run tests + run: pnpm run ${{ matrix.package == 'hardhat-chai-matchers' && 'test:ci' || 'test' }} diff --git a/.github/workflows/hardhat-ethers-ci.yml b/.github/workflows/hardhat-ethers-ci.yml deleted file mode 100644 index 808a0139f4..0000000000 --- a/.github/workflows/hardhat-ethers-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: hardhat-ethers CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-ethers-ci.yml" - - "packages/hardhat-ethers/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-ethers-ci.yml" - - "packages/hardhat-ethers/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-ethers - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-ethers on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-ethers on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-ethers on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-foundry-ci.yml b/.github/workflows/hardhat-foundry-ci.yml deleted file mode 100644 index 86bb8a6ee3..0000000000 --- a/.github/workflows/hardhat-foundry-ci.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: hardhat-foundry CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-foundry-ci.yml" - - "packages/hardhat-foundry/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-foundry-ci.yml" - - "packages/hardhat-foundry/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-foundry - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-foundry on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - env: - FORCE_COLOR: 3 - run: pnpm test - - test_on_macos: - name: Test hardhat-foundry on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - env: - FORCE_COLOR: 3 - run: pnpm test - - test_on_linux: - name: Test hardhat-foundry on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - env: - FORCE_COLOR: 3 - run: pnpm test diff --git a/.github/workflows/hardhat-ledger-ci.yml b/.github/workflows/hardhat-ledger-ci.yml deleted file mode 100644 index 4e72ac9119..0000000000 --- a/.github/workflows/hardhat-ledger-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: hardhat-ledger CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-ledger-ci.yml" - - "packages/hardhat-ledger/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-foundry-ci.yml" - - "packages/hardhat-ledger/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-ledger - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-ledger on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-ledger on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-ledger on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-network-helpers-ci.yml b/.github/workflows/hardhat-network-helpers-ci.yml deleted file mode 100644 index b5423d272a..0000000000 --- a/.github/workflows/hardhat-network-helpers-ci.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: hardhat-network-helpers CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-network-helpers-ci.yml" - - "packages/hardhat-core/**" - - "packages/hardhat-network-helpers/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-network-helpers-ci.yml" - - "packages/hardhat-core/**" - - "packages/hardhat-network-helpers/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-network-helpers - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-network-helpers on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - env: - FORCE_COLOR: 3 - run: pnpm test - - test_on_macos: - name: Test hardhat-network-helpers on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - env: - FORCE_COLOR: 3 - run: pnpm test - - test_on_linux: - name: Test hardhat-network-helpers on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - env: - FORCE_COLOR: 3 - run: pnpm test diff --git a/.github/workflows/hardhat-network-tracing-all-solc-versions.yml b/.github/workflows/hardhat-network-tracing-all-solc-versions.yml deleted file mode 100644 index e380ff5078..0000000000 --- a/.github/workflows/hardhat-network-tracing-all-solc-versions.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Hardhat Network Tracing Capabilities, scheduled runs for all solc versions - -on: - schedule: - - cron: "0 0 * * *" # every day at midnight - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-core - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_tracing: - name: Test tracing capabilities on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Cache artifacts - uses: actions/cache@v4 - with: - path: | - packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/artifacts - key: hardhat-network-stack-traces-tests-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/**/*.sol') }}-${{ hashFiles('packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/**/test.json') }}-${{ hashFiles('packages/hardhat-core/test/internal/hardhat-network/stack-traces/**/*.ts') }} - - name: Run tests - env: - DO_NOT_SET_THIS_ENV_VAR____IS_HARDHAT_CI: true - FORCE_COLOR: 3 - NODE_OPTIONS: "--max-old-space-size=4096" - HARDHAT_TESTS_ALL_SOLC_VERSIONS: true - run: pnpm test:tracing diff --git a/.github/workflows/hardhat-shorthand-ci.yml b/.github/workflows/hardhat-shorthand-ci.yml deleted file mode 100644 index 17b43e88e7..0000000000 --- a/.github/workflows/hardhat-shorthand-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: hardhat-shorthand CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-shorthand-ci.yml" - - "packages/hardhat-shorthand/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-shorthand-ci.yml" - - "packages/hardhat-shorthand/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-shorthand - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-shorthand on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-shorthand on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-shorthand on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-solhint-ci.yml b/.github/workflows/hardhat-solhint-ci.yml deleted file mode 100644 index b2b39bb7fb..0000000000 --- a/.github/workflows/hardhat-solhint-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: hardhat-solhint CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-solhint-ci.yml" - - "packages/hardhat-solhint/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-solhint-ci.yml" - - "packages/hardhat-solhint/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-solhint - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-solhint on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-solhint on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-solhint on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-solpp-ci.yml b/.github/workflows/hardhat-solpp-ci.yml deleted file mode 100644 index cc90683445..0000000000 --- a/.github/workflows/hardhat-solpp-ci.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: hardhat-solpp CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-solpp-ci.yml" - - "packages/hardhat-solpp/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-solpp-ci.yml" - - "packages/hardhat-solpp/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-solpp - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_macos: - name: Test hardhat-solpp on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-solpp on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-toolbox-ci.yml b/.github/workflows/hardhat-toolbox-ci.yml deleted file mode 100644 index f607ecfbb5..0000000000 --- a/.github/workflows/hardhat-toolbox-ci.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: hardhat-toolbox CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-toolbox-ci.yml" - - "packages/hardhat-toolbox/**" - - "packages/hardhat-core/**" - - "packages/hardhat-chai-matchers/**" - - "packages/hardhat-network-helpers/**" - - "packages/hardhat-ethers/**" - - "packages/hardhat-verify/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-toolbox-ci.yml" - - "packages/hardhat-toolbox/**" - - "packages/hardhat-core/**" - - "packages/hardhat-chai-matchers/**" - - "packages/hardhat-network-helpers/**" - - "packages/hardhat-ethers/**" - - "packages/hardhat-verify/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-toolbox - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-toolbox on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-toolbox on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-toolbox on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-truffle4-ci.yml b/.github/workflows/hardhat-truffle4-ci.yml deleted file mode 100644 index 3726bb73f0..0000000000 --- a/.github/workflows/hardhat-truffle4-ci.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: hardhat-truffle4 CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-truffle4-ci.yml" - - "packages/hardhat-truffle4/**" - - "packages/hardhat-web3-legacy/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-truffle4-ci.yml" - - "packages/hardhat-truffle4/**" - - "packages/hardhat-web3-legacy/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-truffle4 - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-truffle4 on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-truffle4 on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-truffle4 on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-truffle5-ci.yml b/.github/workflows/hardhat-truffle5-ci.yml deleted file mode 100644 index 7d03424c25..0000000000 --- a/.github/workflows/hardhat-truffle5-ci.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: hardhat-truffle5 CI - -on: - push: - branches: - - main - paths: - - "packages/hardhat-truffle5/**" - - "packages/hardhat-web3/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-truffle5-ci.yml" - - "packages/hardhat-truffle5/**" - - "packages/hardhat-web3/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-truffle5 - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-truffle5 on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-truffle5 on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-truffle5 on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-verify-ci.yml b/.github/workflows/hardhat-verify-ci.yml deleted file mode 100644 index 4b7947db58..0000000000 --- a/.github/workflows/hardhat-verify-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: hardhat-verify CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-verify-ci.yml" - - "packages/hardhat-verify/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-verify-ci.yml" - - "packages/hardhat-verify/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-verify - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-verify on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-verify on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-verify on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-viem-ci.yml b/.github/workflows/hardhat-viem-ci.yml deleted file mode 100644 index d10637ba03..0000000000 --- a/.github/workflows/hardhat-viem-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: hardhat-viem CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-viem-ci.yml" - - "packages/hardhat-viem/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-verify-ci.yml" - - "packages/hardhat-viem/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-viem - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-viem on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-viem on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-viem on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-vyper-ci.yml b/.github/workflows/hardhat-vyper-ci.yml deleted file mode 100644 index 8fa382ee04..0000000000 --- a/.github/workflows/hardhat-vyper-ci.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: hardhat-vyper CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-vyper-ci.yml" - - "packages/hardhat-vyper/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-vyper-ci.yml" - - "packages/hardhat-vyper/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-vyper - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_linux: - name: Test hardhat-vyper on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-web3-ci.yml b/.github/workflows/hardhat-web3-ci.yml deleted file mode 100644 index c656fdfa9a..0000000000 --- a/.github/workflows/hardhat-web3-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: hardhat-web3 CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-web3-ci.yml" - - "packages/hardhat-web3/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-web3-ci.yml" - - "packages/hardhat-web3/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-web3 - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-web3 on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-web3 on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-web3 on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-web3-legacy-ci.yml b/.github/workflows/hardhat-web3-legacy-ci.yml deleted file mode 100644 index 164a856d14..0000000000 --- a/.github/workflows/hardhat-web3-legacy-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: hardhat-web3-legacy CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-web3-legacy-ci.yml" - - "packages/hardhat-web3-legacy/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**/*" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-web3-legacy-ci.yml" - - "packages/hardhat-web3-legacy/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-web3-legacy - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-web3-legacy on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-web3-legacy on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-web3-legacy on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.github/workflows/hardhat-web3-v4-ci.yml b/.github/workflows/hardhat-web3-v4-ci.yml deleted file mode 100644 index b2effc39e7..0000000000 --- a/.github/workflows/hardhat-web3-v4-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: hardhat-web3-v4 CI - -on: - push: - branches: - - main - paths: - - ".github/workflows/hardhat-web3-v4-ci.yml" - - "packages/hardhat-web3-v4/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - paths: - - ".github/workflows/hardhat-web3-v4-ci.yml" - - "packages/hardhat-web3-v4/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - workflow_dispatch: - -defaults: - run: - working-directory: packages/hardhat-web3-v4 - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - test_on_windows: - name: Test hardhat-web3-v4 on Windows with Node 18 - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_macos: - name: Test hardhat-web3-v4 on MacOS with Node 18 - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test - - test_on_linux: - name: Test hardhat-web3-v4 on Ubuntu with Node ${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [18, 20, 22] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-env - with: - node-version: ${{ matrix.node }} - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: Run tests - run: pnpm test diff --git a/.gitignore b/.gitignore index 797af0ccc7..90d8e1e986 100644 --- a/.gitignore +++ b/.gitignore @@ -100,3 +100,6 @@ Brewfile.lock.json # Performance profiling application .clinic + +# Input to scripts/generate-filters.js; generated in CI +pnpm-lock.json diff --git a/scripts/generate-filters.js b/scripts/generate-filters.js new file mode 100644 index 0000000000..8218059b29 --- /dev/null +++ b/scripts/generate-filters.js @@ -0,0 +1,76 @@ +// @ts-check +/** + * This script generates filters for https://github.com/dorny/paths-filter + * + * It is used in CI to find all the packages which have been modified or + * have a dependency (including transitive) that has been modified. + * + * This enables running checks only for the packages affected by the changes. + */ +const fs = require("fs"); +const path = require("path"); + +function main() { + const packageIgnore = JSON.parse(process.env.PACKAGE_IGNORE || "[]"); + const commonFilters = JSON.parse(process.env.COMMON_FILTERS || "[]"); + + const pnpmLockfilePath = path.join(__dirname, "..", "pnpm-lock.json"); + if (!fs.existsSync(pnpmLockfilePath)) { + console.warn( + `${pnpmLockfilePath} doesn't exist, please run: yq -p yaml -o json pnpm-lock.yaml | tee pnpm-lock.json` + ); + process.exit(1); + } + + const pnpmLockfile = JSON.parse(fs.readFileSync(pnpmLockfilePath, "utf8")); + + // Find all direct internal dependencies for all packages + const internalDependenciesMap = {}; + for (const [package, allDependencies] of Object.entries( + pnpmLockfile.importers + )) { + const internalDependencies = Object.values(allDependencies) + .flatMap((dependencies) => Object.values(dependencies)) + .map((dependency) => dependency.version) + .filter((version) => version.startsWith("link:")) + .map((version) => version.replace("link:", "")) + .map((version) => path.join(package, version)); + internalDependenciesMap[package] = internalDependencies; + } + + // Add transitive internal dependencies + for (const dependencies of Object.values(internalDependenciesMap)) { + const dependencyQueue = [...dependencies]; + while (dependencyQueue.length !== 0) { + const dependency = dependencyQueue.pop(); + for (const transitiveDependency of internalDependenciesMap[dependency]) { + if (!dependencies.includes(transitiveDependency)) { + dependencies.push(transitiveDependency); + dependencyQueue.push(transitiveDependency); + } + } + } + } + + // Generate filters + const filters = {}; + for (const [package, dependencies] of Object.entries( + internalDependenciesMap + )) { + // Ignore packages that start with one of the prefixes in PACKAGE_IGNORE + if (packageIgnore.some((prefix) => package.startsWith(prefix))) { + continue; + } + // Calculate glob patterns for the package and its dependencies + const packageFilters = [package, ...dependencies].map((dependency) => + path.join(dependency, "**") + ); + // Set filters for the package + filters[package] = [...commonFilters, ...packageFilters]; + } + + // Pretty print the filters + console.log(JSON.stringify(filters, null, 2)); +} + +main();