2323executors :
2424 # The default docker image used in the main-workflow
2525 rust-docker :
26- docker :
26+ docker :
2727 - image : cimg/rust:1.88.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well
2828
2929commands :
@@ -35,32 +35,46 @@ commands:
3535 steps :
3636 - checkout
3737 - restore_cache :
38- key : cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
38+ keys :
39+ - cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
40+ - cargo-cache-{{ arch }}-
3941 - run :
4042 name : " Install Rust"
43+ no_output_timeout : 15m
4144 command : |
45+ $ErrorActionPreference = "Stop"
4246 $ProgressPreference = "SilentlyContinue"
43- # Remove the version of rustc that (might be) installed already..
44- # Use non-interactive mode and force uninstall to prevent the job from getting stuck.
45- choco uninstall rust -y --force
4647
47- # Install rust with rustup.
48- Invoke-WebRequest -Uri "https://win.rustup.rs/" -OutFile "C:\rustup-init.exe"
49- & C:\rustup-init.exe -y --default-toolchain "1.88.0-x86_64-pc-windows-msvc" --no-modify-path --profile minimal # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well
48+ # Ensure rustup is installed
49+ if (-not (Get-Command rustup -ErrorAction SilentlyContinue)) {
50+ Write-Host "rustup not found, installing..."
51+ $rustupPath = "$env:TEMP\rustup-init.exe"
52+ Invoke-WebRequest -Uri "https://win.rustup.rs/" -OutFile $rustupPath
53+ & $rustupPath -y --default-toolchain "1.88.0-x86_64-pc-windows-msvc" --no-modify-path --profile minimal
54+ } else {
55+ Write-Host "rustup already installed, ensuring toolchain 1.88.0-x86_64-pc-windows-msvc is present..."
56+ rustup toolchain install 1.88.0-x86_64-pc-windows-msvc
57+ }
58+
59+ # Put cargo/rustup first in PATH for this step and subsequent steps
60+ $Env:Path = "$Env:USERPROFILE\.cargo\bin;$Env:Path"
61+
62+ # Select the toolchain
63+ rustup default 1.88.0-x86_64-pc-windows-msvc
5064
51- # Add cargo to PATH
52- $Env:Path += ";$Env:USERPROFILE\.cargo\bin"
5365 # Verify the installation.
5466 cargo --version --verbose
5567 rustc --version | Out-File -FilePath "rust-version"
68+
5669 if (!(Test-Path "Cargo.lock" -PathType Leaf)) {
5770 cargo generate-lockfile
5871 }
5972 - run :
6073 name : " Run cargo check"
6174 command : |
62- # Add cargo to PATH
63- $Env:Path += ";$Env:USERPROFILE\.cargo\bin"
75+ # Add cargo to PATH (for safety in case env is not carried perfectly)
76+ $Env:Path = "$Env:USERPROFILE\.cargo\bin;$Env:Path"
77+
6478 # Check that the given package compiles
6579 cd << parameters.workspace_member >>
6680 cargo check --examples --benches --tests
@@ -69,44 +83,69 @@ commands:
6983 - C:\Users\circleci\.cargo\registry
7084 - C:\Users\circleci\.cargo\git
7185 - target
72- key : cargo-cache-{{ arch }}-{{ checksum "rust-version" }}-{{ checksum " Cargo.lock" }}
86+ key : cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
7387
7488 setup_environment :
7589 description : " Setup testing environment"
7690 parameters :
7791 cache_key :
7892 type : string
79- default : v4.2.0-rust-1.88.0-snarkvm-stable-cache
93+ default : v4.2.0-rust-1.88.0-snarkvm-cache
94+
8095 steps :
81- - run : set -e
8296 - run :
8397 name : Prepare environment variables and install dependencies
8498 command : |
85- echo 'export "RUSTC_WRAPPER"="$CIRCLE_WORKING_DIRECTORY/. bin/sccache"' >> $BASH_ENV
86- echo 'export "SCCACHE_CACHE_SIZE"="20000M "' >> $BASH_ENV
99+ # Make sure our local bin and cargo bin are on PATH
100+ echo 'export PATH="$HOME/.cargo/bin:$CIRCLE_WORKING_DIRECTORY/.bin:$PATH "' >> " $BASH_ENV"
87101
88- # Disable incremental builds so that sccache works as expected
102+ # sccache settings
103+ echo 'export SCCACHE_DIR="$HOME/.cache/sccache"' >> "$BASH_ENV"
104+ echo 'export SCCACHE_CACHE_SIZE="20000M"' >> "$BASH_ENV"
105+ echo 'export SCCACHE_IDLE_TIMEOUT=0' >> "$BASH_ENV" # keep server alive
106+ echo 'export SCCACHE_LOG=info' >> "$BASH_ENV"
107+
108+ # Disable incremental builds so sccache behaves nicely
89109 echo 'export CARGO_INCREMENTAL=0' >> "$BASH_ENV"
110+
111+ # Use sccache for *all* Rust compile commands
112+ echo 'export RUSTC_WRAPPER="sccache"' >> "$BASH_ENV"
113+
114+ #mkdir -p .cargo
115+ #printf '%s\n' \
116+ # '[build]' \
117+ # 'rustc-wrapper = "/home/circleci/project/.bin/sccache"' \
118+ # > .cargo/config.toml
119+
90120 - run :
91121 name : Install sccache
92122 command : |
93- export WORK_DIR="$CIRCLE_WORKING_DIRECTORY /.cache/sccache"
94- export SCCACHE_DIR="$CIRCLE_WORKING_DIRECTORY /.cache/sccache"
123+ export WORK_DIR="$HOME /.cache/sccache"
124+ export SCCACHE_DIR="$HOME /.cache/sccache"
95125 export SCCACHE_VERSION=v0.10.0
96126 export SCCACHE_PKG="sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl"
97-
127+
98128 mkdir -p "$CIRCLE_WORKING_DIRECTORY/.bin"
99- wget "https://github.com/mozilla/sccache/releases/download/$SCCACHE_VERSION/$SCCACHE_PKG.tar.gz"
100- tar -C "$CIRCLE_WORKING_DIRECTORY/.bin" -xvf "$SCCACHE_PKG.tar.gz"
101- chmod +x "$CIRCLE_WORKING_DIRECTORY/.bin/$SCCACHE_PKG/sccache"
102- mv "$CIRCLE_WORKING_DIRECTORY/.bin/$SCCACHE_PKG/sccache" "$CIRCLE_WORKING_DIRECTORY/.bin/sccache"
103- rm -rf "$CIRCLE_WORKING_DIRECTORY/.cargo/registry"
129+ mkdir -p "$HOME/.cache/sccache"
130+ if [ ! -x "$CIRCLE_WORKING_DIRECTORY/.bin/sccache" ]; then
131+ wget "https://github.com/mozilla/sccache/releases/download/$SCCACHE_VERSION/$SCCACHE_PKG.tar.gz"
132+ tar -C "$CIRCLE_WORKING_DIRECTORY/.bin" -xvf "$SCCACHE_PKG.tar.gz"
133+ chmod +x "$CIRCLE_WORKING_DIRECTORY/.bin/$SCCACHE_PKG/sccache"
134+ mv "$CIRCLE_WORKING_DIRECTORY/.bin/$SCCACHE_PKG/sccache" "$CIRCLE_WORKING_DIRECTORY/.bin/sccache"
135+ rm -rf "$CIRCLE_WORKING_DIRECTORY/.cargo/registry"
136+ fi
104137
105138 - run :
106139 name : Install debian packages
107140 command : |
108141 DEBIAN_FRONTEND=noninteractive sudo apt-get update
109142 DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends clang llvm-dev llvm lld pkg-config xz-utils make libssl-dev libssl-dev
143+
144+ - restore_cache :
145+ keys :
146+ - v4.2.0-rust-1.88.0-deps-{{ checksum "Cargo.lock" }}-
147+ - v4.2.0-rust-1.88.0-deps-
148+
110149 - restore_cache :
111150 keys :
112151 - << parameters.cache_key >>
@@ -116,16 +155,22 @@ commands:
116155 parameters :
117156 cache_key :
118157 type : string
119- default : v4.2.0-rust-1.88.0-snarkvm-stable- cache
158+ default : v4.2.0-rust-1.88.0-snarkvm-cache
120159 steps :
121- - run : (sccache -s || true)
122160 - run : set +e
161+ - save_cache :
162+ key : v4.2.0-rust-1.88.0-deps-{{ checksum "Cargo.lock" }}-{{ epoch }}
163+ paths :
164+ - /home/circleci/.cache/sccache
165+ - /home/circleci/.cargo/registry
166+ - /home/circleci/.cargo/git
167+ - /home/circleci/.rustup
168+ - /home/circleci/.cargo/bin
169+ - /home/circleci/project/.bin
123170 - save_cache :
124171 key : << parameters.cache_key >>
125172 paths :
126173 - /home/circleci/project/target
127- - /home/circleci/.cache/sccache
128- - /home/circleci/.cargo
129174 - /home/circleci/.aleo/resources
130175
131176 run_test :
@@ -150,10 +195,26 @@ commands:
150195 - setup_environment :
151196 cache_key : v4.2.0-rust-1.88.0-<< parameters.workspace_member >><< parameters.cache_key_suffix >>-cache
152197
198+
153199 - run :
154200 name : Install cargo-nextest
155201 command : |
156- cargo install cargo-nextest --locked || true
202+ set -euo pipefail
203+
204+ BIN_ROOT="$CIRCLE_WORKING_DIRECTORY/.bin"
205+ mkdir -p "$BIN_ROOT"
206+
207+ export PATH="$HOME/.cargo/bin:$PATH"
208+ if ! command -v cargo-nextest >/dev/null 2>&1; then
209+ cargo install cargo-nextest --locked
210+ fi
211+
212+ - run :
213+ name : Debug rustc wrapper
214+ command : |
215+ echo "RUSTC_WRAPPER=${RUSTC_WRAPPER:-<unset>}"
216+ which sccache || echo "sccache not found on PATH"
217+ which rustc || echo "rustc not found on PATH"
157218
158219 - run :
159220 name : " Run Tests"
@@ -163,6 +224,18 @@ commands:
163224 set -euo pipefail
164225 export CARGO_TERM_COLOR=never
165226
227+ echo "[debug] PATH=$PATH"
228+ echo "[debug] RUSTC_WRAPPER=${RUSTC_WRAPPER:-<unset>}"
229+ which sccache || echo "[debug] sccache not found on PATH"
230+ which rustc || echo "[debug] rustc not found on PATH"
231+ echo "[debug] SCCACHE_DIR=${SCCACHE_DIR:-<unset>}"
232+ echo "[debug] SCCACHE_LOG=${SCCACHE_LOG:-<unset>}"
233+ echo "[debug] SCCACHE_IDLE_TIMEOUT=${SCCACHE_IDLE_TIMEOUT:-<unset>}"
234+
235+ "$CIRCLE_WORKING_DIRECTORY/.bin/sccache" --zero-stats || true
236+ echo "[sccache stats BEFORE nextest]"
237+ "$CIRCLE_WORKING_DIRECTORY/.bin/sccache" -s || true
238+
166239 # Create artifact + nextest output directories
167240 mkdir -p artifacts target/nextest/ci
168241
@@ -248,9 +321,8 @@ commands:
248321 fi
249322 fi
250323
251- DEFAULT_JOBS=12
324+ DEFAULT_JOBS=8
252325
253- # Default JOBS, overridden by TEST_THREADS if set
254326 JOBS="${NEXTEST_JOBS:-$DEFAULT_JOBS}"
255327 if [ -n "$TEST_THREADS" ]; then
256328 JOBS="$TEST_THREADS"
@@ -286,7 +358,8 @@ commands:
286358 RUST_MIN_STACK=67108864 cargo test --package="<< parameters.workspace_member >>" $BUILD_FLAGS_SANITIZED | tee "$OUT"
287359 : > "$CSV"; : > "$TOP"
288360 else
289- RUST_MIN_STACK=67108864 cargo nextest run \
361+ RUST_MIN_STACK=67108864 \
362+ cargo nextest run \
290363 -p "<< parameters.workspace_member >>" $BUILD_FLAGS_SANITIZED \
291364 --profile ci -j "${JOBS}" "${CFG_ARGS[@]}" \
292365 --status-level fail --hide-progress-bar \
@@ -314,6 +387,9 @@ commands:
314387 fi
315388 fi
316389
390+ echo "[sccache stats AFTER nextest]"
391+ "$CIRCLE_WORKING_DIRECTORY/.bin/sccache" -s || true
392+
317393 - store_artifacts :
318394 path : artifacts
319395 destination : test-timings/<< parameters.workspace_member >>
@@ -339,7 +415,7 @@ jobs:
339415 workspace_member : snarkvm
340416
341417 algorithms :
342- executor : rust-docker
418+ executor : rust-docker
343419 resource_class : << pipeline.parameters.large >>
344420 steps :
345421 - run_test :
@@ -349,11 +425,11 @@ jobs:
349425 executor : rust-docker
350426 resource_class : << pipeline.parameters.medium >>
351427 steps :
352- - run_test : # This runs a single test with profiler enabled
428+ - run_test :
353429 workspace_member : snarkvm-algorithms
354430 flags : varuna::prove_and_verify_with_square_matrix --features profiler
355431 cache_key_suffix : -profiler-test
356-
432+
357433 circuit :
358434 executor : rust-docker
359435 resource_class : << pipeline.parameters.small >>
@@ -732,7 +808,6 @@ jobs:
732808 executor : rust-docker
733809 resource_class : << pipeline.parameters.twoxlarge >>
734810 steps :
735-
736811 - run_test :
737812 workspace_member : snarkvm-ledger-store
738813 flags : --features=rocks
@@ -796,7 +871,7 @@ jobs:
796871 flags : >
797872 --lib --bins --features test
798873 --partition count:1/2
799- -- --test-threads 16
874+ -- --test-threads 8
800875 cache_key_suffix : -test1
801876 timeout : 25m
802877
@@ -809,19 +884,10 @@ jobs:
809884 flags : >
810885 --lib --bins --features test
811886 --partition count:2/2
812- -- --test-threads 16
887+ -- --test-threads 8
813888 cache_key_suffix : -test2
814889 timeout : 25m
815890
816- # synthesizer-mem-heavy:
817- # executor: rust-docker
818- # resource_class: << pipeline.parameters.twoxlarge >>
819- # steps:
820- # - run_test:
821- # workspace_member: snarkvm-synthesizer
822- # flags: -- --ignored test_deployment_synthesis_overload test_deep_nested_execution_cost
823- # cache_key_suffix: -mem-heavy
824-
825891 synthesizer-integration :
826892 executor : rust-docker
827893 resource_class : << pipeline.parameters.twoxlarge >>
@@ -1158,7 +1224,6 @@ workflows:
11581224 - synthesizer
11591225 - synthesizer-test-partition1
11601226 - synthesizer-test-partition2
1161- # - synthesizer-mem-heavy
11621227 - synthesizer-integration
11631228 - synthesizer-process
11641229 - synthesizer-process-with-rocksdb
0 commit comments