From daad609826f66b797c5a3e9554af76c1015c4780 Mon Sep 17 00:00:00 2001 From: Matthias Goergens Date: Tue, 19 Nov 2024 17:57:03 +0800 Subject: [PATCH] Set up Continuous Integration --- .github/workflows/ci.yml | 100 +++++++++++++++++++++++++++++++++++++++ README.md | 8 ++++ 2 files changed, 108 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..27dde347 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,100 @@ +name: Sanity checks + +on: + merge_group: + push: + branches: + - '**' + +jobs: + sanity: + name: Sanity check + timeout-minutes: 30 + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@master + with: + components: rustfmt + # TODO(Matthias): see whether we can keep this in sync with rust-toolchain.toml automatically? + toolchain: nightly-2024-10-03 + - name: Cargo cache + uses: actions/cache@v3 + with: + # target directories gotten via + # `find . -name target -type d -not -path '*/src/*' -printf '%P\n' | sort` + # We need to exclude `./circ_blocks/src/target` because it just a source directory with an unfortunate name. + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + circ_blocks/circ_fields/target + circ_blocks/circ_hc/target + circ_blocks/circ_opt/target + circ_blocks/circ_waksman/target + circ_blocks/target + circ_blocks/third_party/ZoKrates/zokrates_parser/target + circ_blocks/third_party/ZoKrates/zokrates_pest_ast/target + circ_blocks/third_party/ZoKrates/zokrates_stdlib/target + ff/ff_derive/target + ff/target + spartan_parallel/target + zok_tests/poseidon_gen/target + key: sanity-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} + + - name: Run sanity check + run: | + set -euxo pipefail + + for cargo_toml in $(git ls-files '**/Cargo.toml'); do + ( + cd "$(dirname ${cargo_toml})" + cargo fmt --check + cargo check --all-targets + ) + done + + legacy-scripts: + name: Run legacy scripts + timeout-minutes: 30 + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@master + with: + # TODO(Matthias): see whether we can keep this in sync with rust-toolchain.toml automatically? + toolchain: nightly-2024-10-03 + - name: Cargo cache + uses: actions/cache@v3 + with: + # target directories gotten via + # `find . -name target -type d -not -path '*/src/*' -printf '%P\n' | sort` + # We need to exclude `./circ_blocks/src/target` because it just a source directory with an unfortunate name. + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + circ_blocks/circ_fields/target + circ_blocks/circ_hc/target + circ_blocks/circ_opt/target + circ_blocks/circ_waksman/target + circ_blocks/target + circ_blocks/third_party/ZoKrates/zokrates_parser/target + circ_blocks/third_party/ZoKrates/zokrates_pest_ast/target + circ_blocks/third_party/ZoKrates/zokrates_stdlib/target + ff/ff_derive/target + ff/target + spartan_parallel/target + zok_tests/poseidon_gen/target + key: scripts-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} + + - name: Run legacy scripts + run: | + set -euxo pipefail + ./setup.sh + # TODO: fix, then enable it. + # ./encode_ceno.sh diff --git a/README.md b/README.md index f96fc143..0c8176a6 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,11 @@ Many flags are WIP. For temporary hacks, alter the code directly and recompile t #### Working with a different field #### Verify circuit using `spartan_parallel` (only supported in Curve25519) + +# Continuous Integration + +At the moment we only have a [simple CI](.github/workflows/) that checks formatting and `cargo check` and runs [setup.sh](setup.sh) and [encode_ceno.sh](encode_ceno.sh). + +TODO: +- [ ] run tests in CI, too. (That means we need to fix our tests.) +- [ ] reorganise the code, so that we only need a single `carge check` or `cargo test` instead of having to run that in a dozen different directories.