Repository navigation
Update hh ledger #2737
This file contains hidden or 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: CI | |
| on: | |
| merge_group: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{github.workflow}}-${{github.ref}} | |
| cancel-in-progress: true | |
| jobs: | |
| is-v3: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_v3: ${{ steps.check.outputs.version_starts_with_3 }} | |
| scripts_changed: ${{ steps.scripts-filter.outputs.scripts }} | |
| workflows_changed: ${{ steps.scripts-filter.outputs.workflows }} | |
| solx_mirror_changed: ${{ steps.scripts-filter.outputs.solx_mirror }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Check if we are in v3 | |
| id: check | |
| run: | | |
| if jq -e '.version | startswith("3")' packages/hardhat/package.json > /dev/null; then | |
| echo "version_starts_with_3=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "version_starts_with_3=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Check if scripts or workflows have changed | |
| id: scripts-filter | |
| uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 | |
| with: | |
| filters: | | |
| scripts: | |
| - 'scripts/**' | |
| workflows: | |
| - '.github/scripts/**' | |
| - '.github/workflows/**' | |
| - '.github/actions/**' | |
| solx_mirror: | |
| - 'packages/hardhat-slang-solx/src/internal/constants.ts' | |
| - 'packages/hardhat-slang-solx/src/internal/platform.ts' | |
| - 'packages/hardhat-slang-solx/test/mirror-availability.ts' | |
| check_dependencies: | |
| name: Check dependency versions | |
| needs: is-v3 | |
| if: ${{ needs.is-v3.outputs.is_v3 == 'true' }} | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24 | |
| - name: Run check | |
| run: node scripts/check-dependencies.ts | |
| check_npm_scripts: | |
| name: Check that the npm scripts are consistent | |
| needs: is-v3 | |
| if: ${{ needs.is-v3.outputs.is_v3 == 'true' }} | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24 | |
| - name: Run check | |
| run: node scripts/check-npm-scripts.ts | |
| check_renovate_config: | |
| name: Check Renovate config | |
| needs: is-v3 | |
| if: ${{ needs.is-v3.outputs.is_v3 == 'true' }} | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| env: | |
| # renovate: datasource=npm depName=renovate | |
| RENOVATE_VERSION: "44.115.13" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24 | |
| - name: Renovate schema check | |
| run: npx --yes --package "renovate@${RENOVATE_VERSION}" -- renovate-config-validator renovate.json | |
| - name: Renovate extraction dry-run | |
| env: | |
| # Without a token, github-tags/github-releases lookups hit the | |
| # anonymous 60 req/hr rate limit shared across the runner IP. | |
| GITHUB_COM_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| LOG_LEVEL: debug | |
| run: npx --yes "renovate@${RENOVATE_VERSION}" --platform=local --dry-run=full | |
| check_infra_scripts_tests: | |
| name: Check that infrastructure script tests pass | |
| needs: is-v3 | |
| if: ${{ needs.is-v3.outputs.is_v3 == 'true' && (needs.is-v3.outputs.scripts_changed == 'true' || needs.is-v3.outputs.workflows_changed == 'true') }} | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: ./.github/actions/setup-env | |
| with: | |
| node-version: 24 | |
| - name: Install root dependencies | |
| run: pnpm install -w --frozen-lockfile --prefer-offline | |
| - name: Lint scripts | |
| run: pnpm lint:scripts | |
| - name: Run check | |
| run: pnpm test:scripts | |
| - name: Lint workflows | |
| run: pnpm lint:workflows | |
| - name: Run workflow script tests | |
| run: pnpm test:workflows | |
| solx-mirror-availability: | |
| name: Check solx releases mirror availability | |
| needs: is-v3 | |
| # Network check against an external service: only run when the version map | |
| # or the check itself changes, not on every PR that rebuilds hardhat-slang-solx. | |
| if: ${{ needs.is-v3.outputs.is_v3 == 'true' && needs.is-v3.outputs.solx_mirror_changed == 'true' }} | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: packages/hardhat-slang-solx | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: ./.github/actions/setup-env | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --prefer-offline | |
| - name: Build | |
| run: pnpm build | |
| - name: Check mirror availability | |
| env: | |
| HARDHAT_RUN_MIRROR_TESTS: true | |
| run: node --import tsx/esm --test --test-reporter=@nomicfoundation/hardhat-node-test-reporter test/mirror-availability.ts | |
| list-packages: | |
| name: List packages | |
| needs: is-v3 | |
| if: ${{ needs.is-v3.outputs.is_v3 == 'true' }} | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| outputs: | |
| packages: ${{ steps.filter.outputs.changes }} | |
| should_bundle: ${{ contains(steps.filter.outputs.hardhat_files, '.github/workflows/ci.yml') || contains(steps.filter.outputs.hardhat_files, 'pnpm-lock.yaml') }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 24 | |
| - run: yq -p yaml -o json 'select(has("settings"))' pnpm-lock.yaml | tee pnpm-lock.json | |
| - id: generate | |
| env: | |
| PACKAGE_IGNORE: | | |
| [ | |
| ".", | |
| "packages/hardhat/templates/" | |
| ] | |
| COMMON_FILTERS: | | |
| [ | |
| ".github/workflows/ci.yml", | |
| ".github/actions/setup-env/**", | |
| "packages/config/**", | |
| "pnpm-lock.yaml" | |
| ] | |
| run: | | |
| echo "filters<<EOF" >> $GITHUB_OUTPUT | |
| node scripts/generate-filters.ts | | |
| yq -Po yaml 'with_entries(.key |= sub("^packages/", ""))' | | |
| tee -a $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - id: filter | |
| uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 | |
| with: | |
| list-files: json | |
| filters: ${{ steps.generate.outputs.filters }} | |
| bundle: | |
| # Depending on list-packages only to check whether pnpm-lock.yaml has changed | |
| # This could be handled by a simpler job, but an extra runner would have to be allocated for it | |
| needs: list-packages | |
| if: needs.list-packages.outputs.should_bundle == 'true' | |
| # Using a matrix strategy even though there's only one package | |
| # because we will want to add, at least, hardhat-toolbox in the future | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: ["hardhat"] | |
| name: "[${{ matrix.package }}] bundle" | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: packages/${{ matrix.package }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: ./.github/actions/setup-env | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --prefer-offline | |
| - name: Build | |
| run: pnpm build | |
| - name: Deploy | |
| run: | | |
| pnpm deploy --config.shamefully-hoist=true --config.hoist=true --config.node-linker=true --config.shared-workspace-lockfile=false --filter="$(jq -r .name package.json)" --prod --no-optional bundle | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ${{ matrix.package }} | |
| path: | | |
| packages/${{ matrix.package }}/bundle | |
| bundle-aggregate: | |
| needs: bundle | |
| if: ${{ !cancelled() }} | |
| name: bundle | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - env: | |
| result: ${{ needs.bundle.result }} | |
| run: | | |
| if [[ "$result" == "failure" ]]; then | |
| exit 1 | |
| fi | |
| shell: bash | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| if: needs.bundle.result == 'success' | |
| with: | |
| name: hardhat | |
| path: bundles/hardhat | |
| - id: download | |
| run: mkdir -p bundles && ls -1 bundles | wc -l | xargs -I {} -0 echo "count={}" | tee -a $GITHUB_OUTPUT | |
| shell: bash | |
| - id: comment | |
| if: steps.download.outputs.count != '0' | |
| working-directory: bundles | |
| run: | | |
| echo 'body<<EOF' >> $GITHUB_OUTPUT | |
| for bundle in *; do | |
| echo "# $bundle" | tee -a $GITHUB_OUTPUT | |
| echo '' | tee -a $GITHUB_OUTPUT | |
| echo "Total size of the bundle: "'`'"$(du -sh $bundle --exclude=$bundle/node_modules/.pnpm | cut -f1)"'`' | tee -a $GITHUB_OUTPUT | |
| echo "Total number of dependencies (including transitive): "'`'"$(find $bundle/node_modules/@* $bundle/node_modules -mindepth 1 -maxdepth 1 -type d ! -name '.*' ! -name '@*' | wc -l)"'`' | tee -a $GITHUB_OUTPUT | |
| echo '' | tee -a $GITHUB_OUTPUT | |
| echo '<details>' | tee -a $GITHUB_OUTPUT | |
| echo '<summary>List of dependencies (sorted by size)</summary>' | tee -a $GITHUB_OUTPUT | |
| echo '' | tee -a $GITHUB_OUTPUT | |
| echo '```' | tee -a $GITHUB_OUTPUT | |
| du -shc $bundle/node_modules/@*/* $bundle/node_modules/* | | |
| grep -Ev '/node_modules/@[^/]+$' | sort -rh | | |
| sed "s|$bundle/node_modules/||" | tee -a $GITHUB_OUTPUT | |
| echo '```' | tee -a $GITHUB_OUTPUT | |
| echo '</details>' | tee -a $GITHUB_OUTPUT | |
| echo '' | tee -a $GITHUB_OUTPUT | |
| done | |
| echo 'EOF' >> $GITHUB_OUTPUT | |
| - if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name && steps.download.outputs.count != '0' | |
| uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5 | |
| with: | |
| header: bundle | |
| message: ${{ steps.comment.outputs.body }} | |
| lint: | |
| needs: list-packages | |
| if: needs.list-packages.outputs.packages != '[]' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: ${{ fromJson(needs.list-packages.outputs.packages) }} | |
| name: "[${{ matrix.package }}] lint" | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: packages/${{ matrix.package }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: ./.github/actions/setup-env | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --prefer-offline | |
| - name: Build | |
| run: pnpm run --if-present build | |
| - name: Lint | |
| run: pnpm run --if-present lint | |
| lint-aggregate: | |
| needs: lint | |
| if: ${{ !cancelled() }} | |
| name: lint | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - env: | |
| result: ${{ needs.lint.result }} | |
| run: | | |
| if [[ "$result" == "failure" ]]; then | |
| exit 1 | |
| fi | |
| shell: bash | |
| 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, ubuntu-24.04-arm, macos-latest, windows-latest] | |
| node: [22.13.0, 24.0.0, 26.0.0] | |
| exclude: | |
| - package: hardhat-node-test-reporter | |
| - os: ubuntu-24.04-arm | |
| node: 24.0.0 | |
| - os: macos-latest | |
| node: 24.0.0 | |
| - os: windows-latest | |
| node: 24.0.0 | |
| - os: ubuntu-24.04-arm | |
| node: 26.0.0 | |
| - os: macos-latest | |
| node: 26.0.0 | |
| - os: windows-latest | |
| node: 26.0.0 | |
| name: "[${{ matrix.package }}] ci on ${{ matrix.os }} (Node ${{ matrix.node }})" | |
| timeout-minutes: 60 | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| working-directory: packages/${{ matrix.package }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: ./.github/actions/setup-env | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --prefer-offline | |
| - name: Build | |
| run: pnpm run --if-present build | |
| # The hardhat package's template tests spawn `pnpm hardhat` inside template | |
| # projects that depend on other workspace packages (e.g. the toolboxes), | |
| # which `pnpm run build` (the package under test) doesn't build. Build the | |
| # whole workspace so those dependencies are available to the templates. | |
| - name: Build all workspace packages | |
| if: matrix.package == 'hardhat' | |
| run: pnpm -r build | |
| # pnpm 11 skips creating bin symlinks whose target doesn't exist yet, so | |
| # workspace CLIs (e.g. hardhat) built after install have no bin until we | |
| # relink them once the build output exists. See pnpm/pnpm#10524. | |
| - name: Recreate workspace bin links | |
| run: pnpm rebuild -r | |
| - name: Run tests | |
| env: | |
| __DO_NOT_USE_IS_HARDHAT_CI: true | |
| run: pnpm run --if-present test | |
| ci-aggregate: | |
| needs: [ci, hardhat-node-test-reporter, hardhat-ethers-chai-v5-matchers] | |
| if: ${{ !cancelled() }} | |
| name: ci | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - env: | |
| ci_result: ${{ needs.ci.result }} | |
| reporter_result: ${{ needs.hardhat-node-test-reporter.result }} | |
| chai_v5_result: ${{ needs.hardhat-ethers-chai-v5-matchers.result }} | |
| run: | | |
| if [[ "$ci_result" == "failure" || "$reporter_result" == "failure" || "$chai_v5_result" == "failure" ]]; then | |
| exit 1 | |
| fi | |
| shell: bash | |
| hardhat-node-test-reporter: | |
| needs: list-packages | |
| if: contains(fromJson(needs.list-packages.outputs.packages), 'hardhat-node-test-reporter') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] | |
| # We run the tests for `hardhat-node-test-reporter` with the latest | |
| # versions of Node (the testing output relying on recent changes) | |
| node: [22, 24, 26] | |
| exclude: | |
| - os: ubuntu-24.04-arm | |
| node: 24 | |
| - os: macos-latest | |
| node: 24 | |
| - os: windows-latest | |
| node: 24 | |
| - os: ubuntu-24.04-arm | |
| node: 26 | |
| - os: macos-latest | |
| node: 26 | |
| - os: windows-latest | |
| node: 26 | |
| name: "[hardhat-node-test-reporter] ci on ${{ matrix.os }} (Node ${{ matrix.node }})" | |
| timeout-minutes: 60 | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| working-directory: packages/hardhat-node-test-reporter | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: ./.github/actions/setup-env | |
| with: | |
| node-version: ${{ matrix.node }} | |
| # The fixtures capture `node:test`'s exact output, which changes in | |
| # patch releases, so we need the newest release of each major rather | |
| # than whichever one the runner image happens to have cached. | |
| check-latest: true | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --prefer-offline | |
| - name: Build | |
| run: pnpm run --if-present build | |
| # pnpm 11 skips creating bin symlinks whose target doesn't exist yet, so | |
| # workspace CLIs (e.g. hardhat) built after install have no bin until we | |
| # relink them once the build output exists. See pnpm/pnpm#10524. | |
| - name: Recreate workspace bin links | |
| run: pnpm rebuild -r | |
| - name: Run tests | |
| env: | |
| __DO_NOT_USE_IS_HARDHAT_CI: true | |
| run: pnpm run --if-present test | |
| ## We run this extra job to make sure that the hardhat-ethers-chai-matchers plugin can still | |
| ## work with chai v5. | |
| hardhat-ethers-chai-v5-matchers: | |
| needs: list-packages | |
| if: contains(fromJson(needs.list-packages.outputs.packages), 'hardhat-ethers-chai-matchers') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] | |
| node: [22.13.0, 24.0.0, 26.0.0] | |
| exclude: | |
| - os: ubuntu-24.04-arm | |
| node: 24.0.0 | |
| - os: macos-latest | |
| node: 24.0.0 | |
| - os: windows-latest | |
| node: 24.0.0 | |
| - os: ubuntu-24.04-arm | |
| node: 26.0.0 | |
| - os: macos-latest | |
| node: 26.0.0 | |
| - os: windows-latest | |
| node: 26.0.0 | |
| name: "[hardhat-ethers-chai-v5-matchers] ci on ${{ matrix.os }} (Node ${{ matrix.node }})" | |
| timeout-minutes: 60 | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| working-directory: packages/hardhat-ethers-chai-matchers | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: ./.github/actions/setup-env | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --prefer-offline | |
| - name: Install chai v5 | |
| run: | | |
| pnpm add --save-dev "chai@^5.1.2" "@types/chai@^4.3.0" | |
| pnpm ls | |
| - name: Build | |
| run: pnpm run --if-present build | |
| # pnpm 11 skips creating bin symlinks whose target doesn't exist yet, so | |
| # workspace CLIs (e.g. hardhat) built after install have no bin until we | |
| # relink them once the build output exists. See pnpm/pnpm#10524. | |
| - name: Recreate workspace bin links | |
| run: pnpm rebuild -r | |
| - name: Run tests | |
| env: | |
| __DO_NOT_USE_IS_HARDHAT_CI: true | |
| run: pnpm run --if-present test |