308 lines
8.6 KiB
YAML
308 lines
8.6 KiB
YAML
version: 2.1
|
|
|
|
executors:
|
|
linux:
|
|
machine:
|
|
image: ubuntu-2004:202101-01
|
|
macos:
|
|
macos:
|
|
xcode: 12.4.0
|
|
|
|
jobs:
|
|
build:
|
|
docker:
|
|
- image: zokrates/env:latest
|
|
resource_class: large
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Version information
|
|
command: rustc --version; cargo --version; rustup --version
|
|
- run:
|
|
name: Calculate dependencies
|
|
command: cargo generate-lockfile
|
|
- restore_cache:
|
|
keys:
|
|
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
- 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: v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
test:
|
|
docker:
|
|
- image: zokrates/env:latest
|
|
resource_class: large
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Version information
|
|
command: rustc --version; cargo --version; rustup --version
|
|
- run:
|
|
name: Calculate dependencies
|
|
command: cargo generate-lockfile
|
|
- restore_cache:
|
|
keys:
|
|
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
- run:
|
|
name: Check format
|
|
command: cargo fmt --all -- --check
|
|
- run:
|
|
name: Run clippy
|
|
command: cargo clippy -- -D warnings
|
|
- run:
|
|
name: Run tests
|
|
command: WITH_LIBSNARK=1 RUSTFLAGS="-D warnings" ./test.sh
|
|
# - run:
|
|
# name: Generate code coverage report
|
|
# command: ./scripts/cov.sh
|
|
cpp_format:
|
|
docker:
|
|
- image: zokrates/env:latest
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Check cpp format (clang-format)
|
|
command: run-clang-format.py -r $(pwd)/zokrates_core/lib
|
|
wasm_test:
|
|
docker:
|
|
- image: zokrates/env:latest
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Version information
|
|
command: rustc --version; cargo --version; rustup --version
|
|
- run:
|
|
name: Calculate dependencies
|
|
command: cargo generate-lockfile
|
|
- restore_cache:
|
|
keys:
|
|
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
- run:
|
|
name: Test on firefox
|
|
command: |
|
|
cd zokrates_core
|
|
wasm-pack test --firefox --headless -- --no-default-features --features "wasm bellman"
|
|
integration_test:
|
|
docker:
|
|
- image: zokrates/env:latest
|
|
- image: trufflesuite/ganache-cli:next
|
|
resource_class: large
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Version information
|
|
command: rustc --version; cargo --version; rustup --version
|
|
- run:
|
|
name: Calculate dependencies
|
|
command: cargo generate-lockfile
|
|
- restore_cache:
|
|
keys:
|
|
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
- run:
|
|
name: Run integration tests
|
|
no_output_timeout: "30m"
|
|
command: WITH_LIBSNARK=1 RUSTFLAGS="-D warnings" ./integration_test.sh
|
|
deploy:
|
|
docker:
|
|
- image: cimg/python:3.8-node
|
|
steps:
|
|
- checkout
|
|
- setup_remote_docker:
|
|
docker_layer_caching: true
|
|
- run:
|
|
name: Release
|
|
no_output_timeout: "30m"
|
|
command: ./scripts/release.sh
|
|
zokrates_js_build:
|
|
docker:
|
|
- image: zokrates/env:latest
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Build
|
|
no_output_timeout: "30m"
|
|
command: cd zokrates_js && npm run build:dev
|
|
zokrates_js_test:
|
|
docker:
|
|
- image: zokrates/env:latest
|
|
working_directory: ~/project/zokrates_js
|
|
steps:
|
|
- checkout:
|
|
path: ~/project
|
|
- run:
|
|
name: Check format
|
|
command: cargo fmt --all -- --check
|
|
- run:
|
|
name: Run clippy
|
|
command: cargo clippy -- -D warnings
|
|
- run:
|
|
name: Run tests
|
|
no_output_timeout: "30m"
|
|
command: npm run test
|
|
cross_build:
|
|
parameters:
|
|
os:
|
|
type: executor
|
|
target:
|
|
type: string
|
|
add-target:
|
|
type: boolean
|
|
default: false
|
|
build-with:
|
|
type: string
|
|
default: cross
|
|
executor: << parameters.os >>
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Calculate dependencies
|
|
command: cargo generate-lockfile
|
|
- when:
|
|
condition: << parameters.add-target >>
|
|
steps:
|
|
- run: rustup target add << parameters.target >>
|
|
- run:
|
|
name: Build
|
|
no_output_timeout: "30m"
|
|
command: RUSTFLAGS="--remap-path-prefix=$PWD=" << parameters.build-with >> build --target << parameters.target >> --release
|
|
- tar_artifacts:
|
|
target: << parameters.target >>
|
|
publish_artifacts:
|
|
docker:
|
|
- image: circleci/golang
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/artifacts
|
|
- run:
|
|
name: "Publish artifacts on GitHub"
|
|
command: |
|
|
go get github.com/github-release/github-release
|
|
github-release release \
|
|
-s ${GH_TOKEN} \
|
|
-u ${CIRCLE_PROJECT_USERNAME} \
|
|
-r ${CIRCLE_PROJECT_REPONAME} \
|
|
-t ${CIRCLE_TAG} || true
|
|
find /tmp/artifacts -type f -name *.tar.gz -exec basename {} \; | xargs -I {} github-release upload \
|
|
-s ${GH_TOKEN} \
|
|
-u ${CIRCLE_PROJECT_USERNAME} \
|
|
-r ${CIRCLE_PROJECT_REPONAME} \
|
|
-t ${CIRCLE_TAG} \
|
|
-n "{}" \
|
|
-f /tmp/artifacts/{}
|
|
|
|
commands:
|
|
install_rust:
|
|
steps:
|
|
- run:
|
|
name: Install Rust
|
|
command: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
source $HOME/.cargo/env
|
|
install_cross:
|
|
steps:
|
|
- run:
|
|
name: Install rust-embedded/cross
|
|
command: cargo install --git https://github.com/rust-embedded/cross
|
|
tar_artifacts:
|
|
parameters:
|
|
target:
|
|
type: string
|
|
steps:
|
|
- run:
|
|
name: Store build artifacts
|
|
command: |
|
|
mkdir -p /tmp/artifacts
|
|
find target/<< parameters.target >>/release -maxdepth 1 -type f | grep -E "zokrates(\.exe)?$" | xargs -I {} cp {} /tmp/artifacts/
|
|
cp -r zokrates_stdlib/stdlib /tmp/artifacts/
|
|
cd /tmp/artifacts
|
|
tar czf zokrates-${CIRCLE_TAG}-<< parameters.target >>.tar.gz *
|
|
ls | grep -v *.tar.gz | xargs rm -rf
|
|
- store_artifacts:
|
|
path: /tmp/artifacts
|
|
- persist_to_workspace:
|
|
root: /tmp/artifacts
|
|
paths:
|
|
- zokrates-*-<< parameters.target >>.tar.gz
|
|
|
|
tag-only: &tag-only
|
|
filters:
|
|
branches:
|
|
ignore: /.*/
|
|
tags:
|
|
only: /^\d+\.\d+\.\d+$/
|
|
|
|
workflows:
|
|
build-test-and-deploy:
|
|
jobs:
|
|
- build
|
|
- test
|
|
- cpp_format
|
|
- wasm_test
|
|
- integration_test
|
|
- zokrates_js_build
|
|
- zokrates_js_test
|
|
- cross_build:
|
|
<<: *tag-only
|
|
pre-steps:
|
|
- install_rust
|
|
- install_cross
|
|
matrix:
|
|
alias: cross-build-linux
|
|
parameters:
|
|
os:
|
|
- linux
|
|
target:
|
|
- aarch64-unknown-linux-gnu
|
|
- arm-unknown-linux-gnueabi
|
|
- x86_64-unknown-linux-gnu
|
|
- x86_64-pc-windows-gnu
|
|
- cross_build:
|
|
<<: *tag-only
|
|
pre-steps:
|
|
- install_rust
|
|
build-with: cargo
|
|
matrix:
|
|
alias: cross-build-macos
|
|
parameters:
|
|
os:
|
|
- macos
|
|
target:
|
|
- x86_64-apple-darwin
|
|
- cross_build:
|
|
<<: *tag-only
|
|
pre-steps:
|
|
- install_rust
|
|
build-with: SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) cargo
|
|
add-target: true
|
|
matrix:
|
|
alias: cross-build-apple-silicon
|
|
parameters:
|
|
os:
|
|
- macos
|
|
target:
|
|
- aarch64-apple-darwin
|
|
- publish_artifacts:
|
|
<<: *tag-only
|
|
requires:
|
|
- cross-build-linux
|
|
- cross-build-macos
|
|
- cross-build-apple-silicon
|
|
- deploy:
|
|
filters:
|
|
branches:
|
|
only:
|
|
- deploy
|
|
requires:
|
|
- build
|
|
- test
|
|
- cpp_format
|
|
- wasm_test
|
|
- integration_test
|
|
- zokrates_js_build
|
|
- zokrates_js_test
|