diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml new file mode 100644 index 0000000000..27b621aa61 --- /dev/null +++ b/.github/actions/setup-env/action.yml @@ -0,0 +1,60 @@ +name: Setup env +description: Sets up node and pnpm + +inputs: + pnpm-version: + description: Version of pnpm to install + required: false + default: "9" + node-version: + description: Version of node to install + required: false + default: "18" + cache-restore: + description: Whether to restore the pnpm cache + required: false + default: "true" + cache-save: + description: Whether to save the pnpm cache + required: false + default: "false" + pnpm-lockfile: + description: Path to the pnpm lockfile + required: false + default: "pnpm-lock.yaml" + package-json: + description: Path to the package.json file + required: false + default: "package.json" +outputs: + cache-hit: + description: Whether the cache was restored + value: ${{ steps.node.outputs.cache-hit }} + +runs: + using: composite + steps: + - if: inputs.cache-save == 'true' && inputs.cache-restore == 'false' + run: | + echo "::error::Saving the cache without restoring it is not supported" + exit 1 + shell: bash + - uses: pnpm/action-setup@v4 + with: + version: ${{ inputs.pnpm-version }} + package_json_file: ${{ inputs.package-json }} + - uses: actions/setup-node@v4 + id: node + with: + node-version: ${{ inputs.node-version }} + cache: ${{ inputs.cache-save == 'true' && 'pnpm' || '' }} + cache-dependency-path: ${{ inputs.pnpm-lockfile }} + - id: pnpm + if: inputs.cache-save == 'false' && inputs.cache-restore == 'true' + run: pnpm store path --silent | xargs -I {} -0 echo "path={}" | tee -a $GITHUB_OUTPUT + shell: bash + - uses: actions/cache/restore@v4 + if: inputs.cache-save == 'false' && inputs.cache-restore == 'true' + with: + path: ${{ steps.pnpm.outputs.path }} + key: node-cache-${{ runner.os }}-pnpm-${{ hashFiles(inputs.pnpm-lockfile) }} diff --git a/.github/workflows/LATEST_DEPENDENCY_VERSIONS.yml b/.github/workflows/LATEST_DEPENDENCY_VERSIONS.yml index f5e4b8a397..fcdf19ce3a 100644 --- a/.github/workflows/LATEST_DEPENDENCY_VERSIONS.yml +++ b/.github/workflows/LATEST_DEPENDENCY_VERSIONS.yml @@ -14,13 +14,7 @@ jobs: runs-on: ${{ matrix.system }} steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" + - uses: ./.github/actions/setup-env - name: Delete pnpm-lock.yaml run: "rm pnpm-lock.yaml" - name: Install @@ -34,7 +28,7 @@ jobs: run: pnpm test || (echo "===== Retry =====" && pnpm test) - name: Notify failures if: failure() - uses: slackapi/slack-github-action@v1.18.0 + uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0 with: payload: | { diff --git a/.github/workflows/add-issue-to-project.yml b/.github/workflows/add-issue-to-project.yml index 5ab3e0b2db..ac10331829 100644 --- a/.github/workflows/add-issue-to-project.yml +++ b/.github/workflows/add-issue-to-project.yml @@ -10,7 +10,7 @@ jobs: add-to-project: runs-on: ubuntu-latest steps: - - uses: actions/add-to-project@v0.4.0 + - uses: actions/add-to-project@9bfe908f2eaa7ba10340b31e314148fcfe6a2458 # v1.0.1 with: project-url: https://github.com/orgs/NomicFoundation/projects/4 github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} diff --git a/.github/workflows/add-label-to-new-issue.yml b/.github/workflows/add-label-to-new-issue.yml index a6c6c5345d..2bd47099b5 100644 --- a/.github/workflows/add-label-to-new-issue.yml +++ b/.github/workflows/add-label-to-new-issue.yml @@ -13,7 +13,7 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: script: | const issue = await github.rest.issues.get({ diff --git a/.github/workflows/autoassign-issues.yml b/.github/workflows/autoassign-issues.yml index efd4be5620..318b21074a 100644 --- a/.github/workflows/autoassign-issues.yml +++ b/.github/workflows/autoassign-issues.yml @@ -10,7 +10,7 @@ jobs: permissions: issues: write steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: script: | // each user has a chance of (p - (previousP ?? 0)) to be assigned diff --git a/.github/workflows/autoassign-prs.yml b/.github/workflows/autoassign-prs.yml index df5441a02f..f98c9f4f09 100644 --- a/.github/workflows/autoassign-prs.yml +++ b/.github/workflows/autoassign-prs.yml @@ -10,7 +10,7 @@ jobs: permissions: pull-requests: write steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: script: | const externalPrTriager = "kanej"; diff --git a/.github/workflows/check-changeset-added.yml b/.github/workflows/check-changeset-added.yml index 475fd48ec5..143e1adb39 100644 --- a/.github/workflows/check-changeset-added.yml +++ b/.github/workflows/check-changeset-added.yml @@ -21,7 +21,7 @@ jobs: # don't run this check in the changesets PR if: github.head_ref != 'changeset-release/main' steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: script: | const pullNumber = context.issue.number; diff --git a/.github/workflows/check-docs-site.yml b/.github/workflows/check-docs-site.yml index 3f4af679cb..635259b94a 100644 --- a/.github/workflows/check-docs-site.yml +++ b/.github/workflows/check-docs-site.yml @@ -3,7 +3,8 @@ name: Check Docs Site on: push: branches: - - "**" + - main + pull_request: workflow_dispatch: concurrency: @@ -11,23 +12,19 @@ concurrency: cancel-in-progress: true jobs: - lint: - name: Lint + build: + name: Build runs-on: ubuntu-latest + defaults: + run: + working-directory: docs steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 + - uses: ./.github/actions/setup-env with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline + pnpm-lockfile: docs/pnpm-lock.yaml + package-json: docs/package.json - name: Install Docs - run: cd docs && pnpm install --frozen-lockfile --prefer-offline - - name: lint - run: cd docs && pnpm lint + run: pnpm install --frozen-lockfile --prefer-offline - name: Build - run: cd docs && pnpm build + run: pnpm build diff --git a/.github/workflows/comment-on-linter-error.yml b/.github/workflows/comment-on-linter-error.yml deleted file mode 100644 index 79a8036e0d..0000000000 --- a/.github/workflows/comment-on-linter-error.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Comment on lint failure - -on: - pull_request_target: - types: - - opened - branches: - - $default-branch - -concurrency: - group: ${{github.workflow}}-${{github.ref}} - cancel-in-progress: true - -jobs: - comment_on_lint_failure: - name: Comment on lint failure - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - ref: "refs/pull/${{ github.event.number }}/merge" - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Build - run: pnpm build - - name: lint - run: pnpm lint - - name: Check dependency versions - run: node scripts/check-dependencies.js - - name: Install website - working-directory: docs/ - run: pnpm install --frozen-lockfile --prefer-offline - - name: Lint website - working-directory: docs/ - run: pnpm lint - - uses: actions/github-script@v6 - name: Comment on failure - if: ${{ failure() }} - with: - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: "Thanks for submitting this PR!\n\nUnfortunately, it has some linter errors, so we can't merge it yet. Can you please fix them?\n\nRunning pnpm lint:fix in the root of the repository may fix them automatically." - }) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 08f1e47d12..70435495df 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -3,10 +3,8 @@ name: E2E tests on: push: branches: - - "main" + - main pull_request: - branches: - - "main" jobs: run-e2e: @@ -29,12 +27,10 @@ jobs: IS_WINDOWS: ${{ matrix.os == 'windows-latest' }} steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 + - uses: ./.github/actions/setup-env with: - node-version: 18 + pnpm-lockfile: docs/pnpm-lock.yaml + package-json: docs/package.json - name: Run fixture-projects script run: | cd e2e diff --git a/.github/workflows/hardhat-chai-matchers-ci.yml b/.github/workflows/hardhat-chai-matchers-ci.yml deleted file mode 100644 index 8a8c3383e4..0000000000 --- a/.github/workflows/hardhat-chai-matchers-ci.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: hardhat-chai-matchers CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-chai-matchers/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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..0080d5e25a --- /dev/null +++ b/.github/workflows/hardhat-ci.yml @@ -0,0 +1,164 @@ +name: hardhat CI + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +concurrency: + group: ${{github.workflow}}-${{github.ref}} + cancel-in-progress: true + +jobs: + packages: + name: Find packages to test + runs-on: ubuntu-latest + outputs: + packages: ${{ steps.packages.outputs.result }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Fetch files modified in push event + if: github.event_name == 'push' + env: + BEFORE: ${{ github.event.before }} + AFTER: ${{ github.event.after }} + run: git diff --name-only $BEFORE $AFTER | tee files.txt + - name: Parse pnpm lock file + run: yq -p yaml -o json pnpm-lock.yaml | tee pnpm-lock.json + - uses: actions/github-script@v7 + name: Find packages to test + id: packages + env: + EXCLUDED_PACKAGES: | + . + packages/hardhat-core + packages/common + packages/eslint-plugin-hardhat-internal-rules + packages/eslint-plugin-slow-imports + COMMON_DEPENDENCIES: | + packages/common + config + WORKFLOW_FILE: .github/workflows/hardhat-ci.yml + with: + script: | + const fs = require('fs'); + + const excludedPackages = process.env.EXCLUDED_PACKAGES.split('\n').filter(p => p); + const commonDependencies = process.env.COMMON_DEPENDENCIES.split('\n').filter(p => p); + const workflowFile = process.env.WORKFLOW_FILE; + + const event = context.eventName; + const modifiedFiles = []; + + if (event === 'pull_request') { + core.info('This is a pull request event') + const pullNumber = context.issue.number; + + core.info(`Fetching files for pull request #${pullNumber}`); + const files = await github.paginate(github.rest.pulls.listFiles, { + ...context.issue, + pull_number: pullNumber + }); + modifiedFiles.push(...files.map(file => file.filename)); + core.info(`Modified files: ${JSON.stringify(modifiedFiles)}`); + } else if (event === 'push') { + core.info('This is a push event') + core.info(`Fetching files modified between ${context.payload.before} and ${context.payload.after}`) + const files = fs.readFileSync('files.txt', 'utf8').split('\n').filter(f => f); + modifiedFiles.push(...files); + core.info(`Modified files: ${JSON.stringify(modifiedFiles)}`); + } + + core.info('Checking if workflow file was modified') + const isWorkflowFileModified = modifiedFiles.includes(workflowFile); + core.info(`Workflow file was modified: ${isWorkflowFileModified}`) + + core.info('Reading pnpm lock file') + const lock = JSON.parse(fs.readFileSync('pnpm-lock.json', 'utf8')); + const packagesToTest = []; + + core.info('Finding packages to test') + for (const [package, dependencies] of Object.entries(lock.importers)) { + core.info(`Checking package ${package}`) + + if (excludedPackages.includes(package)) { + core.info(`Package ${package} is excluded, skipping`) + continue; + } + + if (event === 'workflow_dispatch' || isWorkflowFileModified) { + core.info(`Workflow was dispatched or workflow file was modified, testing package ${package}`) + packagesToTest.push(package); + continue; + } + + core.info(`Finding internal dependencies for package ${package} (only direct; not transitive)`) + const internalDependencies = Object.values(dependencies) + .flatMap(d => Object.values(d)) + .map(d => d.version) + .filter(dependency => dependency.startsWith('link:../')) + .map(dependency => dependency.replace('link:../', 'packages/')); + core.info(`Internal dependencies for package ${package}: ${JSON.stringify(internalDependencies)}`) + + core.info(`Checking if package ${package} or its internal dependencies were modified`) + const prefixes = [ + package, + ...internalDependencies, + ...commonDependencies, + ].map(p => `${p}/`); + const isPackageModified = prefixes.some(p => modifiedFiles.some(f => f.startsWith(p))); + core.info(`Package ${package} or its internal dependencies were modified: ${isPackageModified}`) + + if (isPackageModified) { + core.info(`Package ${package} or its internal dependencies were modified, testing package ${package}`) + packagesToTest.push(package); + } + } + + core.info(`Packages to test: ${JSON.stringify(packagesToTest)}`) + + return packagesToTest.map(p => p.replace('packages/', '')); + test: + needs: [packages] + name: Test ${{ matrix.package }} on ${{ matrix.runner }} with Node ${{ matrix.node_version }} + runs-on: ${{ matrix.runner }} + if: needs.packages.outputs.packages != '[]' + strategy: + fail-fast: false + matrix: + package: ${{ fromJSON(needs.packages.outputs.packages) }} + runner: [windows-latest, macos-latest, ubuntu-latest] + node_version: [18, 20, 22] + exclude: + - package: hardhat-vyper + runner: windows-latest + - package: hardhat-vyper + runner: macos-latest + - runner: windows-latest + node_version: 20 + - runner: macos-latest + node_version: 20 + - runner: windows-latest + node_version: 22 + - runner: macos-latest + node_version: 22 + defaults: + run: + working-directory: packages/${{ matrix.package }} + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-env + with: + node-version: ${{ matrix.node_version }} + - name: Install + run: pnpm install --frozen-lockfile --prefer-offline + - name: Build + run: pnpm build + - name: Run tests + env: + FORCE_COLOR: 3 + run: pnpm ${{ matrix.package == 'hardhat-chai-matchers' && 'test:ci' || 'test' }} diff --git a/.github/workflows/hardhat-core-ci.yml b/.github/workflows/hardhat-core-ci.yml index a3394316b2..ec018487a7 100644 --- a/.github/workflows/hardhat-core-ci.yml +++ b/.github/workflows/hardhat-core-ci.yml @@ -12,8 +12,6 @@ on: - "packages/hardhat-core/**" - "packages/hardhat-common/**" pull_request: - branches: - - "**" paths: - ".github/workflows/hardhat-core-ci.yml" - "config/**" @@ -39,16 +37,11 @@ jobs: node: [18.15] os: ["macos-13", "ubuntu-latest", "windows-latest"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - name: Install Node - uses: actions/setup-node@v4 + - uses: ./.github/actions/setup-env with: node-version: ${{ matrix.node }} - cache: pnpm - name: Install package run: pnpm install --frozen-lockfile --prefer-offline @@ -81,22 +74,17 @@ jobs: node: [18.15] os: ["macos-13", "ubuntu-latest", "windows-latest"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - name: Install Node - uses: actions/setup-node@v4 + - uses: ./.github/actions/setup-env with: node-version: ${{ matrix.node }} - cache: pnpm - name: Install package run: pnpm install --frozen-lockfile --prefer-offline - name: Cache EDR RPC cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | packages/hardhat-core/test/internal/hardhat-network/edr-cache @@ -123,13 +111,9 @@ jobs: node: [18, 20] steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 + - uses: ./.github/actions/setup-env with: node-version: ${{ matrix.node }} - cache: pnpm - name: Install run: pnpm install --frozen-lockfile --prefer-offline - name: Install @types/node diff --git a/.github/workflows/hardhat-ethers-ci.yml b/.github/workflows/hardhat-ethers-ci.yml deleted file mode 100644 index ed6bc1a7bb..0000000000 --- a/.github/workflows/hardhat-ethers-ci.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: hardhat-ethers CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-ethers/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 7d5eb8c5c9..0000000000 --- a/.github/workflows/hardhat-foundry-ci.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: hardhat-foundry CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-foundry/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 095739e069..0000000000 --- a/.github/workflows/hardhat-ledger-ci.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: hardhat-ledger CI - -on: - push: - branches: - - main - paths: - - "packages/hardhat-ledger/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 cf565d7f56..0000000000 --- a/.github/workflows/hardhat-network-helpers-ci.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: hardhat-network-helpers CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-core/**" - - "packages/hardhat-network-helpers/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 index 1dde30263f..e380ff5078 100644 --- a/.github/workflows/hardhat-network-tracing-all-solc-versions.yml +++ b/.github/workflows/hardhat-network-tracing-all-solc-versions.yml @@ -22,19 +22,15 @@ jobs: node: [18, 20, 22] steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 + - uses: ./.github/actions/setup-env with: node-version: ${{ matrix.node }} - cache: "pnpm" - name: Install run: pnpm install --frozen-lockfile --prefer-offline - name: Build run: pnpm build - name: Cache artifacts - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/artifacts diff --git a/.github/workflows/hardhat-shorthand-ci.yml b/.github/workflows/hardhat-shorthand-ci.yml deleted file mode 100644 index 7801a82cbe..0000000000 --- a/.github/workflows/hardhat-shorthand-ci.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: hardhat-shorthand CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-shorthand/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 ec06a1a480..0000000000 --- a/.github/workflows/hardhat-solhint-ci.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: hardhat-solhint CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-solhint/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 2709a47215..0000000000 --- a/.github/workflows/hardhat-solpp-ci.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: hardhat-solpp CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-solpp/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 83e9613128..0000000000 --- a/.github/workflows/hardhat-toolbox-ci.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: hardhat-toolbox CI - -on: - push: - branches: [$default-branch] - paths: - - "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: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 f813ca4ccd..0000000000 --- a/.github/workflows/hardhat-truffle4-ci.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: hardhat-truffle4 CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-truffle4/**" - - "packages/hardhat-web3-legacy/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 90cc0974ea..0000000000 --- a/.github/workflows/hardhat-truffle5-ci.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: hardhat-truffle5 CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-truffle5/**" - - "packages/hardhat-web3/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 e20471d196..0000000000 --- a/.github/workflows/hardhat-verify-ci.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: hardhat-verify CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-verify/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 8ec4a4083a..0000000000 --- a/.github/workflows/hardhat-viem-ci.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: hardhat-viem CI - -on: - push: - branches: main - paths: - - "packages/hardhat-viem/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 1c4f5d3f2b..0000000000 --- a/.github/workflows/hardhat-vyper-ci.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: hardhat-vyper CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-vyper/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 afc7e4e024..0000000000 --- a/.github/workflows/hardhat-web3-ci.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: hardhat-web3 CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-web3/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 18e7e54903..0000000000 --- a/.github/workflows/hardhat-web3-legacy-ci.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: hardhat-web3-legacy CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-web3-legacy/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**/*" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: "pnpm" - - 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 746413aa6e..0000000000 --- a/.github/workflows/hardhat-web3-v4-ci.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: hardhat-web3-v4 CI - -on: - push: - branches: [$default-branch] - paths: - - "packages/hardhat-web3-v4/**" - - "packages/hardhat-core/**" - - "packages/hardhat-common/**" - - "config/**" - pull_request: - branches: - - "**" - paths: - - "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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: pnpm - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: pnpm - - 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: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: pnpm - - 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/lint.yml b/.github/workflows/lint.yml index 760e0495f0..c46f567df3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,43 +2,83 @@ name: Lint on: push: - branches: [$default-branch] - pull_request: branches: - - "**" + - main + pull_request: workflow_dispatch: + # Triggering on pull_request_target to provide quick feedback before + # all the other workflow runs triggered on pull_request are approved + pull_request_target: + types: + - opened + branches: + - main concurrency: - group: ${{github.workflow}}-${{github.ref}} + group: ${{github.workflow}}-${{github.event_name}}-${{github.event_name == 'pull_request_target' && github.event.number || github.ref}} cancel-in-progress: true jobs: lint: name: Lint runs-on: ubuntu-latest + # Keeping permissions to a minimum to avoid leaking sensitive information + # on runs triggered by pull_request_target + permissions: + contents: read + strategy: + fail-fast: false + matrix: + working-directory: ["", "docs"] + defaults: + run: + working-directory: ${{ matrix.working-directory || github.workspace }} steps: + # Checking out both the default branch and the PR branch on pull_request_target + # to allow checking out sensitive files from the default branch + - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 + if: github.event_name == 'pull_request_target' with: - version: 9 - - uses: actions/setup-node@v4 + ref: "refs/pull/${{ github.event.number }}/merge" + persist-credentials: false + - if: github.event_name == 'pull_request_target' + run: | + git checkout $GITHUB_SHA --no-overlay -- .github/actions/setup-env + working-directory: ${{ github.workspace }} + - uses: ./.github/actions/setup-env with: - node-version: 18 - cache: "pnpm" - cache-dependency-path: | - pnpm-lock.yaml - docs/pnpm-lock.yaml + pnpm-lockfile: ${{ matrix.working-directory || '.' }}/pnpm-lock.yaml + package-json: ${{ matrix.working-directory || '.' }}/package.json - name: Install run: pnpm install --frozen-lockfile --prefer-offline + # Linting under the root directory requires build because some packages + # depend on local eslint-plugin-* packages - name: Build + if: matrix.working-directory == '' run: pnpm build - - name: lint + - name: Lint run: pnpm lint - name: Check dependency versions + if: matrix.working-directory == '' run: node scripts/check-dependencies.js - - name: Install website - working-directory: docs/ - run: pnpm install --frozen-lockfile --prefer-offline - - name: Lint website - working-directory: docs/ - run: pnpm lint + comment: + needs: [lint] + if: failure() && github.event_name == 'pull_request_target' && needs.lint.result == 'failure' + name: Comment + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: actions/github-script@v6 + name: Comment on failure + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "Thanks for submitting this PR!\n\nUnfortunately, it has some linter errors, so we can't merge it yet. Can you please fix them?\n\nRunning pnpm lint:fix in the root of the repository may fix them automatically." + }) diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 113315dfc2..1b90eae439 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -16,7 +16,8 @@ jobs: action: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@e460dfeb36e731f3aeb214be6b0c9a9d9a67eda6 + - uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1 with: issue-inactive-days: "90" pr-inactive-days: "90" + process-only: "issues, prs" diff --git a/.github/workflows/populate-cache.yml b/.github/workflows/populate-cache.yml new file mode 100644 index 0000000000..ab58361398 --- /dev/null +++ b/.github/workflows/populate-cache.yml @@ -0,0 +1,46 @@ +name: Populate cache + +on: + push: + branches: + - main + - pre-release-testing-branch + - changeset-release/main + paths: + - ".github/workflows/populate-cache.yml" + - "pnpm-lock.yaml" + - "docs/pnpm-lock.yaml" + pull_request: + paths: + - ".github/workflows/populate-cache.yml" + - "pnpm-lock.yaml" + - "docs/pnpm-lock.yaml" + workflow_dispatch: + +concurrency: + group: ${{github.workflow}}-${{github.ref}} + cancel-in-progress: true + +jobs: + cache: + name: Populate cache + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + runner: ["ubuntu-latest", "macos-latest", "windows-latest"] + working-directory: ["", "docs"] + defaults: + run: + working-directory: ${{ matrix.working-directory || github.workspace }} + steps: + - uses: actions/checkout@v4 + - id: env + uses: ./.github/actions/setup-env + with: + cache-save: true + pnpm-lockfile: ${{ matrix.working-directory || '.' }}/pnpm-lock.yaml + package-json: ${{ matrix.working-directory || '.' }}/package.json + - name: Install + if: steps.env.outputs.cache-hit != 'true' + run: pnpm install --frozen-lockfile --prefer-offline diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 1db35d8a33..345d54c747 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -17,13 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" + - uses: ./.github/actions/setup-env - name: Install run: pnpm install --frozen-lockfile --prefer-offline - name: Build @@ -31,7 +25,7 @@ jobs: - name: lint run: pnpm lint - name: Cache artifacts - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/artifacts @@ -52,17 +46,11 @@ jobs: working-directory: packages/hardhat-core steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" + - uses: ./.github/actions/setup-env - name: Install run: pnpm install --frozen-lockfile --prefer-offline - name: Cache network requests - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | packages/hardhat-core/test/internal/hardhat-network/provider/.hardhat_node_test_cache diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d49ad9b64..5f560ad3b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,16 +19,9 @@ jobs: # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits fetch-depth: 0 - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 9 - - - name: Setup Node.js 18.x - uses: actions/setup-node@v4 + - uses: ./.github/actions/setup-env with: node-version: 18.x - cache: "pnpm" - name: Install Dependencies run: pnpm install --frozen-lockfile --prefer-offline diff --git a/.github/workflows/test-slow-imports-rule.yml b/.github/workflows/test-slow-imports-rule.yml index 6f6d2a3847..537289f490 100644 --- a/.github/workflows/test-slow-imports-rule.yml +++ b/.github/workflows/test-slow-imports-rule.yml @@ -7,10 +7,15 @@ name: Slow imports rule check on: schedule: - cron: "0 0 * * *" - workflow_dispatch: push: + branches: + - main + paths: + - ".github/workflows/test-slow-imports-rule.yml" + pull_request: paths: - ".github/workflows/test-slow-imports-rule.yml" + workflow_dispatch: defaults: run: @@ -22,13 +27,7 @@ jobs: runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" + - uses: ./.github/actions/setup-env - name: Install run: pnpm install --frozen-lockfile --prefer-offline - name: Add slow import