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@v1
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@v2
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@v2
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
83 directories: # Job that list subdirectories
84 name: List directories for parallelizing tests
85 runs-on: ubuntu-latest
86 outputs:
87 dir: ${{ steps.set-dirs.outputs.dir }} # generate output name dir by using inner step output
88 steps:
89 - uses: actions/checkout@v2
90 - id: set-dirs # Give it an id to handle to get step outputs in the outputs key above
91 run: echo "::set-output name=dir::$(ls -d */ | jq -R -s -c 'split("\n")[:-1]')"
92 # Define step output named dir base on ls command transformed to JSON thanks to jq
93 test:
94 name: Test
95 runs-on: ubuntu-latest
96 needs: [directories] # Depends on previous job
97 strategy:
98 matrix:
99 dir: ${{fromJson(needs.directories.outputs.dir)}} # List matrix strategy from directories dynamically
100 # rust:
101 # - stable
102 # - nightly
103 exclude:
104 - dir: scripts/
105 - dir: curve-constraint-tests/
106 steps:
107 - name: Checkout
108 uses: actions/checkout@v2
109 - name: Run tests
110 run: |
111 cd ${{matrix.dir}}
112 cargo test --all-features
113
114 docs:
115 name: Check Documentation
116 runs-on: ubuntu-latest
117 steps:
118
119 - name: Checkout
120 uses: actions/checkout@v1
121 - name: Install Rust
122 uses: actions-rs/toolchain@v1
123 with:
124 profile: minimal
125 toolchain: stable
126 override: true
127 components: rustfmt
128
129 - name: cargo doc --all --no-deps --document-private-items --all-features
130 uses: actions-rs/cargo@v1
131 with:
132 command: doc
133 args: --all --no-deps --document-private-items --all-features
134
135 check_no_std:
136 name: Check no_std
137 runs-on: ubuntu-latest
138 steps:
139 - name: Checkout
140 uses: actions/checkout@v2
141
142 - name: Install Rust (${{ matrix.rust }})
143 uses: actions-rs/toolchain@v1
144 with:
145 toolchain: stable
146 target: aarch64-unknown-none
147 override: true
148
149 - uses: actions/cache@v2
150 with:
151 path: |
152 ~/.cargo/registry
153 ~/.cargo/git
154 target
155 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
156
157 - name: check
158 uses: actions-rs/cargo@v1
159 with:
160 command: check
161 args: --examples --workspace --exclude ark-curve-constraint-tests --target aarch64-unknown-none
162
163 - name: build
164 uses: actions-rs/cargo@v1
165 with:
166 command: build
167 args: --workspace --exclude ark-curve-constraint-tests --target aarch64-unknown-none