Skip to content

Commit d6f26d9

Browse files
committed
🦤 Handle solc compiler download manually on CI (#1363)
1 parent 1bbeac3 commit d6f26d9

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

‎hardhat.config.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,31 @@ import 'hardhat-gas-reporter'
88
import mocharc from './.mocharc.json'
99
import compiler from './.compiler.json'
1010

11+
import { subtask } from 'hardhat/internal/core/config/config-env'
12+
import { TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD } from 'hardhat/builtin-tasks/task-names'
13+
import path from 'path'
14+
15+
// eslint-disable-next-line turbo/no-undeclared-env-vars
16+
const isCI = process.env.CI
17+
18+
// Override for CI to use downloaded solc compiler
19+
// Based on: https://github.com/NomicFoundation/hardhat/issues/1639#issuecomment-876291261
20+
subtask(TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD, (args: any, hre: any, runSuper: any) => {
21+
if (isCI && args.solcVersion === '0.8.16') {
22+
const compilerPath = path.join(__dirname, '..', '..', '..', 'tools-cache', 'hardhat', 'solc-v0.8.16')
23+
24+
return {
25+
compilerPath,
26+
isSolcJs: false,
27+
version: args.solcVersion,
28+
longVersion: '0.8.16',
29+
}
30+
}
31+
32+
// we just use the default subtask if the version is not 0.8.5
33+
return runSuper()
34+
})
35+
1136
module.exports = {
1237
paths: {
1338
sources: './contracts',

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"ethereum-mars": "0.2.6-dev.eb75a27",
4242
"ethereum-waffle": "4.0.10",
4343
"ethers": "^5.7.1",
44-
"hardhat": "^2.14.0",
44+
"hardhat": "^2.15.0",
4545
"hardhat-gas-reporter": "^1.0.9",
4646
"hardhat-waffle-dev": "2.0.5-dev.ffdc567",
4747
"mocha": "^10.0.0",

0 commit comments

Comments
 (0)