Skip to content

Commit

Permalink
🦤 Handle solc compiler download manually on CI (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
truefibot committed Jun 14, 2023
1 parent 1bbeac3 commit d6f26d9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@ import 'hardhat-gas-reporter'
import mocharc from './.mocharc.json'
import compiler from './.compiler.json'

import { subtask } from 'hardhat/internal/core/config/config-env'
import { TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD } from 'hardhat/builtin-tasks/task-names'
import path from 'path'

// eslint-disable-next-line turbo/no-undeclared-env-vars
const isCI = process.env.CI

// Override for CI to use downloaded solc compiler
// Based on: https://github.com/NomicFoundation/hardhat/issues/1639#issuecomment-876291261
subtask(TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD, (args: any, hre: any, runSuper: any) => {
if (isCI && args.solcVersion === '0.8.16') {
const compilerPath = path.join(__dirname, '..', '..', '..', 'tools-cache', 'hardhat', 'solc-v0.8.16')

return {
compilerPath,
isSolcJs: false,
version: args.solcVersion,
longVersion: '0.8.16',
}
}

// we just use the default subtask if the version is not 0.8.5
return runSuper()
})

module.exports = {
paths: {
sources: './contracts',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ethereum-mars": "0.2.6-dev.eb75a27",
"ethereum-waffle": "4.0.10",
"ethers": "^5.7.1",
"hardhat": "^2.14.0",
"hardhat": "^2.15.0",
"hardhat-gas-reporter": "^1.0.9",
"hardhat-waffle-dev": "2.0.5-dev.ffdc567",
"mocha": "^10.0.0",
Expand Down

0 comments on commit d6f26d9

Please sign in to comment.