diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 752af4a..b717c10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,14 +14,11 @@ on: name: General jobs: - build: - strategy: - matrix: - platform: [ ubuntu-latest, macos-latest ] - runs-on: ${{ matrix.platform }} + build-ubuntu-latest: + runs-on: ubuntu-latest timeout-minutes: 60 - name: build - ${{ matrix.platform }} + name: build - ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install stable toolchain @@ -30,16 +27,10 @@ jobs: profile: minimal toolchain: nightly override: true - - name: install risc0 + - name: build - ubuntu-latest if: success() || failure() - run: | - curl -L https://risczero.com/install | bash - - name: install risc0 step 2 - if: success() || failure() - run: | - source /home/runner/.bashrc && rzup install && source /home/runner/.bashrc - - uses: Swatinem/rust-cache@v2 - - run: cargo build + run: chmod 777 ./ci_scripts/build-ubuntu.sh && ./ci_scripts/build-ubuntu.sh + lint: strategy: @@ -59,30 +50,11 @@ jobs: toolchain: nightly override: true components: rustfmt, clippy - - uses: Swatinem/rust-cache@v2 - - name: cargo fmt + - name: lint - ubuntu-latest if: success() || failure() - run: cargo fmt -- --check - - name: cargo clippy - if: success() || failure() - run: | - cargo clippy --release -- -D warnings - - name: install risc0 - if: success() || failure() - run: | - curl -L https://risczero.com/install | bash - - name: install risc0 step 2 - if: success() || failure() - run: | - source /home/runner/.bashrc && rzup install && source /home/runner/.bashrc - - name: install taplo - if: success() || failure() - run: | - cargo install taplo-cli --locked - - name: taplo fmt - if: success() || failure() - run: | - taplo fmt --check + run: chmod 777 ./ci_scripts/lint-ubuntu.sh && ./ci_scripts/lint-ubuntu.sh + + test: strategy: matrix: @@ -100,21 +72,6 @@ jobs: profile: minimal toolchain: nightly override: true - - uses: Swatinem/rust-cache@v2 - - name: install risc0 + - name: test ubuntu-latest if: success() || failure() - run: | - curl -L https://risczero.com/install | bash - - name: install risc0 step 2 - if: success() || failure() - run: | - source /home/runner/.bashrc && rzup install && source /home/runner/.bashrc - - name: test mempool - if: success() || failure() - run: cargo test -p mempool - - name: test storage - if: success() || failure() - run: cargo test -p storage - - name: test zkvm - if: success() || failure() - run: cargo test -p zkvm + run: chmod 777 ./ci_scripts/test-ubuntu.sh && ./ci_scripts/test-ubuntu.sh diff --git a/ci_scripts/build-macos.sh b/ci_scripts/build-macos.sh new file mode 100644 index 0000000..e3332f6 --- /dev/null +++ b/ci_scripts/build-macos.sh @@ -0,0 +1,4 @@ +set -e +curl -L https://risczero.com/install | bash +/Users/runner/.risc0/bin/rzup install +cargo build \ No newline at end of file diff --git a/ci_scripts/build-ubuntu.sh b/ci_scripts/build-ubuntu.sh new file mode 100644 index 0000000..bf71a72 --- /dev/null +++ b/ci_scripts/build-ubuntu.sh @@ -0,0 +1,4 @@ +set -e +curl -L https://risczero.com/install | bash +/home/runner/.risc0/bin/rzup install +cargo build \ No newline at end of file diff --git a/ci_scripts/lint-ubuntu.sh b/ci_scripts/lint-ubuntu.sh new file mode 100644 index 0000000..6f71b24 --- /dev/null +++ b/ci_scripts/lint-ubuntu.sh @@ -0,0 +1,8 @@ +set -e + +curl -L https://risczero.com/install | bash +/home/runner/.risc0/bin/rzup install +cargo install taplo-cli --locked + +cargo fmt -- --check +taplo fmt --check \ No newline at end of file diff --git a/ci_scripts/test-ubuntu.sh b/ci_scripts/test-ubuntu.sh new file mode 100644 index 0000000..53fc7bc --- /dev/null +++ b/ci_scripts/test-ubuntu.sh @@ -0,0 +1,6 @@ +set -e + +curl -L https://risczero.com/install | bash +/home/runner/.risc0/bin/rzup install + +cargo test --release \ No newline at end of file diff --git a/zkvm/src/lib.rs b/zkvm/src/lib.rs index 3b2b4ba..14841d3 100644 --- a/zkvm/src/lib.rs +++ b/zkvm/src/lib.rs @@ -48,9 +48,9 @@ pub fn verify(receipt: Receipt, image_id: impl Into) { #[cfg(test)] mod tests { use super::*; + use test_methods::{BIG_CALCULATION_ELF, BIG_CALCULATION_ID}; use test_methods::{MULTIPLICATION_ELF, MULTIPLICATION_ID}; use test_methods::{SUMMATION_ELF, SUMMATION_ID}; - use test_methods::{BIG_CALCULATION_ELF, BIG_CALCULATION_ID}; #[test] fn prove_simple_sum() { @@ -140,5 +140,5 @@ mod tests { } res - } + } }