ark-curves-cherry-picked/.github/workflows/ci.yml
.github/workflows/ci.ymlRaw
1name: CI
2on:
3 pull_request:
4 push:
5 branches:
6 - master
7env:
8 RUST_BACKTRACE: 1
9
10jobs:
11 style:
12 name: Check Style
13 runs-on: ubuntu-latest
14 steps:
15
16 - name: Checkout
17 uses: actions/checkout@v3
18 - name: Install Rust
19 uses: actions-rs/toolchain@v1
20 with:
21 profile: minimal
22 toolchain: stable
23 override: true
24 components: rustfmt
25
26 - name: cargo fmt --check
27 uses: actions-rs/cargo@v1
28 with:
29 command: fmt
30 args: --all -- --check
31
32 check:
33 name: Check
34 runs-on: ubuntu-latest
35 env:
36 RUSTFLAGS: -Dwarnings
37 strategy:
38 matrix:
39 rust:
40 - stable
41 - nightly
42 steps:
43 - name: Checkout
44 uses: actions/checkout@v3
45
46 - name: Install Rust (${{ matrix.rust }})
47 uses: actions-rs/toolchain@v1
48 with:
49 profile: minimal
50 toolchain: ${{ matrix.rust }}
51 override: true
52
53 - uses: actions/cache@v3
54 with:
55 path: |
56 ~/.cargo/registry
57 ~/.cargo/git
58 target
59 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
60
61 - name: Check examples
62 uses: actions-rs/cargo@v1
63 with:
64 command: check
65 args: --examples --all
66
67 - name: Check examples with all features on stable
68 uses: actions-rs/cargo@v1
69 with:
70 command: check
71 args: --examples --all-features --all
72 if: matrix.rust == 'stable'
73
74 - name: Check benchmarks on nightly
75 uses: actions-rs/cargo@v1
76 with:
77 command: check
78 args: --all-features --examples --workspace --benches
79 if: matrix.rust == 'nightly'
80
81
82 directories: # Job that list subdirectories
83 name: List directories for parallelizing tests
84 runs-on: ubuntu-latest
85 outputs:
86 dir: ${{ steps.set-dirs.outputs.dir }} # generate output name dir by using inner step output
87 steps:
88 - uses: actions/checkout@v3
89 - id: set-dirs # Give it an id to handle to get step outputs in the outputs key above
90 run: echo "::set-output name=dir::$(ls -d */ | jq -R -s -c 'split("\n")[:-1]')"
91 # Define step output named dir base on ls command transformed to JSON thanks to jq
92 test:
93 name: Test
94 runs-on: ubuntu-latest
95 needs: [directories] # Depends on previous job
96 strategy:
97 matrix:
98 dir: ${{fromJson(needs.directories.outputs.dir)}} # List matrix strategy from directories dynamically
99 # rust:
100 # - stable
101 # - nightly
102 exclude:
103 - dir: scripts/
104 - dir: curve-constraint-tests/
105 - dir: mnt4_753/
106 - dir: mnt6_753/
107 - dir: cp6_782/
108 steps:
109 - name: Checkout
110 uses: actions/checkout@v3
111 - name: Run tests
112 run: |
113 cd ${{matrix.dir}}
114 cargo test --all-features
115
116 test-mnt4-753:
117 name: Test (mnt4_753/)
118 runs-on: macos-latest
119 steps:
120 - name: Checkout
121 uses: actions/checkout@v3
122
123 - name: Check if source code updated
124 uses: dorny/paths-filter@v2.11.1
125 id: check-diff
126 with:
127 filters: |
128 mnt4_753_is_updated:
129 - 'mnt4_753/**'
130
131 - name: Generate lockfile
132 run: cargo generate-lockfile
133
134 - name: Check if deps updated
135 id: deps-updated
136 uses: actions/cache@v3
137 with:
138 path: |
139 ~/.cargo/registry
140 ~/.cargo/git
141 target
142 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
143
144 - name: Conditionally run the tests
145 # if source code updated OR dependencies updated
146 if: ${{ steps.check-diff.outputs.mnt4_753_is_updated == 'true' || steps.deps-updated.outputs.cache-hit != 'true' }}
147 run: |
148 cd mnt4_753/
149 cargo test --all-features
150
151 test-mnt6-753:
152 name: Test (mnt6_753/)
153 runs-on: macos-latest
154 steps:
155 - name: Checkout
156 uses: actions/checkout@v3
157
158 - name: Check if source code updated
159 uses: dorny/paths-filter@v2.11.1
160 id: check-diff
161 with:
162 filters: |
163 mnt6_753_is_updated:
164 - 'mnt6_753/**'
165
166 - name: Generate lockfile
167 run: cargo generate-lockfile
168
169 - name: Check if deps updated
170 id: deps-updated
171 uses: actions/cache@v3
172 with:
173 path: |
174 ~/.cargo/registry
175 ~/.cargo/git
176 target
177 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
178
179 - name: Conditionally run the tests
180 # if source code updated OR dependencies updated
181 if: ${{ steps.check-diff.outputs.mnt6_753_is_updated == 'true' || steps.deps-updated.outputs.cache-hit != 'true' }}
182 run: |
183 cd mnt6_753/
184 cargo test --all-features
185
186 test-cp6_782:
187 name: Test (cp6_782/)
188 runs-on: ubuntu-latest
189 steps:
190 - name: Checkout
191 uses: actions/checkout@v3
192
193 - name: Check if source code updated
194 uses: dorny/paths-filter@v2.11.1
195 id: check-diff
196 with:
197 filters: |
198 cp6_782_is_updated:
199 - 'cp6_782/**'
200
201 - name: Generate lockfile
202 run: cargo generate-lockfile
203
204 - name: Check if deps updated
205 id: deps-updated
206 uses: actions/cache@v3
207 with:
208 path: |
209 ~/.cargo/registry
210 ~/.cargo/git
211 target
212 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
213
214 - name: Conditionally run the tests
215 # if source code updated OR dependencies updated
216 if: ${{ steps.check-diff.outputs.cp6_782_is_updated == 'true' || steps.deps-updated.outputs.cache-hit != 'true' }}
217 run: |
218 cd cp6_782/
219 cargo test --all-features
220
221
222 docs:
223 name: Check Documentation
224 runs-on: ubuntu-latest
225 steps:
226
227 - name: Checkout
228 uses: actions/checkout@v3
229 - name: Install Rust
230 uses: actions-rs/toolchain@v1
231 with:
232 profile: minimal
233 toolchain: stable
234 override: true
235 components: rustfmt
236
237 - name: cargo doc --all --no-deps --document-private-items --all-features
238 uses: actions-rs/cargo@v1
239 with:
240 command: doc
241 args: --all --no-deps --document-private-items --all-features
242
243 check_no_std:
244 name: Check no_std
245 runs-on: ubuntu-latest
246 steps:
247 - name: Checkout
248 uses: actions/checkout@v3
249
250 - name: Install Rust
251 uses: actions-rs/toolchain@v1
252 with:
253 toolchain: stable
254 target: thumbv6m-none-eabi
255 override: true
256
257 - uses: actions/cache@v3
258 with:
259 path: |
260 ~/.cargo/registry
261 ~/.cargo/git
262 target
263 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
264
265 - name: check
266 uses: actions-rs/cargo@v1
267 with:
268 command: check
269 args: --examples --workspace --exclude ark-curve-constraint-tests --target thumbv6m-none-eabi
270
271 - name: build
272 uses: actions-rs/cargo@v1
273 with:
274 command: build
275 args: --workspace --exclude ark-curve-constraint-tests --target thumbv6m-none-eabi