1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00

add sccache

This commit is contained in:
schaeff 2022-04-05 17:20:44 +02:00
parent 99301d7521
commit 1231df6204

View file

@ -18,22 +18,13 @@ jobs:
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- run:
name: Calculate dependencies
command: cargo generate-lockfile
- restore_cache:
keys:
- cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Build
command: WITH_LIBSNARK=1 RUSTFLAGS="-D warnings" ./build.sh
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
key: cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
- save-sccache-cache
test:
docker:
- image: zokrates/env:latest
@ -43,12 +34,8 @@ jobs:
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- run:
name: Calculate dependencies
command: cargo generate-lockfile
- restore_cache:
keys:
- cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Check format
command: cargo fmt --all -- --check
@ -58,9 +45,8 @@ jobs:
- run:
name: Run tests
command: WITH_LIBSNARK=1 RUSTFLAGS="-D warnings" ./test.sh
# - run:
# name: Generate code coverage report
# command: ./scripts/cov.sh
- save-sccache-cache
cpp_format:
docker:
- image: zokrates/env:latest
@ -77,17 +63,15 @@ jobs:
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- run:
name: Calculate dependencies
command: cargo generate-lockfile
- restore_cache:
keys:
- cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Test on firefox
command: |
cd zokrates_core
wasm-pack test --firefox --headless -- --no-default-features --features "wasm bellman"
- save-sccache-cache
integration_test:
docker:
- image: zokrates/env:latest
@ -98,16 +82,14 @@ jobs:
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- run:
name: Calculate dependencies
command: cargo generate-lockfile
- restore_cache:
keys:
- cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Run integration tests
no_output_timeout: "30m"
command: WITH_LIBSNARK=1 RUSTFLAGS="-D warnings" ./integration_test.sh
- save-sccache-cache
deploy:
docker:
- image: cimg/python:3.8-node
@ -135,6 +117,8 @@ jobs:
steps:
- checkout:
path: ~/project
- setup-sccache
- restore-sccache-cache
- run:
name: Check format
command: cargo fmt --all -- --check
@ -145,6 +129,7 @@ jobs:
name: Run tests
no_output_timeout: "30m"
command: npm run test
- save-sccache-cache
cross_build:
parameters:
os:
@ -160,9 +145,8 @@ jobs:
executor: << parameters.os >>
steps:
- checkout
- run:
name: Calculate dependencies
command: cargo generate-lockfile
- setup-sccache
- restore-sccache-cache
- when:
condition: << parameters.add-target >>
steps:
@ -171,6 +155,7 @@ jobs:
name: Build
no_output_timeout: "1h"
command: RUSTFLAGS="--remap-path-prefix=$PWD=" << parameters.build-with >> build --target << parameters.target >> --release
- save-sccache-cache
- tar_artifacts:
target: << parameters.target >>
publish_artifacts:
@ -197,6 +182,33 @@ jobs:
-f /tmp/artifacts/{}
commands:
setup-sccache:
steps:
- run:
name: Install sccache
command: |
cargo install sccache
# This configures Rust to use sccache.
echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV
# This is the maximum space sccache cache will use on disk.
echo 'export "SCCACHE_CACHE_SIZE"="1G"' >> $BASH_ENV
sccache --version
restore-sccache-cache:
steps:
- restore_cache:
name: Restore sccache cache
key: sccache-cache-stable-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
save-sccache-cache:
steps:
- save_cache:
name: Save sccache cache
# We use {{ epoch }} to always upload a fresh cache:
# Of course, restore_cache will not find this exact key,
# but it will fall back to the closest key (aka the most recent).
# See https://discuss.circleci.com/t/add-mechanism-to-update-existing-cache-key/9014/13
key: sccache-cache-stable-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ epoch }}
paths:
- "~/.cache/sccache"
install_rust:
steps:
- run: