Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary Hardhat-related CI jobs #754

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 2 additions & 87 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ workflows:
- node-current:
run_coveralls: true
- build-package
- hardhat-core-default-solc: *requires_package
- hardhat-core-latest-solc: *requires_package
- hardhat-sample-project: *requires_package
- cli-smoke-test: *requires_package
- solidity-solcjs-ext-test
Expand All @@ -35,8 +33,6 @@ workflows:
jobs:
- node-current
- build-package
- hardhat-core-default-solc: *requires_package
- hardhat-core-latest-solc: *requires_package
- hardhat-sample-project: *requires_package
- cli-smoke-test: *requires_package
- solidity-solcjs-ext-test
Expand All @@ -56,12 +52,6 @@ commands:
yarn --version
pnpm version || >&2 echo "pnpm not installed"

install-pnpm:
steps:
- run:
name: Install pnpm
command: sudo npm install -g pnpm

install-dependencies:
parameters:
cache-id:
Expand Down Expand Up @@ -164,25 +154,11 @@ commands:
--fail \
--show-error \
"${EXTRA_HEADERS[@]}" \
https://api.github.com/repos/nomiclabs/hardhat/releases/latest \
| jq --raw-output .tag_name \
https://api.github.com/repos/nomiclabs/hardhat/releases \
| jq --raw-output 'map(select(.tag_name | test("^hardhat@"))) | .[0].tag_name' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the latest release always the first element in the list?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is according to my single, manual test 😅 Sadly, the docs don't specify this.

But I think even in the (IMO unlikely) case that you get an older release, this is still better than failing every time the latest release is a Hardhat plugin, something that happens often enough.

)
echo "export HARDHAT_LATEST_RELEASE_TAG='${HARDHAT_LATEST_RELEASE_TAG}'" >> "$BASH_ENV"

provision-hardhat-with-packaged-solcjs:
description: "Clones Hardhat repository and configures it to use a local clone of solc-js."
steps:
- fetch-latest-hardhat-release-tag
- run: git clone --depth 1 https://github.com/nomiclabs/hardhat.git --branch "$HARDHAT_LATEST_RELEASE_TAG" hardhat/
- install-dependencies:
cache-id: hardhat
path: hardhat
package-manager: pnpm
dependency-file: pnpm-lock.yaml
- inject-solc-js-tarball:
path: hardhat/
package-manager: pnpm

jobs:
node-base: &node-base
working_directory: ~/solc-js
Expand Down Expand Up @@ -261,67 +237,6 @@ jobs:
- store_artifacts:
path: artifacts/

hardhat-core-default-solc:
# Runs out of memory on 'medium'.
resource_class: medium+
environment:
NODE_OPTIONS: "--max-old-space-size=4096"
docker:
- image: cimg/rust:1.74.0-node
steps:
- install-pnpm
- show-npm-version
- attach_workspace:
at: workspace
- provision-hardhat-with-packaged-solcjs
- run:
name: Restore the default solc binary expected by Hardhat
command: |
# Hardhat downloader tests are hard-coded to expect the version that comes with the solc-js.
# We forced latest solc-js but we still want the default binary with it.
hardhat_default_solc_version=$(jq --raw-output '.dependencies.solc' hardhat/packages/hardhat-core/package.json)
mkdir hardhat-default-solc/
pushd hardhat-default-solc/
pnpm install --node-linker=hoisted "solc@${hardhat_default_solc_version}"
popd
ln -sf ../../../hardhat-default-solc/node_modules/solc/soljson.js hardhat/node_modules/solc/soljson.js
- run:
name: Run hardhat-core test suite with its default solc binary
command: |
cd hardhat/packages/hardhat-core
# The install command is required again here to create the correct symlinks under the hardhat-core/node_modules
# In our case that is something like: solc -> ../../../node_modules/.pnpm/file+..+solc-js.tgz/node_modules/solc
# See: https://pnpm.io/symlinked-node-modules-structure
pnpm install --no-frozen-lockfile
# TODO: temporarily set hardhat stack traces tests to use cancun hardfork
# Remove this when hardhat switch to cancun by default: https://github.com/NomicFoundation/hardhat/issues/4851
sed -i 's/hardfork: "shanghai",/hardfork: "cancun",/' test/internal/hardhat-network/stack-traces/execution.ts
pnpm test

hardhat-core-latest-solc:
docker:
- image: cimg/rust:1.74.0-node
steps:
- install-pnpm
- show-npm-version
- attach_workspace:
at: workspace
- provision-hardhat-with-packaged-solcjs
- run:
name: Run hardhat-core test suite with latest solc
command: |
cd hardhat/
HARDHAT_TESTS_SOLC_PATH="${PWD}/node_modules/solc/soljson.js"
HARDHAT_TESTS_SOLC_VERSION=$(jq --raw-output .version node_modules/solc/package.json)
export HARDHAT_TESTS_SOLC_PATH HARDHAT_TESTS_SOLC_VERSION

cd packages/hardhat-core/
pnpm install --no-frozen-lockfile
# TODO: temporarily set hardhat stack traces tests to use cancun hardfork
# Remove this when hardhat switch to cancun by default: https://github.com/NomicFoundation/hardhat/issues/4851
sed -i 's/hardfork: "shanghai",/hardfork: "cancun",/' test/internal/hardhat-network/stack-traces/execution.ts
pnpm test

hardhat-sample-project:
docker:
- image: cimg/node:current
Expand Down