From 1231df62044b4a1eac2f3ca6dec343db1722d632 Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 17:20:44 +0200 Subject: [PATCH 01/18] add sccache --- .circleci/config.yml | 86 +++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 37 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cfefdba7..d284a455 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: From 24dfa453bb669c45517b6b1da25aee92f34b0370 Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 17:30:34 +0200 Subject: [PATCH 02/18] format and test cache --- .circleci/config.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d284a455..e3f3cfbe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,7 +24,6 @@ jobs: name: Build command: WITH_LIBSNARK=1 RUSTFLAGS="-D warnings" ./build.sh - save-sccache-cache - test: docker: - image: zokrates/env:latest @@ -46,7 +45,6 @@ jobs: name: Run tests command: WITH_LIBSNARK=1 RUSTFLAGS="-D warnings" ./test.sh - save-sccache-cache - cpp_format: docker: - image: zokrates/env:latest @@ -71,7 +69,6 @@ jobs: cd zokrates_core wasm-pack test --firefox --headless -- --no-default-features --features "wasm bellman" - save-sccache-cache - integration_test: docker: - image: zokrates/env:latest @@ -89,7 +86,6 @@ jobs: 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 From 52128858d9a8d9fa95755748637a88bcf0591f73 Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 17:59:01 +0200 Subject: [PATCH 03/18] test --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e3f3cfbe..7df04655 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,3 +1,4 @@ + version: 2.1 executors: From e734bd57a71f76c177587b340fdfa849dfc42b51 Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 18:02:46 +0200 Subject: [PATCH 04/18] install sccache from binary --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7df04655..eae09f4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -184,7 +184,9 @@ commands: - run: name: Install sccache command: | - cargo install sccache + sudo apt-get install -y pkg-config libssl-dev + curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-unknown-linux-musl.tar.gz | tar xzf - + mv sccache-0.2.15-x86_64-unknown-linux-musl/sccache .cargo/bin/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. From 1667694d80daaf601ac1675d4d3ef56b55f53d5e Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 18:06:33 +0200 Subject: [PATCH 05/18] remove sudo --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eae09f4b..d1bde221 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -184,7 +184,7 @@ commands: - run: name: Install sccache command: | - sudo apt-get install -y pkg-config libssl-dev + apt-get install -y pkg-config libssl-dev curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-unknown-linux-musl.tar.gz | tar xzf - mv sccache-0.2.15-x86_64-unknown-linux-musl/sccache .cargo/bin/sccache # This configures Rust to use sccache. From d276298887a845321fed6b4466060abcea078730 Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 18:09:55 +0200 Subject: [PATCH 06/18] fix sccache version --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d1bde221..dd7a3113 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -185,8 +185,8 @@ commands: name: Install sccache command: | apt-get install -y pkg-config libssl-dev - curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-unknown-linux-musl.tar.gz | tar xzf - - mv sccache-0.2.15-x86_64-unknown-linux-musl/sccache .cargo/bin/sccache + curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xzf - + mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache .cargo/bin/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. From fafc774026ad7fa64c590e3d1f818a9a486c8681 Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 18:16:59 +0200 Subject: [PATCH 07/18] create bin dir --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index dd7a3113..319120bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -186,6 +186,7 @@ commands: command: | apt-get install -y pkg-config libssl-dev curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xzf - + mkdir -p .cargo/bin mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache .cargo/bin/sccache # This configures Rust to use sccache. echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV From 13953bd7315958047e63daab9642a2ae001f0bd0 Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 18:22:33 +0200 Subject: [PATCH 08/18] fix --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 319120bc..30bb982f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -192,7 +192,6 @@ commands: 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: From 38e9d7527ebf2930ef3af257d203d7819ff618fb Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 18:47:26 +0200 Subject: [PATCH 09/18] change bin folder --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 30bb982f..b0954a28 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -186,8 +186,7 @@ commands: command: | apt-get install -y pkg-config libssl-dev curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xzf - - mkdir -p .cargo/bin - mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache .cargo/bin/sccache + mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache §HOME/bin # This configures Rust to use sccache. echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV # This is the maximum space sccache cache will use on disk. From 8621d23441cc0155bbb460ed6bd41a314b980ddb Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 5 Apr 2022 18:49:21 +0200 Subject: [PATCH 10/18] typo --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b0954a28..2c71eafe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -186,7 +186,7 @@ commands: command: | apt-get install -y pkg-config libssl-dev curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xzf - - mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache §HOME/bin + mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache $HOME/bin # This configures Rust to use sccache. echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV # This is the maximum space sccache cache will use on disk. From bebe64b611748872ece1666d764080b9dcedd9f0 Mon Sep 17 00:00:00 2001 From: schaeff Date: Wed, 6 Apr 2022 10:09:19 +0200 Subject: [PATCH 11/18] full path --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c71eafe..f903543f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -188,7 +188,7 @@ commands: curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xzf - mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache $HOME/bin # This configures Rust to use sccache. - echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV + echo 'export "RUSTC_WRAPPER"="$HOME/bin/sccache"' >> $BASH_ENV # This is the maximum space sccache cache will use on disk. echo 'export "SCCACHE_CACHE_SIZE"="1G"' >> $BASH_ENV restore-sccache-cache: From 93d781ec775ab0b981081f0713c31b1a12f257cb Mon Sep 17 00:00:00 2001 From: schaeff Date: Wed, 6 Apr 2022 10:11:37 +0200 Subject: [PATCH 12/18] usr path --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f903543f..1a763463 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -186,9 +186,9 @@ commands: command: | apt-get install -y pkg-config libssl-dev curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xzf - - mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache $HOME/bin + mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache /usr/local/bin # This configures Rust to use sccache. - echo 'export "RUSTC_WRAPPER"="$HOME/bin/sccache"' >> $BASH_ENV + echo 'export "RUSTC_WRAPPER"="/usr/local/bin/sccache"' >> $BASH_ENV # This is the maximum space sccache cache will use on disk. echo 'export "SCCACHE_CACHE_SIZE"="1G"' >> $BASH_ENV restore-sccache-cache: From 142526488c5bfed7dd83df0dc24f7e82b3274480 Mon Sep 17 00:00:00 2001 From: schaeff Date: Wed, 6 Apr 2022 10:16:45 +0200 Subject: [PATCH 13/18] print version --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a763463..2a2de84d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -191,6 +191,7 @@ commands: echo 'export "RUSTC_WRAPPER"="/usr/local/bin/sccache"' >> $BASH_ENV # This is the maximum space sccache cache will use on disk. echo 'export "SCCACHE_CACHE_SIZE"="1G"' >> $BASH_ENV + /usr/local/bin/sccache --version restore-sccache-cache: steps: - restore_cache: From d256faaedbc735d9bd0c8a23371e771e8fd17f41 Mon Sep 17 00:00:00 2001 From: schaeff Date: Wed, 6 Apr 2022 10:21:05 +0200 Subject: [PATCH 14/18] revert --- .circleci/config.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2a2de84d..8f397755 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -185,13 +185,10 @@ commands: name: Install sccache command: | apt-get install -y pkg-config libssl-dev - curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xzf - - mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache /usr/local/bin - # This configures Rust to use sccache. - echo 'export "RUSTC_WRAPPER"="/usr/local/bin/sccache"' >> $BASH_ENV - # This is the maximum space sccache cache will use on disk. + curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-unknown-linux-musl.tar.gz | tar xzf - + mv sccache-0.2.12-x86_64-unknown-linux-musl/sccache .cargo/bin/sccache + echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV echo 'export "SCCACHE_CACHE_SIZE"="1G"' >> $BASH_ENV - /usr/local/bin/sccache --version restore-sccache-cache: steps: - restore_cache: From 84c69130d57cc36e20c7be2a3eae7277f86d7ca9 Mon Sep 17 00:00:00 2001 From: schaeff Date: Wed, 6 Apr 2022 10:26:58 +0200 Subject: [PATCH 15/18] fix cargo dir --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f397755..ddd60128 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -186,7 +186,7 @@ commands: command: | apt-get install -y pkg-config libssl-dev curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-unknown-linux-musl.tar.gz | tar xzf - - mv sccache-0.2.12-x86_64-unknown-linux-musl/sccache .cargo/bin/sccache + mv sccache-0.2.12-x86_64-unknown-linux-musl/sccache /usr/local/cargo/bin/sccache echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV echo 'export "SCCACHE_CACHE_SIZE"="1G"' >> $BASH_ENV restore-sccache-cache: From 0e8a146a712e5323d0fd6341b9cba2e134916994 Mon Sep 17 00:00:00 2001 From: schaeff Date: Wed, 6 Apr 2022 10:28:58 +0200 Subject: [PATCH 16/18] upgrade sccache --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ddd60128..d40034d7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -185,8 +185,8 @@ commands: name: Install sccache command: | apt-get install -y pkg-config libssl-dev - curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-unknown-linux-musl.tar.gz | tar xzf - - mv sccache-0.2.12-x86_64-unknown-linux-musl/sccache /usr/local/cargo/bin/sccache + curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xzf - + mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache /usr/local/cargo/bin/sccache echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV echo 'export "SCCACHE_CACHE_SIZE"="1G"' >> $BASH_ENV restore-sccache-cache: From 6ba8a590b9be25e85947fdecf362114e01973fd5 Mon Sep 17 00:00:00 2001 From: schaeff Date: Wed, 6 Apr 2022 10:34:11 +0200 Subject: [PATCH 17/18] version 14 --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d40034d7..05d08b3f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -185,8 +185,8 @@ commands: name: Install sccache command: | apt-get install -y pkg-config libssl-dev - curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xzf - - mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache /usr/local/cargo/bin/sccache + curl -o- -sSLf https://github.com/mozilla/sccache/releases/download/0.2.14/sccache-0.2.14-x86_64-unknown-linux-musl.tar.gz | tar xzf - + mv sccache-0.2.14-x86_64-unknown-linux-musl/sccache /usr/local/cargo/bin/sccache echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV echo 'export "SCCACHE_CACHE_SIZE"="1G"' >> $BASH_ENV restore-sccache-cache: From 6809ffad0de0dd79c28997b45c39a915fe592089 Mon Sep 17 00:00:00 2001 From: schaeff Date: Wed, 6 Apr 2022 10:53:19 +0200 Subject: [PATCH 18/18] test cache --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 05d08b3f..33161b84 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,3 @@ - version: 2.1 executors: