From b101f55106ef896439a96fae9bde1f35b36df85d Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:27:16 -0800 Subject: [PATCH 01/10] Fix codecov CI --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 1e31031cbb..4a2ae1f647 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -55,7 +55,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 --exclude-region='@kcov_skip(start):@kcov_skip(end)' --verify "target/cov/$(basename $file)" "$file"; fi done + for file in target/ci/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@v3 From 2bf7bfa34fb9d2f0e1652fc226641a339106f302 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:32:21 -0800 Subject: [PATCH 02/10] Update leo-executable CI --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8e2e2ea7ef..ef753981e2 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -228,7 +228,7 @@ jobs: - run: name: Build and install Leo no_output_timeout: 30m - command: cargo install --path . --root . --locked + command: cargo install --path . --locked - persist_to_workspace: root: ~/ paths: From 82585fa7ce81bb3752dd560fb301a42027843139 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:35:26 -0800 Subject: [PATCH 03/10] Update examples CI script --- .circleci/config.yml | 2 +- .circleci/leo-example.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ef753981e2..8e2e2ea7ef 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -228,7 +228,7 @@ jobs: - run: name: Build and install Leo no_output_timeout: 30m - command: cargo install --path . --locked + command: cargo install --path . --root . --locked - persist_to_workspace: root: ~/ paths: diff --git a/.circleci/leo-example.sh b/.circleci/leo-example.sh index 2e794f8121..8fbce490c0 100755 --- a/.circleci/leo-example.sh +++ b/.circleci/leo-example.sh @@ -1,3 +1,9 @@ +# Alias the leo command to use the local binary. +# Note: Use a full path for $LEO when running locally. +leo() { + $LEO "$@" +} + ( # Create a new Leo lottery example program. $LEO example lottery || exit From 216b52a57090271580b596b6c5a1c26eaa12fe63 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Tue, 19 Nov 2024 07:53:35 -0800 Subject: [PATCH 04/10] Update examples --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index b75bb77851..155f8410fb 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit b75bb77851667f6ece0af4cacfc27715aa7186aa +Subproject commit 155f8410fb199c971b50950882a74ff593f8f5d9 From c532c01e9083a7ec770863c9b9f2c9e9f2464bf2 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:10:07 -0800 Subject: [PATCH 05/10] Attempt to sanitize mtimes --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8e2e2ea7ef..c03de60d48 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,7 @@ commands: if [ ! -f "Cargo.lock" ]; then cargo generate-lockfile fi + cargo install cargo-mtime install-rust-windows: @@ -71,6 +72,7 @@ commands: if (!(Test-Path "Cargo.lock" -PathType Leaf)) { cargo generate-lockfile } + cargo install cargo-mtime build-and-test: description: "Build and run tests" @@ -79,12 +81,14 @@ commands: name: Build no_output_timeout: 30m command: | + cargo-mtime-memoize . ~/.cache/mtimes/project.db cargo test --no-run --all --locked --profile ci --features only_testnet - run: name: Run tests no_output_timeout: 30m # The `--verbose` flag is used to check which files are being recompiled. Ideally, this should be none. command: | + cargo-mtime-memoize . ~/.cache/mtimes/project.db cargo test --all --locked --profile ci --features only_testnet --verbose install_rust_nightly: From 16b882be79dd29623b0257294e15d0dde5276827 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:18:06 -0800 Subject: [PATCH 06/10] Minor tweaks --- .circleci/config.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c03de60d48..82451ff6cf 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,23 +36,27 @@ executors: resource_class: xlarge commands: - install-rust: + install-rust-macos: description: "Install Rust (Linux/macOS)" steps: - run: name: Install Rust command: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - source "$HOME/.cargo/env" - rustup install 1.82.0 - rustup override set 1.82.0 - cargo --version --verbose - rustc --version + # If Rust is not installed on the machine, install it + if ! command -v rustc &> /dev/null; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source "$HOME/.cargo/env" + rustup install 1.82.0 + rustup override set 1.82.0 + cargo --version --verbose + rustc --version + fi if [ ! -f "Cargo.lock" ]; then cargo generate-lockfile fi cargo install cargo-mtime + install-rust-windows: description: "Install Rust (Windows)" @@ -148,6 +152,7 @@ jobs: - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }} - cargo-v1-{{ arch }} + - install-rust - run: name: Update Submodules command: git submodule update --init --recursive From 2d15fb58beb7b6fc8f251d992f38c7a13395c930 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:22:27 -0800 Subject: [PATCH 07/10] Fix usage of cargo-mtime --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 82451ff6cf..f01b55df65 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -85,14 +85,14 @@ commands: name: Build no_output_timeout: 30m command: | - cargo-mtime-memoize . ~/.cache/mtimes/project.db + cargo-mtime . ~/.cache/mtimes/project.db cargo test --no-run --all --locked --profile ci --features only_testnet - run: name: Run tests no_output_timeout: 30m # The `--verbose` flag is used to check which files are being recompiled. Ideally, this should be none. command: | - cargo-mtime-memoize . ~/.cache/mtimes/project.db + cargo-mtime . ~/.cache/mtimes/project.db cargo test --all --locked --profile ci --features only_testnet --verbose install_rust_nightly: From 4323c1e1ce8f82714f7896f017f9e682287e342e Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:25:40 -0800 Subject: [PATCH 08/10] Fix --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f01b55df65..ec466f2fa1 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ executors: resource_class: xlarge commands: - install-rust-macos: + install-rust: description: "Install Rust (Linux/macOS)" steps: - run: From 53319d93dc8831563a59ec2edf1df558daa432d2 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:54:14 -0800 Subject: [PATCH 09/10] Make watched files in build script more granular --- build.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 5420a093a7..5e040188a0 100644 --- a/build.rs +++ b/build.rs @@ -71,8 +71,26 @@ fn check_file_licenses>(path: P) { } } - // Re-run upon any changes to the workspace. - println!("cargo:rerun-if-changed=."); + // Watch the directories that contain Rust source files + println!("cargo:rerun-if-changed=compiler"); + println!("cargo:rerun-if-changed=docs"); + println!("cargo:rerun-if-changed=errors"); + println!("cargo:rerun-if-changed=examples"); + println!("cargo:rerun-if-changed=leo"); + println!("cargo:rerun-if-changed=tests"); + println!("cargo:rerun-if-changed=utils"); + + // Watch the build script itself + println!("cargo:rerun-if-changed=build.rs"); + + // Watch the license header file + println!("cargo:rerun-if-changed=.resources/license_header"); + + // Watch the Cargo.toml file + println!("cargo:rerun-if-changed=Cargo.toml"); + + // Watch the Cargo.lock file + println!("cargo:rerun-if-changed=Cargo.lock"); } // The build script; it currently only checks the licenses. From b16d9ac667bf7f38b5559249509f1512512e9697 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:59:29 -0800 Subject: [PATCH 10/10] More granularity on tracked changes --- build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.rs b/build.rs index 5e040188a0..c374d98662 100644 --- a/build.rs +++ b/build.rs @@ -73,11 +73,9 @@ fn check_file_licenses>(path: P) { // Watch the directories that contain Rust source files println!("cargo:rerun-if-changed=compiler"); - println!("cargo:rerun-if-changed=docs"); println!("cargo:rerun-if-changed=errors"); - println!("cargo:rerun-if-changed=examples"); println!("cargo:rerun-if-changed=leo"); - println!("cargo:rerun-if-changed=tests"); + println!("cargo:rerun-if-changed=tests/test-framework"); println!("cargo:rerun-if-changed=utils"); // Watch the build script itself