diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8a3e1f754..fc4ae82088 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,7 +94,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --release --all --no-fail-fast + args: --release --all --features ci_skip --no-fail-fast codecov: name: Code Coverage @@ -123,7 +123,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --all + args: --all --features ci_skip env: CARGO_NET_GIT_FETCH_WITH_CLI: true CARGO_INCREMENTAL: "0" @@ -143,7 +143,7 @@ jobs: make install DESTDIR=../../kcov-build cd ../.. rm -rf kcov-master - for file in target/debug/deps/*-*; do if [[ "$file" != *\.* ]]; then mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; fi done + for file in target/debug/deps/*-*; do if [[ "$file" != *\.* ]]; then mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --exclude-region='@kcov_skip(start):@kcov_skip(end)' --verify "target/cov/$(basename $file)" "$file"; fi done - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 diff --git a/Cargo.lock b/Cargo.lock index 9a84b18837..0ed371dfc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -134,6 +134,24 @@ dependencies = [ "byte-tools", ] +[[package]] +name = "bstr" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" +dependencies = [ + "lazy_static", + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" + [[package]] name = "byte-tools" version = "0.3.1" @@ -167,6 +185,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "cast" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +dependencies = [ + "rustc_version", +] + [[package]] name = "cc" version = "1.0.58" @@ -241,6 +268,42 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "criterion" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70daa7ceec6cf143990669a04c7df13391d55fb27bd4079d252fca774ba244d8" +dependencies = [ + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools 0.9.0", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" +dependencies = [ + "cast", + "itertools 0.9.0", +] + [[package]] name = "crossbeam-deque" version = "0.7.3" @@ -299,6 +362,28 @@ dependencies = [ "subtle", ] +[[package]] +name = "csv" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" +dependencies = [ + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +dependencies = [ + "memchr", +] + [[package]] name = "derivative" version = "2.1.1" @@ -464,6 +549,12 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" +[[package]] +name = "half" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" + [[package]] name = "hashbrown" version = "0.8.1" @@ -531,6 +622,15 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +[[package]] +name = "js-sys" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a7e2c92a4804dd459b86c339278d0fe87cf93757fae222c3fa3ae75458bc73" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "jsonrpc-core" version = "14.2.0" @@ -583,6 +683,7 @@ dependencies = [ name = "leo-ast" version = "0.1.0" dependencies = [ + "criterion", "from-pest", "lazy_static", "log", @@ -775,6 +876,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" +[[package]] +name = "oorandom" +version = "11.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a170cebd8021a008ea92e4db85a72f80b35df514ec664b296fdcbb654eac0b2c" + [[package]] name = "opaque-debug" version = "0.2.3" @@ -849,6 +956,18 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" +[[package]] +name = "plotters" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" +dependencies = [ + "js-sys", + "num-traits", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "podio" version = "0.1.7" @@ -990,6 +1109,15 @@ dependencies = [ "thread_local", ] +[[package]] +name = "regex-automata" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +dependencies = [ + "byteorder", +] + [[package]] name = "regex-syntax" version = "0.6.18" @@ -1068,6 +1196,16 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_cbor" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +dependencies = [ + "half", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.114" @@ -1392,6 +1530,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "tinytemplate" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d3dc76004a03cec1c5932bca4cdc2e39aaa798e3f82363dd94f9adf6098c12f" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "toml" version = "0.5.6" @@ -1466,6 +1614,70 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasm-bindgen" +version = "0.2.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0563a9a4b071746dd5aedbc3a28c6fe9be4586fb3fbadb67c400d4f53c6b16c" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc71e4c5efa60fb9e74160e89b93353bc24059999c0ae0fb03affc39770310b0" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.36", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97c57cefa5fa80e2ba15641578b44d36e7a64279bc5ed43c6dbaf329457a2ed2" +dependencies = [ + "quote 1.0.7", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841a6d1c35c6f596ccea1f82504a192a60378f64b3bb0261904ad8f2f5657556" +dependencies = [ + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.36", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93b162580e34310e5931c4b792560108b10fd14d64915d7fff8ff00180e70092" + +[[package]] +name = "web-sys" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dda38f4e5ca63eda02c059d243aa25b5f35ab98451e518c51612cd0f1bd19a47" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index c232eb1ea0..cd948baa35 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,10 @@ zip = { version = "0.5" } [dev-dependencies] rusty-hook = { version = "0.11.2" } +[features] +default = [] +ci_skip = ["leo-compiler/ci_skip"] + [profile.release] opt-level = 3 lto = "thin" diff --git a/ast/Cargo.toml b/ast/Cargo.toml index 0df56b73a9..2bc362ba40 100644 --- a/ast/Cargo.toml +++ b/ast/Cargo.toml @@ -20,3 +20,8 @@ serde_json = { version = "1.0" } thiserror = { version = "1.0" } [dev-dependencies] +criterion = { version = "0.3" } + +[features] +default = [] +ci_skip = [] diff --git a/ast/tests/serialization/json.rs b/ast/tests/serialization/json.rs index 1e5a2386e1..f4844121e4 100644 --- a/ast/tests/serialization/json.rs +++ b/ast/tests/serialization/json.rs @@ -3,7 +3,8 @@ use leo_ast::LeoAst; use std::path::PathBuf; #[test] -fn test_serialization() { +#[cfg(not(feature = "ci_skip"))] +fn test_serialize() { let mut program_filepath = PathBuf::from(env!("CARGO_MANIFEST_DIR")); program_filepath.push("tests/serialization/main.leo"); diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 2d30b6305d..b4dc36fbf0 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -29,4 +29,8 @@ sha2 = { version = "0.9" } thiserror = { version = "1.0" } [dev-dependencies] -num-bigint = { version = "0.3" } \ No newline at end of file +num-bigint = { version = "0.3" } + +[features] +default = [] +ci_skip = ["leo-ast/ci_skip", "leo-types/ci_skip"] diff --git a/types/Cargo.toml b/types/Cargo.toml index 539617b3b5..f82cb0bdd0 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -18,3 +18,7 @@ snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = " pest = { version = "2.0" } serde = { version = "1.0" } serde_json = { version = "1.0" } + +[features] +default = [] +ci_skip = ["leo-ast/ci_skip"] diff --git a/types/tests/serialization/json.rs b/types/tests/serialization/json.rs index 8cb96c4620..a5d5f82c9f 100644 --- a/types/tests/serialization/json.rs +++ b/types/tests/serialization/json.rs @@ -17,6 +17,7 @@ fn to_typed_ast(program_filepath: &PathBuf) -> LeoTypedAst { } #[test] +#[cfg(not(feature = "ci_skip"))] fn test_serialize() { // Construct a typed syntax tree from the given test file. let typed_ast = { @@ -37,6 +38,7 @@ fn test_serialize() { } #[test] +#[cfg(not(feature = "ci_skip"))] fn test_deserialize() { // Load the expected typed syntax tree. let expected_typed_ast = {