Skip to content

Commit

Permalink
CI: separate job for building the tarball to be published and tested
Browse files Browse the repository at this point in the history
  • Loading branch information
cameel committed Dec 4, 2023
1 parent 09b2c15 commit 5d7f0bd
Showing 1 changed file with 75 additions and 36 deletions.
111 changes: 75 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
defaults:
- requires_package: &requires_package
requires:
- build-package

workflows:
version: 2.1
node-multi-build:
Expand All @@ -11,11 +16,12 @@ workflows:
- node-v20
- node-current:
run_coveralls: true
- hardhat-core-default-solc
- hardhat-core-latest-solc
- hardhat-sample-project
- truffle-sample-project
- cli-smoke-test
- build-package
- hardhat-core-default-solc: *requires_package
- hardhat-core-latest-solc: *requires_package
- hardhat-sample-project: *requires_package
- truffle-sample-project: *requires_package
- cli-smoke-test: *requires_package
- solidity-solcjs-ext-test

version: 2.1
Expand Down Expand Up @@ -104,7 +110,7 @@ commands:
default: .
tarball-path:
type: string
default: solc-js.tgz
default: workspace/solc-js.tgz
package-manager:
type: enum
enum: ["npm", "yarn", "pnpm"]
Expand Down Expand Up @@ -146,21 +152,6 @@ commands:
exit 1
fi
provision-and-package-solcjs:
description: "Creates a package out of latest solc-js to test its installation as a dependency."
steps:
- checkout:
path: solc-js/
- install-dependencies:
cache-id: solc-js
path: solc-js
- run:
name: Package solc-js
command: |
cd solc-js/
npm run build:tarball
mv "$(npm run --silent tarballName)" ../solc-js.tgz
provision-hardhat-with-packaged-solcjs:
description: "Clones Hardhat repository and configures it to use a local clone of solc-js."
steps:
Expand Down Expand Up @@ -229,14 +220,47 @@ jobs:
./node_modules
./dist
build-package:
docker:
- image: cimg/node:current
steps:
- show-npm-version
- checkout:
path: solc-js/
- install-dependencies:
cache-id: solc-js
path: solc-js
- attach_workspace:
at: workspace
- run:
name: Package solc-js
command: |
cd solc-js/
npm run build:tarball
cp "$(npm run --silent tarballName)" ../workspace/solc-js.tgz
# The artifact is meant to be used with `npm publish` and that fails unless the file name includes a version number.
# Oddly, the name and version from the file name do not even need to be correct - after npm accepts the file,
# it will use the ones from package.json anyway.
mkdir ../artifacts
mv "$(npm run --silent tarballName)" ../artifacts/
- persist_to_workspace:
root: workspace
paths:
- solc-js.tgz
- store_artifacts:
path: artifacts/

hardhat-core-default-solc:
# Runs out of memory on 'medium'.
resource_class: medium+
docker:
- image: cimg/node:current
steps:
- show-npm-version
- provision-and-package-solcjs
- attach_workspace:
at: workspace
- provision-hardhat-with-packaged-solcjs
- run:
name: Restore the default solc binary expected by Hardhat
Expand Down Expand Up @@ -264,7 +288,8 @@ jobs:
- image: cimg/node:current
steps:
- show-npm-version
- provision-and-package-solcjs
- attach_workspace:
at: workspace
- provision-hardhat-with-packaged-solcjs
- run:
name: Run hardhat-core test suite with latest solc
Expand All @@ -283,7 +308,8 @@ jobs:
- image: cimg/node:current
steps:
- show-npm-version
- provision-and-package-solcjs
- attach_workspace:
at: workspace
- run: git clone --depth 1 "https://github.com/nomiclabs/hardhat-hackathon-boilerplate" boilerplate/
- run:
# Leaving package-lock.json causes a weird error in arborist when npm is used again after
Expand Down Expand Up @@ -337,7 +363,8 @@ jobs:
steps:
- update-npm
- show-npm-version
- provision-and-package-solcjs
- attach_workspace:
at: workspace
- run: sudo apt update
- run: sudo apt install python3 python-is-python3 --assume-yes --no-install-recommends
- provision-truffle-with-packaged-solcjs
Expand Down Expand Up @@ -369,28 +396,40 @@ jobs:
- image: cimg/node:current
steps:
- show-npm-version
- provision-and-package-solcjs
- run:
name: "CLI smoke test (repository)"
command: |
cd solc-js
dist/solc.js --version
echo "contract C {}" > C.sol
dist/solc.js C.sol --bin
[[ -f C_sol_C.bin ]]
- attach_workspace:
at: workspace
- run:
name: "CLI smoke test (package)"
command: |
mkdir package/
cd package/
npm install ../solc-js.tgz
npm install ../workspace/solc-js.tgz
npx solcjs --version
echo "contract C {}" > C.sol
npx solcjs C.sol --bin
[[ -f C_sol_C.bin ]]
- checkout:
path: solc-js/
- install-dependencies:
cache-id: solc-js
path: solc-js
- run:
name: Build solc-js
command: |
cd solc-js/
npm run updateBinary
npm run build
- run:
name: "CLI smoke test (repository)"
command: |
cd solc-js
dist/solc.js --version
echo "contract C {}" > C.sol
dist/solc.js C.sol --bin
[[ -f C_sol_C.bin ]]
solidity-solcjs-ext-test:
docker:
Expand Down

0 comments on commit 5d7f0bd

Please sign in to comment.