From b4cfa641673ba6d1a59cbe4b1d00e32470e9138f Mon Sep 17 00:00:00 2001 From: Howard Wu <9260812+howardwu@users.noreply.github.com> Date: Sat, 27 Jun 2020 20:16:38 -0700 Subject: [PATCH 1/2] Adds ci.yml (#77) * Adds ci.yml * Update ci script * Update Cargo.toml * Update to ubuntu-latest * Update dependencies * Update git deps with rev * Update ci script * Update ci script * Update ci script * Update code coverage * Update code coverage * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI script * Update CI script --- .github/workflows/ci.yml | 158 +++++++++++++++++++++++++++++++++++++++ Cargo.lock | 12 ++- Cargo.toml | 12 +-- compiler/Cargo.toml | 10 +-- leo-inputs/Cargo.toml | 10 +-- types/Cargo.toml | 4 +- 6 files changed, 186 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..4a44311fba --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,158 @@ +name: CI +on: + pull_request: + push: + branches: + - master +env: + RUST_BACKTRACE: 1 + +jobs: + style: + name: Check Style + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Load snarkOS + run: | + mkdir ~/.ssh + echo "${{ secrets.SNARKOS_DEPLOY_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + eval $(ssh-agent -s) + ssh-add -k ~/.ssh/id_rsa + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + + - name: cargo fmt --check + uses: actions-rs/cargo@v1 + env: + CARGO_NET_GIT_FETCH_WITH_CLI: true + with: + command: fmt + args: --all -- --check + + test: + name: Test + runs-on: ubuntu-latest + env: + RUSTFLAGS: -Dwarnings + strategy: + matrix: + rust: + - stable + - nightly + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Load snarkOS + run: | + mkdir ~/.ssh + echo "${{ secrets.SNARKOS_DEPLOY_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + eval $(ssh-agent -s) + ssh-add -k ~/.ssh/id_rsa + + - name: Install Rust (${{ matrix.rust }}) + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + + - name: Check examples + uses: actions-rs/cargo@v1 + env: + CARGO_NET_GIT_FETCH_WITH_CLI: true + with: + command: check + args: --examples --all + + - name: Check examples with all features on stable + uses: actions-rs/cargo@v1 +# env: +# CARGO_NET_GIT_FETCH_WITH_CLI: true + with: + command: check + args: --examples --all-features --all + if: matrix.rust == 'stable' + + - name: Check benchmarks on nightly + uses: actions-rs/cargo@v1 +# env: +# CARGO_NET_GIT_FETCH_WITH_CLI: true + with: + command: check + args: --all-features --examples --all --benches + if: matrix.rust == 'nightly' + + - name: Test + uses: actions-rs/cargo@v1 +# env: +# CARGO_NET_GIT_FETCH_WITH_CLI: true + with: + command: test + args: --release --all --no-fail-fast + + codecov: + name: Code Coverage + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Load snarkOS + run: | + mkdir ~/.ssh + echo "${{ secrets.SNARKOS_DEPLOY_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + eval $(ssh-agent -s) + ssh-add -k ~/.ssh/id_rsa + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + + - name: Test + uses: actions-rs/cargo@v1 + with: + command: test + args: --all + env: + CARGO_NET_GIT_FETCH_WITH_CLI: true + CARGO_INCREMENTAL: "0" + + - name: Install dependencies for code coverage + run: | + sudo apt-get update + sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev + + - name: Generate coverage report + run: | + wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz + tar xzf master.tar.gz + cd kcov-master + mkdir build && cd build + cmake .. && make + make install DESTDIR=../../kcov-build + cd ../.. + rm -rf kcov-master + for file in target/debug/deps/*-*; do if [[ "$file" != *\.* ]]; then mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; fi done + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Cargo.lock b/Cargo.lock index 3fccd5be74..3fa513cb86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -78,9 +78,9 @@ checksum = "58946044516aa9dc922182e0d6e9d124a31aafe6b421614654eb27cf90cec09c" [[package]] name = "bincode" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf" +checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" dependencies = [ "byteorder", "serde", @@ -946,6 +946,7 @@ checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" [[package]] name = "snarkos-algorithms" version = "0.8.0" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" dependencies = [ "blake2", "derivative", @@ -964,6 +965,7 @@ dependencies = [ [[package]] name = "snarkos-curves" version = "0.8.0" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" dependencies = [ "derivative", "rand", @@ -977,6 +979,7 @@ dependencies = [ [[package]] name = "snarkos-derives" version = "0.1.0" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -986,6 +989,7 @@ dependencies = [ [[package]] name = "snarkos-errors" version = "0.8.0" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" dependencies = [ "base58", "bech32", @@ -998,6 +1002,7 @@ dependencies = [ [[package]] name = "snarkos-gadgets" version = "0.8.0" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" dependencies = [ "derivative", "digest 0.8.1", @@ -1011,6 +1016,7 @@ dependencies = [ [[package]] name = "snarkos-models" version = "0.8.0" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" dependencies = [ "bincode", "derivative", @@ -1025,10 +1031,12 @@ dependencies = [ [[package]] name = "snarkos-profiler" version = "0.8.0" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" [[package]] name = "snarkos-utilities" version = "0.8.0" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" dependencies = [ "bincode", "rand", diff --git a/Cargo.toml b/Cargo.toml index 076c80b80b..17cc6e4e69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,12 +19,12 @@ members = [ "ast", "compiler", "leo-inputs", "types" ] leo-compiler = { path = "compiler", version = "0.1.0" } leo-inputs = { path = "leo-inputs", version = "0.1.0"} -snarkos-algorithms = { path = "../snarkOS/algorithms", version = "0.8.0", default-features = false } -snarkos-curves = { path = "../snarkOS/curves", version = "0.8.0", default-features = false } -snarkos-errors = { path = "../snarkOS/errors", version = "0.8.0", default-features = false } -snarkos-gadgets = { path = "../snarkOS/gadgets", version = "0.8.0", default-features = false } -snarkos-models = { path = "../snarkOS/models", version = "0.8.0", default-features = false } -snarkos-utilities = { path = "../snarkOS/utilities", version = "0.8.0" } +snarkos-algorithms = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9" } clap = { version = "2.33.0" } colored = { version = "1.9" } diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 3a528a946c..cbf4c1d846 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -9,10 +9,10 @@ leo-ast = { path = "../ast", version = "0.1.0" } leo-types = { path = "../types", version = "0.1.0" } leo-inputs = { path = "../leo-inputs", version = "0.1.0" } -snarkos-curves = { path = "../../snarkOS/curves", version = "0.8.0", default-features = false } -snarkos-errors = { path = "../../snarkOS/errors", version = "0.8.0", default-features = false } -snarkos-gadgets = { path = "../../snarkOS/gadgets", version = "0.8.0", default-features = false } -snarkos-models = { path = "../../snarkOS/models", version = "0.8.0", default-features = false } +snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } hex = { version = "0.4.2" } log = { version = "0.4" } @@ -22,4 +22,4 @@ sha2 = { version = "0.8" } thiserror = { version = "1.0" } [dev-dependencies] -snarkos-utilities = { path = "../../snarkOS/utilities", version = "0.8.0" } +snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9" } diff --git a/leo-inputs/Cargo.toml b/leo-inputs/Cargo.toml index 9b41c18964..8d4f212f42 100644 --- a/leo-inputs/Cargo.toml +++ b/leo-inputs/Cargo.toml @@ -5,11 +5,11 @@ authors = ["The Aleo Team "] edition = "2018" [dependencies] -snarkos-algorithms = { path = "../../snarkOS/algorithms", version = "0.8.0", default-features = false } -snarkos-curves = { path = "../../snarkOS/curves", version = "0.8.0", default-features = false } -snarkos-errors = { path = "../../snarkOS/errors", version = "0.8.0", default-features = false } -snarkos-gadgets = { path = "../../snarkOS/gadgets", version = "0.8.0", default-features = false } -snarkos-models = { path = "../../snarkOS/models", version = "0.8.0", default-features = false } +snarkos-algorithms = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } from-pest = { version = "0.3.1" } pest = { version = "2.0" } diff --git a/types/Cargo.toml b/types/Cargo.toml index 03c2901821..4925f2a017 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" leo-ast = { path = "../ast", version = "0.1.0" } leo-inputs = { path = "../leo-inputs", version = "0.1.0" } -snarkos-errors = { path = "../../snarkOS/errors", version = "0.8.0", default-features = false } -snarkos-models = { path = "../../snarkOS/models", version = "0.8.0", default-features = false } +snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } pest = { version = "2.0" } thiserror = { version = "1.0" } From cbe65e1c6cc45f522ea33d94d30ee4a1f1d42e8f Mon Sep 17 00:00:00 2001 From: howardwu Date: Sat, 27 Jun 2020 23:56:31 -0700 Subject: [PATCH 2/2] Cleanup CI --- .github/workflows/ci.yml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a44311fba..f63c0c5b21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,34 +73,28 @@ jobs: env: CARGO_NET_GIT_FETCH_WITH_CLI: true with: - command: check - args: --examples --all + command: check + args: --examples --all - name: Check examples with all features on stable uses: actions-rs/cargo@v1 -# env: -# CARGO_NET_GIT_FETCH_WITH_CLI: true with: - command: check - args: --examples --all-features --all + command: check + args: --examples --all-features --all if: matrix.rust == 'stable' - name: Check benchmarks on nightly uses: actions-rs/cargo@v1 -# env: -# CARGO_NET_GIT_FETCH_WITH_CLI: true with: - command: check - args: --all-features --examples --all --benches + command: check + args: --all-features --examples --all --benches if: matrix.rust == 'nightly' - name: Test uses: actions-rs/cargo@v1 -# env: -# CARGO_NET_GIT_FETCH_WITH_CLI: true with: - command: test - args: --release --all --no-fail-fast + command: test + args: --release --all --no-fail-fast codecov: name: Code Coverage