From 4a8949a950213d2a64e481574fa7972107d6ea0e Mon Sep 17 00:00:00 2001 From: Daira-Emma Hopwood Date: Sat, 2 Nov 2024 14:00:34 +0000 Subject: [PATCH 1/5] Remove `.gitlab-ci.yml` which is not used (and probably bitrotted). Signed-off-by: Daira-Emma Hopwood --- .gitlab-ci.yml | 66 -------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 001f415bb4..0000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,66 +0,0 @@ - -# /************************************************************************ - # File: .gitlab-ci.yml - # Author: mdr0id - # Date: 9/10/2018 - # Description: Used to setup runners/jobs for librustzcash - # Usage: Commit source and the pipeline will trigger the according jobs. - # For now the build and test are done in the same jobs. - # - # Known bugs/missing features: - # - # ************************************************************************/ - -stages: - - build - - test - - deploy - -rust-latest: - stage: build - image: rust:latest - script: - - cargo --verbose --version - - time cargo build --verbose - -rust-nightly: - stage: build - image: rustlang/rust:nightly - script: - - cargo --verbose --version - - cargo build --verbose - allow_failure: true - -librustzcash-test-latest: - stage: test - image: rust:latest - script: - - cargo --verbose --version - - time cargo test --release --verbose - -librustzcash-test-rust-nightly: - stage: test - image: rustlang/rust:nightly - script: - - cargo --verbose --version - - cargo test --release --verbose - allow_failure: true - -#used to manually deploy a given release -librustzcash-rust-rc: - stage: deploy - image: rust:latest - script: - - cargo --verbose --version - - time cargo build --release --verbose - when: manual - -#used to manually deploy a given release -librustzcash-rust-nightly-rc: - stage: deploy - image: rustlang/rust:nightly - script: - - cargo --verbose --version - - cargo build --release --verbose - allow_failure: true - when: manual From 35b8c0d781eb134545ddacf3ce7dbfac2b399127 Mon Sep 17 00:00:00 2001 From: Daira-Emma Hopwood Date: Sat, 2 Nov 2024 14:00:15 +0000 Subject: [PATCH 2/5] CI: Run tests with `RUST_BACKTRACE=1`. fixes #1602 Signed-off-by: Daira-Emma Hopwood --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a71d41af9..e79ff0c5c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,6 +67,8 @@ jobs: --release --workspace ${{ steps.prepare.outputs.feature-flags }} + env: + RUST_BACKTRACE: 1 - name: Run slow tests run: > cargo test @@ -75,6 +77,8 @@ jobs: ${{ steps.prepare.outputs.feature-flags }} --features expensive-tests -- --ignored + env: + RUST_BACKTRACE: 1 - name: Verify working directory is clean run: git diff --exit-code From 9d1c898355875cc2228212ee5b26855e27f6773f Mon Sep 17 00:00:00 2001 From: Daira-Emma Hopwood Date: Sat, 2 Nov 2024 17:59:03 +0000 Subject: [PATCH 3/5] Since we have many computationally expensive tests, this changes the test profile to compile with optimizations by default, but keep full debug info. This differs from the release profile in the following ways: - it does not set `lto = true`, which increases compile times without substantially speeding up tests; - it does not set `codegen-units = 1`, which increases compile times and is only useful to improve determinism of release builds; - it does not set `panic = 'abort'`, which is in any case ignored for tests. After this PR, to get results as close as possible to a release build, use `cargo test --release`. To speed up compilation and avoid optimizations potentially resulting in lower-quality debug info, use `cargo test --profile=dev`. Times on my machine starting from `cargo clean` for each run: * `cargo test --all-targets --all-features`: * 484s (354s build, 130s tests) * `cargo test --release --all-targets --all-features`: * 541s (415s build, 126s tests) * `cargo test --profile=dev --all-targets --all-features`: * 1709s (146s build, 1563s tests) * this might still be faster when running individual tests. Signed-off-by: Daira-Emma Hopwood --- Cargo.toml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 78468956fc..f53945e620 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,5 +162,22 @@ lto = true panic = 'abort' codegen-units = 1 +[profile.test] +# Since we have many computationally expensive tests, this changes the test profile to +# compile with optimizations by default, but keep full debug info. +# +# This differs from the release profile in the following ways: +# - it does not set `lto = true`, which increases compile times without substantially +# speeding up tests; +# - it does not set `codegen-units = 1`, which increases compile times and is only +# useful to improve determinism of release builds; +# - it does not set `panic = 'abort'`, which is in any case ignored for tests. +# +# To get results as close as possible to a release build, use `cargo test --release`. +# To speed up compilation and avoid optimizations potentially resulting in lower-quality +# debug info, use `cargo test --profile=dev`. +opt-level = 3 +debug = true + [workspace.lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(zcash_unstable, values("zfuture"))'] } From a7cdf8d4eeaaab9882f0e09b7f7463ae89b1fa0d Mon Sep 17 00:00:00 2001 From: Daira-Emma Hopwood Date: Sat, 2 Nov 2024 17:59:40 +0000 Subject: [PATCH 4/5] CI: Use new test profile. Signed-off-by: Daira-Emma Hopwood --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e79ff0c5c1..fd242a7578 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,6 @@ jobs: - name: Run tests run: > cargo test - --release --workspace ${{ steps.prepare.outputs.feature-flags }} env: @@ -72,7 +71,6 @@ jobs: - name: Run slow tests run: > cargo test - --release --workspace ${{ steps.prepare.outputs.feature-flags }} --features expensive-tests From 5672b307b688e3375e509b29332801b3bddb952b Mon Sep 17 00:00:00 2001 From: Daira-Emma Hopwood Date: Sat, 2 Nov 2024 18:44:53 +0000 Subject: [PATCH 5/5] Have `cargo` use `RUST_BACKTRACE=1` by default in this workspace (instead of only in CI), so that there is no need to set it manually. You can override this by setting `RUST_BACKTRACE=0`, or `RUST_BACKTRACE=full` for a full backtrace. Signed-off-by: Daira-Emma Hopwood --- .cargo/config.toml | 2 ++ .github/workflows/ci.yml | 4 ---- .gitignore | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000000..e724ea0856 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[env] +RUST_BACKTRACE = "1" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd242a7578..e551e74611 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,8 +66,6 @@ jobs: cargo test --workspace ${{ steps.prepare.outputs.feature-flags }} - env: - RUST_BACKTRACE: 1 - name: Run slow tests run: > cargo test @@ -75,8 +73,6 @@ jobs: ${{ steps.prepare.outputs.feature-flags }} --features expensive-tests -- --ignored - env: - RUST_BACKTRACE: 1 - name: Verify working directory is clean run: git diff --exit-code diff --git a/.gitignore b/.gitignore index cd8e4b1f6f..eb5a316cbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ target -.cargo