sonobe/.github/workflows/ci.yml
.github/workflows/ci.ymlRaw
1name: CI Check
2on:
3 merge_group:
4 pull_request:
5 push:
6 branches:
7 - main
8env:
9 CARGO_TERM_COLOR: always
10 # Disable incremental compilation.
11 #
12 # Incremental compilation is useful as part of an edit-build-test-edit cycle,
13 # as it lets the compiler avoid recompiling code that hasn't changed. However,
14 # on CI, we're not making small edits; we're almost always building the entire
15 # project from scratch. Thus, incremental compilation on CI actually
16 # introduces *additional* overhead to support making future builds
17 # faster...but no future builds will ever occur in any given CI environment.
18 #
19 # See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
20 # for details.
21 CARGO_INCREMENTAL: 0
22 # Allow more retries for network requests in cargo (downloading crates) and
23 # rustup (installing toolchains). This should help to reduce flaky CI failures
24 # from transient network timeouts or other issues.
25 CARGO_NET_RETRY: 10
26 RUSTUP_MAX_RETRIES: 10
27 # Don't emit giant backtraces in the CI logs.
28 RUST_BACKTRACE: short
29
30# Jobs launched for a PR event cancel the ongoing one for the same workflow + PR,
31# Only retries (of the same run) for a Push event cancel the prior one.
32concurrency:
33 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
34 cancel-in-progress: true
35
36
37jobs:
38 test:
39 if: github.event.pull_request.draft == false
40 name: Test
41 runs-on: ubuntu-latest
42 strategy:
43 matrix:
44 include:
45 - feature: default
46 steps:
47 - uses: actions/checkout@v2
48 - uses: noir-lang/noirup@v0.1.3
49 with:
50 toolchain: nightly
51 - uses: actions-rs/toolchain@v1
52 # use the more efficient nextest
53 - uses: taiki-e/install-action@nextest
54 - uses: Swatinem/rust-cache@v2
55 - name: Download Circom
56 run: |
57 mkdir -p $HOME/bin
58 curl -sSfL https://github.com/iden3/circom/releases/download/v2.1.6/circom-linux-amd64 -o $HOME/bin/circom
59 chmod +x $HOME/bin/circom
60 echo "$HOME/bin" >> $GITHUB_PATH
61 - name: Download solc
62 run: |
63 curl -sSfL https://github.com/ethereum/solidity/releases/download/v0.8.4/solc-static-linux -o /usr/local/bin/solc
64 chmod +x /usr/local/bin/solc
65 - name: Execute compile.sh to generate .r1cs and .wasm from .circom
66 run: ./folding-schemes/src/frontend/circom/test_folder/compile.sh
67 - name: Execute compile.sh to generate .json from noir
68 run: ./folding-schemes/src/frontend/noir/test_folder/compile.sh
69 - name: Build
70 # This build will be reused by nextest,
71 # and also checks (--all-targets) that benches don't bit-rot
72 run: cargo build --release --all-targets --no-default-features --features "light-test,${{ matrix.feature }}"
73 - name: Test
74 run: |
75 cargo nextest run --profile ci --release --workspace --no-default-features --features "light-test,${{ matrix.feature }}"
76 - name: Doctests # nextest does not support doc tests
77 run: |
78 cargo test --doc
79
80 examples:
81 if: github.event.pull_request.draft == false
82 name: Run examples & examples tests
83 runs-on: ubuntu-latest
84 steps:
85 - uses: actions/checkout@v2
86 - uses: actions-rs/toolchain@v1
87 - uses: noir-lang/noirup@v0.1.3
88 with:
89 toolchain: nightly
90 - name: Download Circom
91 run: |
92 mkdir -p $HOME/bin
93 curl -sSfL https://github.com/iden3/circom/releases/download/v2.1.6/circom-linux-amd64 -o $HOME/bin/circom
94 chmod +x $HOME/bin/circom
95 echo "$HOME/bin" >> $GITHUB_PATH
96 - name: Download solc
97 run: |
98 curl -sSfL https://github.com/ethereum/solidity/releases/download/v0.8.4/solc-static-linux -o /usr/local/bin/solc
99 chmod +x /usr/local/bin/solc
100 - name: Execute compile.sh to generate .r1cs and .wasm from .circom
101 run: ./folding-schemes/src/frontend/circom/test_folder/compile.sh
102 - name: Execute compile.sh to generate .json from noir
103 run: ./folding-schemes/src/frontend/noir/test_folder/compile.sh
104 - name: Run examples tests
105 run: cargo test --examples
106 - name: Run examples
107 run: cargo run --release --example 2>&1 | grep -E '^ ' | xargs -n1 cargo run --release --example
108
109 fmt:
110 if: github.event.pull_request.draft == false
111 name: Rustfmt
112 timeout-minutes: 30
113 runs-on: ubuntu-latest
114 steps:
115 - uses: actions/checkout@v2
116 - uses: actions-rs/toolchain@v1
117 - uses: Swatinem/rust-cache@v2
118 - run: rustup component add rustfmt
119 - uses: actions-rs/cargo@v1
120 with:
121 command: fmt
122 args: --all -- --check
123
124 clippy:
125 if: github.event.pull_request.draft == false
126 name: Clippy lint checks
127 runs-on: ubuntu-latest
128 steps:
129 - uses: actions/checkout@v2
130 - uses: actions-rs/toolchain@v1
131 with:
132 components: clippy
133 - uses: Swatinem/rust-cache@v2
134 - name: Run clippy
135 uses: actions-rs/cargo@v1
136 with:
137 command: clippy
138 args: --all-targets --all-features -- -D warnings
139
140 typos:
141 if: github.event.pull_request.draft == false
142 name: Spell Check with Typos
143 runs-on: ubuntu-latest
144 steps:
145 - uses: actions/checkout@v4
146 - name: Use typos with config file
147 uses: crate-ci/typos@master
148 with:
149 config: .github/workflows/typos.toml