Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding per PR tests. #4

Merged
merged 5 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PR tests

on:
workflow_dispatch:
pull_request:
merge_group:
push:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust toolchain 1.74 (with clippy and rustfmt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

powdr is using 1.77 now, does it matter?

Copy link
Member Author

@lvella lvella Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. If updating the rust version on an crate breaks its dependencies, pil-stark-prover will be the least of our problems.

run: rustup toolchain install 1.74-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.74-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.74-x86_64-unknown-linux-gnu
- name: Install pil-stark dependency
run: sudo apt-get install -y nlohmann-json3-dev libpqxx-dev nasm
- name: Format
run: cargo fmt --all --check --verbose
- name: Lint
run: cargo clippy --all --all-targets --all-features --profile pr-tests -- -D warnings
- name: Build
run: cargo build --all --all-targets --all-features --profile pr-tests
- uses: taiki-e/install-action@nextest
- name: Run tests
run: RUST_LOG=info cargo nextest run --workspace --all-features --all-targets --cargo-profile pr-tests --nocapture
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ env_logger = "0.10.0"

[build-dependencies]
num_cpus = "1.16.0"

[profile.pr-tests]
inherits = "dev"
opt-level = 3
debug = "line-tables-only"
debug-assertions = true
overflow-checks = true
panic = 'unwind'
codegen-units = 256
11 changes: 10 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@ fn main() {
// Run make test in the zkevm-prover directory
let zkevm_prover_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("externals/zkevm-prover");

Command::new("make")
eprintln!(
"Running make test in zkevm-prover directory: {}",
zkevm_prover_dir.display()
);
let make_status = Command::new("make")
.arg("test")
.arg("-j")
.arg(num_cpus::get().to_string())
.current_dir(&zkevm_prover_dir)
.status()
.expect("Failed to run make test in zkevm-prover directory");

assert!(
make_status.success(),
"make test failed in zkevm-prover directory"
);
}
2 changes: 1 addition & 1 deletion externals/zkevm-prover
Submodule zkevm-prover updated 1 files
+8 −5 Makefile
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub fn generate_proof(
log::info!("Compiling C helpers into a shared library...");
print_and_run(
Command::new("g++")
.args(&[
.args([
"-std=c++17",
"-shared",
"-fPIC",
Expand All @@ -166,7 +166,7 @@ pub fn generate_proof(
.arg(crate_dir.join("externals/zkevm-prover/test/examples/dynamic_chelpers.cpp"))
.arg(format!("-I{}", chelpers_header_dir.to_str().unwrap()))
.args(
&[
[
"src/config",
"src/starkpil",
"src/utils",
Expand Down Expand Up @@ -200,7 +200,7 @@ pub fn generate_proof(
p.canonicalize().unwrap()
}),
)
.current_dir(&output_dir),
.current_dir(output_dir),
Error::ProofGen,
)?;

Expand Down Expand Up @@ -292,7 +292,7 @@ mod tests {
&starkstruct_json,
&constants_bin,
&commits_bin,
&output_dir,
output_dir,
)
.expect("proof generation failed");

Expand Down
Loading