use workflows
This commit is contained in:
parent
6e7d368a74
commit
d72169dba9
4 changed files with 143 additions and 59 deletions
|
@ -18,9 +18,36 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Check format
|
name: Check format
|
||||||
command: rustup component add rustfmt-preview; cargo fmt --all -- --check
|
command: rustup component add rustfmt-preview; cargo fmt --all -- --check
|
||||||
# - run:
|
- run:
|
||||||
# name: Download wasm32 target
|
name: Build libsnark
|
||||||
# command: rustup target add wasm32-unknown-unknown
|
command: LIBSNARK_SOURCE_PATH=$HOME/libsnark ./build_libsnark.sh
|
||||||
|
- run:
|
||||||
|
name: Build
|
||||||
|
command: WITH_LIBSNARK=1 LIBSNARK_SOURCE_PATH=$HOME/libsnark 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: rustlang/rust:nightly-slim
|
||||||
|
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: rustup component add rustfmt-preview; cargo fmt --all -- --check
|
||||||
- run:
|
- run:
|
||||||
name: Build libsnark
|
name: Build libsnark
|
||||||
command: LIBSNARK_SOURCE_PATH=$HOME/libsnark ./build_libsnark.sh
|
command: LIBSNARK_SOURCE_PATH=$HOME/libsnark ./build_libsnark.sh
|
||||||
|
@ -30,22 +57,63 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Run tests
|
name: Run tests
|
||||||
command: WITH_LIBSNARK=1 LIBSNARK_SOURCE_PATH=$HOME/libsnark RUSTFLAGS="-D warnings" cargo test --release -- --test-threads=1
|
command: WITH_LIBSNARK=1 LIBSNARK_SOURCE_PATH=$HOME/libsnark RUSTFLAGS="-D warnings" cargo test --release -- --test-threads=1
|
||||||
# - run:
|
|
||||||
# name: Run tests with WASM enabled
|
|
||||||
# command: cd zokrates_core && cargo test --release --features wasm -- --test-threads=1
|
|
||||||
- run:
|
- run:
|
||||||
name: Run integration tests
|
name: Run integration tests
|
||||||
command: WITH_LIBSNARK=1 LIBSNARK_SOURCE_PATH=$HOME/libsnark RUSTFLAGS="-D warnings" cargo test --release -- --ignored
|
command: WITH_LIBSNARK=1 LIBSNARK_SOURCE_PATH=$HOME/libsnark RUSTFLAGS="-D warnings" cargo test --release -- --ignored
|
||||||
- run:
|
- run:
|
||||||
name: Generate code coverage report
|
name: Generate code coverage report
|
||||||
command: ./scripts/cov.sh
|
command: ./scripts/cov.sh
|
||||||
|
wasm_test:
|
||||||
|
docker:
|
||||||
|
- image: rustlang/rust:nightly-slim
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
name: Publish book
|
name: Version information
|
||||||
command: ./scripts/publish_book.sh
|
command: rustc --version; cargo --version; rustup --version
|
||||||
- save_cache:
|
- run:
|
||||||
paths:
|
name: Calculate dependencies
|
||||||
- /usr/local/cargo/registry
|
command: cargo generate-lockfile
|
||||||
- target/debug/.fingerprint
|
- restore_cache:
|
||||||
- target/debug/build
|
keys:
|
||||||
- target/debug/deps
|
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
|
||||||
key: v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
|
- run:
|
||||||
|
name: Download wasm32 target
|
||||||
|
command: rustup target add wasm32-unknown-unknown
|
||||||
|
- run:
|
||||||
|
name: Build libsnark
|
||||||
|
command: LIBSNARK_SOURCE_PATH=$HOME/libsnark ./build_libsnark.sh
|
||||||
|
- run:
|
||||||
|
name: Run tests with WASM enabled
|
||||||
|
command: cd zokrates_core && cargo test --release --features wasm -- --test-threads=1
|
||||||
|
deploy:
|
||||||
|
docker:
|
||||||
|
- image: circleci/python
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- setup_remote_docker:
|
||||||
|
docker_layer_caching: true
|
||||||
|
- run:
|
||||||
|
name: Release
|
||||||
|
command: ./scripts/release.sh
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
build-test-and-deploy:
|
||||||
|
jobs:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
- wasm_test
|
||||||
|
- integration_test
|
||||||
|
- deploy:
|
||||||
|
# filters:
|
||||||
|
# branches:
|
||||||
|
# only:
|
||||||
|
# - master
|
||||||
|
requires:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
- wasm_test
|
||||||
|
- integration_test
|
||||||
|
|
||||||
|
|
||||||
|
|
52
Dockerfile
52
Dockerfile
|
@ -10,24 +10,24 @@ ENV LIBSNARK_SOURCE_PATH=/home/zokrates/libsnark-$LIBSNARK_COMMIT
|
||||||
ENV WITH_LIBSNARK=1
|
ENV WITH_LIBSNARK=1
|
||||||
ENV ZOKRATES_HOME=/home/zokrates/.zokrates
|
ENV ZOKRATES_HOME=/home/zokrates/.zokrates
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
# RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
ca-certificates \
|
# ca-certificates \
|
||||||
build-essential \
|
# build-essential \
|
||||||
cmake \
|
# cmake \
|
||||||
curl \
|
# curl \
|
||||||
libboost-dev \
|
# libboost-dev \
|
||||||
libboost-program-options-dev \
|
# libboost-program-options-dev \
|
||||||
libgmp3-dev \
|
# libgmp3-dev \
|
||||||
libprocps-dev \
|
# libprocps-dev \
|
||||||
libssl-dev \
|
# libssl-dev \
|
||||||
pkg-config \
|
# pkg-config \
|
||||||
python-markdown \
|
# python-markdown \
|
||||||
git \
|
# git \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
# && rm -rf /var/lib/apt/lists/* \
|
||||||
&& git clone https://github.com/scipr-lab/libsnark.git $LIBSNARK_SOURCE_PATH \
|
# && git clone https://github.com/scipr-lab/libsnark.git $LIBSNARK_SOURCE_PATH \
|
||||||
&& git -C $LIBSNARK_SOURCE_PATH checkout $LIBSNARK_COMMIT \
|
# && git -C $LIBSNARK_SOURCE_PATH checkout $LIBSNARK_COMMIT \
|
||||||
&& git -C $LIBSNARK_SOURCE_PATH submodule update --init --recursive \
|
# && git -C $LIBSNARK_SOURCE_PATH submodule update --init --recursive \
|
||||||
&& chown -R zokrates:zokrates $LIBSNARK_SOURCE_PATH
|
# && chown -R zokrates:zokrates $LIBSNARK_SOURCE_PATH
|
||||||
|
|
||||||
USER zokrates
|
USER zokrates
|
||||||
|
|
||||||
|
@ -37,11 +37,11 @@ COPY --chown=zokrates:zokrates . src
|
||||||
|
|
||||||
RUN mkdir $ZOKRATES_HOME
|
RUN mkdir $ZOKRATES_HOME
|
||||||
|
|
||||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_TOOLCHAIN -y \
|
# RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_TOOLCHAIN -y \
|
||||||
&& export PATH=/home/zokrates/.cargo/bin:$PATH \
|
# && export PATH=/home/zokrates/.cargo/bin:$PATH \
|
||||||
&& (cd src;./build_release.sh) \
|
# && (cd src;./build_release.sh) \
|
||||||
&& mv ./src/target/release/zokrates . \
|
# && mv ./src/target/release/zokrates . \
|
||||||
&& mv ./src/zokrates_cli/examples . \
|
# && mv ./src/zokrates_cli/examples . \
|
||||||
&& mv ./src/stdlib/* $ZOKRATES_HOME \
|
# && mv ./src/stdlib/* $ZOKRATES_HOME \
|
||||||
&& rustup self uninstall -y \
|
# && rustup self uninstall -y \
|
||||||
&& rm -rf $LIBSNARK_SOURCE_PATH src
|
# && rm -rf $LIBSNARK_SOURCE_PATH src
|
|
@ -1,18 +0,0 @@
|
||||||
# Exit if any subcommand fails
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ "$CIRCLE_BRANCH" == "master" ]; then
|
|
||||||
apt-get update
|
|
||||||
apt-get -qq install git python-minimal
|
|
||||||
python --version
|
|
||||||
cargo install mdbook
|
|
||||||
cd zokrates_book && mdbook build
|
|
||||||
git config --global user.email "stefan.deml+zokratesbot@decentriq.ch"
|
|
||||||
git clone https://github.com/Zokrates/zokrates.github.io.git
|
|
||||||
git clone https://github.com/davisp/ghp-import.git
|
|
||||||
cd zokrates.github.io
|
|
||||||
TAG=$(cat ../zokrates_cli/Cargo.toml | grep '^version' | awk '{print $3}' | sed -e 's/"//g') && echo $TAG
|
|
||||||
../ghp-import/ghp_import.py -n -p -f -m "Documentation upload. Version: $TAG" -b "master" -r https://zokratesbot:"$GH_TOKEN"@github.com/Zokrates/zokrates.github.io.git ../book
|
|
||||||
echo "Published book"
|
|
||||||
fi
|
|
||||||
|
|
34
scripts/release.sh
Executable file
34
scripts/release.sh
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
# Exit if any subcommand fails
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Get tag
|
||||||
|
TAG=$(cat ./zokrates_cli/Cargo.toml | grep '^version' | awk '{print $3}' | sed -e 's/"//g') && echo $TAG
|
||||||
|
|
||||||
|
# Release on Github
|
||||||
|
git tag $TAG
|
||||||
|
# git push origin $TAG
|
||||||
|
|
||||||
|
# Release on Dockerhub
|
||||||
|
|
||||||
|
# Build
|
||||||
|
docker build -t zokrates .
|
||||||
|
|
||||||
|
## Release under `latest` tag
|
||||||
|
docker tag zokrates:latest zokrates/zokrates:latest
|
||||||
|
#docker push zokrates/zokrates:latest
|
||||||
|
|
||||||
|
## Release under $TAG tag
|
||||||
|
docker tag zokrates:latest zokrates/zokrates:$TAG
|
||||||
|
#docker push zokrates/zokrates:$TAG
|
||||||
|
|
||||||
|
# Publish book
|
||||||
|
python --version
|
||||||
|
cargo install mdbook
|
||||||
|
cd zokrates_book && mdbook build
|
||||||
|
git config --global user.email "stefan.deml+zokratesbot@decentriq.ch"
|
||||||
|
git clone https://github.com/Zokrates/zokrates.github.io.git
|
||||||
|
git clone https://github.com/davisp/ghp-import.git
|
||||||
|
cd zokrates.github.io
|
||||||
|
#../ghp-import/ghp_import.py -n -p -f -m "Documentation upload. Version: $TAG" -b "master" -r https://zokratesbot:"$GH_TOKEN"@github.com/Zokrates/zokrates.github.io.git ../book
|
||||||
|
echo "Published book"
|
||||||
|
|
Loading…
Reference in a new issue