1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00
ZoKrates/.circleci/config.yml
2021-04-27 20:50:16 +02:00

245 lines
7 KiB
YAML

version: 2.1
executors:
linux:
machine:
image: ubuntu-2004:202101-01
macos:
macos:
xcode: 12.4.0
jobs:
cross_build:
parameters:
os:
type: executor
target:
type: string
executor: << parameters.os >>
steps:
- checkout
- run:
name: Calculate dependencies
command: cargo generate-lockfile
- restore_cache:
keys:
- v1-cargo-cache-<< parameters.target >>-{{ checksum "Cargo.lock" }}
- run:
no_output_timeout: "30m"
command: cross build --target << parameters.target >> --release
- upload_artifacts:
tag: test
target: << parameters.target >>
- save_cache:
paths:
- /usr/local/cargo/registry
- target/<< parameters.target >>/release/.fingerprint
- target/<< parameters.target >>/release/build
- target/<< parameters.target >>/release/deps
key: v1-cargo-cache-<< parameters.target >>-{{ checksum "Cargo.lock" }}
# 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
# command: WITH_LIBSNARK=1 RUSTFLAGS="-D warnings" ./full_test.sh
# deploy:
# docker:
# - image: circleci/python:latest-node
# steps:
# - checkout
# - setup_remote_docker:
# docker_layer_caching: true
# - run:
# name: Release
# command: ./scripts/release.sh
# zokrates_js_build:
# docker:
# - image: zokrates/env:latest
# steps:
# - checkout
# - run:
# name: Build
# command: cd zokrates_js && npm run build:dev
# zokrates_js_test:
# docker:
# - image: zokrates/env:latest
# steps:
# - checkout
# - run:
# command: cd zokrates_js && npm run test
# publish_artifacts:
# docker:
# - image: cibuilds/github:0.10
# steps:
# - attach_workspace:
# at: ./artifacts
# - run:
# name: "Publish Release on GitHub"
# command: ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ./artifacts/
commands:
install_rust:
description: "Install Rust nightly"
steps:
- run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly -y
source $HOME/.cargo/env
install_cross:
description: "Install cross"
steps:
- run: cargo install --git https://github.com/rust-embedded/cross
upload_artifacts:
parameters:
tag:
type: string
target:
type: string
description: "Store build artifacts in CircleCI"
steps:
- run: |
mkdir -p /build
find target/<< parameters.target >>/release -maxdepth 1 -type f | grep -E "zokrates(\.exe)?$" | xargs -i cp {} /build/
cp -r zokrates_stdlib/stdlib /build/
cd /build
tar czf zokrates-<< parameters.tag >>-<< parameters.target >>.tar.gz *
- store_artifacts:
path: /build/zokrates-<< parameters.tag >>-<< parameters.target >>.tar.gz
workflows:
build-test-and-deploy:
jobs:
- cross_build:
pre-steps:
- install_rust
- install_cross
matrix:
parameters:
os:
- linux
target:
- aarch64-unknown-linux-gnu
- arm-unknown-linux-gnueabi
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- cross_build:
pre-steps:
- install_rust
- install_cross
matrix:
parameters:
os:
- macos
target:
- x86_64-apple-darwin
# - build
# - test
# - cpp_format
# - wasm_test
# - integration_test
# - zokrates_js_build
# - zokrates_js_test
# - deploy:
# filters:
# branches:
# only:
# - deploy
# requires:
# - build
# - test
# - cpp_format
# - wasm_test
# - integration_test
# - zokrates_js_build
# - zokrates_js_test