Skip to content

Commit

Permalink
Merge branch 'main' into upstream-fef2098-commits
Browse files Browse the repository at this point in the history
  • Loading branch information
elfedy authored Dec 11, 2024
2 parents 6d578f4 + a4f0ebf commit 6071351
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
run: cargo hack check

zk-cargo-test:
runs-on: ubuntu-22.04
runs-on: ubuntu-22.04-github-hosted-16core

steps:
- name: Checkout code
Expand Down
16 changes: 15 additions & 1 deletion crates/forge/bin/cmd/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl InitArgs {
}
}

// install forge-zksync-std
// NOTE(zk): install forge-zksync-std
if zksync && !offline {
if root.join("lib/forge-zksync-std").exists() {
sh_println!("\"lib/forge-zksync-std\" already exists, skipping install....")?;
Expand All @@ -161,6 +161,20 @@ impl InitArgs {
let dep = "https://github.com/Moonsong-Labs/forge-zksync-std".parse()?;
self.opts.install(&mut config, vec![dep])?;
}

//Add zkout/ to .gitignore under compiler files if it doesn't exist
let gitignore_path = root.join(".gitignore");
if gitignore_path.exists() {
let mut content = fs::read_to_string(&gitignore_path)?;
if !content.contains("zkout/") {
// Find the compiler files section and add zkout/
if let Some(pos) = content.find("out/") {
let insert_pos = pos + "out/".len();
content.insert_str(insert_pos, "\nzkout/");
fs::write(&gitignore_path, content)?;
}
}
}
}

// init vscode settings
Expand Down
13 changes: 13 additions & 0 deletions crates/forge/tests/cli/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3203,3 +3203,16 @@ forgetest_init!(gas_report_include_tests, |prj, cmd| {
.is_json(),
);
});

forgetest_init!(zk_can_init_with_zksync, |prj, cmd| {
cmd.args(["init", "--zksync", "--force"]).assert_success();

// Check that zkout/ is in .gitignore
let gitignore_path = prj.root().join(".gitignore");
assert!(gitignore_path.exists());
let gitignore_contents = std::fs::read_to_string(&gitignore_path).unwrap();
assert!(gitignore_contents.contains("zkout/"));

// Assert that forge-zksync-std is installed
assert!(prj.root().join("lib/forge-zksync-std").exists());
});

0 comments on commit 6071351

Please sign in to comment.