Skip to content

Commit

Permalink
ci: Enable Tests in CI (sphinx-labs#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
RPate97 authored Feb 11, 2023
1 parent c94c331 commit e4446ae
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build:ts": "tsc -p ./tsconfig.json",
"build:contracts": "hardhat clean && hardhat compile",
"clean": "rimraf dist/ ./tsconfig.tsbuildinfo",
"test:coverage": "echo 'no tests'",
"test:coverage": "forge test",
"lint": "yarn lint:fix && yarn lint:check",
"lint:check": "yarn lint:contracts:check && yarn lint:ts:check",
"lint:fix": "yarn lint:contracts:fix && yarn lint:ts:fix",
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/languages/solidity/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const getSolcBuild = async (solcVersion: string): Promise<SolcBuild> => {
)

if (!isCompilerDownloaded) {
console.log(`Downloading compiler version ${solcVersion}`)
await downloader.downloadCompiler(solcVersion)
}

Expand All @@ -72,7 +71,6 @@ export const getSolcBuild = async (solcVersion: string): Promise<SolcBuild> => {
)

if (!isWasmCompilerDownloader) {
console.log(`Downloading compiler version ${solcVersion}`)
await wasmDownloader.downloadCompiler(solcVersion)
}

Expand Down
10 changes: 9 additions & 1 deletion packages/executor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as dotenv from 'dotenv'
dotenv.config()
import {
BaseServiceV2,
StandardOptions,
Logger,
StandardOptions,
validators,
} from '@eth-optimism/common-ts'
import { ethers } from 'ethers'
Expand Down Expand Up @@ -109,6 +109,14 @@ export class ChugSplashExecutor extends BaseServiceV2<
)
this.state.lastBlockNumber = 0

// Passing the log level in when creating executor still does not work as expected.
// If you attempt to remove this, the foundry library will fail due to incorrect output to the console.
// This is because the foundry library parses stdout and expects a very specific format.
this.logger = new Logger({
name: 'Logger',
level: options.logLevel,
})

// This represents a queue of "BundleApproved" events to execute.
this.state.eventsQueue = []

Expand Down
8 changes: 8 additions & 0 deletions packages/plugins/foundry-contracts/ChugSplash.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ contract ChugSplash is Script, Test {

string rpcUrl = vm.rpcUrl(network);
string filePath = vm.envOr("DEV_FILE_PATH", string('./node_modules/@chugsplash/plugins/dist/foundry/index.js'));
bool isChugSplashTest = vm.envOr("IS_CHUGSPLASH_TEST", false);

struct ChugSplashContract {
string referenceName;
Expand Down Expand Up @@ -232,7 +233,14 @@ contract ChugSplash is Script, Test {
cmds[14] = skipStorageCheck == true ? "true" : "false";

bytes memory result = vm.ffi(cmds);
if (isChugSplashTest) {
emit log("Attempting to decode deploy command results:");
emit log_bytes(result);
}
ChugSplashContract[] memory deployedContracts = abi.decode(result, (ChugSplashContract[]));
if (isChugSplashTest) {
emit log("Successfully decoded");
}

if (silent == false) {
emit log("Success!");
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ libs = ['node_modules', 'lib']
test = 'test/foundry'
cache_path = 'forge-cache'
verbosity = 2
allow_paths = ["node_modules/@chugsplash/contracts"]
allow_paths = ["../contracts"]


[rpc_endpoints]
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test": "yarn test:forge && yarn test:hardhat",
"test:forge": "anvil & ANVIL_PID=$! && forge test && kill $ANVIL_PID",
"test:hardhat": "npx hardhat test --config-path ./chugsplash/Storage.config.ts",
"test:coverage": "echo 'no tests'",
"test:coverage": "export DEV_FILE_PATH='./dist/foundry/index.js' && export DISABLE_ANALYTICS=true && IS_CHUGSPLASH_TEST=true && yarn test",
"lint": "yarn lint:fix && yarn lint:check",
"lint:fix": "yarn lint:ts:fix",
"lint:check": "yarn lint:ts:check",
Expand Down
6 changes: 3 additions & 3 deletions packages/plugins/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@chugsplash/=node_modules/@chugsplash
@openzeppelin/contracts-upgradeable/=node_modules/@chugsplash/contracts/node_modules/@openzeppelin/contracts-upgradeable/
@openzeppelin/contracts/=node_modules/@chugsplash/contracts/node_modules/@openzeppelin/contracts/
@chugsplash/=../
@openzeppelin/contracts-upgradeable/=../contracts/node_modules/@openzeppelin/contracts-upgradeable/
@openzeppelin/contracts/=../contracts/node_modules/@openzeppelin/contracts/
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
node_modules/=node_modules/
3 changes: 3 additions & 0 deletions packages/plugins/src/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export const initializeExecutor = async (
{
privateKey:
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
// Passing the log level in when creating executor still does not work as expected.
// If you attempt to remove this option, the foundry library will fail due to incorrect output to the console.
// This is because the foundry library parses stdout and expects a very specific format.
logLevel: 'error',
},
false,
Expand Down

0 comments on commit e4446ae

Please sign in to comment.