-
Notifications
You must be signed in to change notification settings - Fork 80
170 lines (160 loc) · 6.43 KB
/
lint-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: CI-Lint-And-Test
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
# Run cargo check (with various feature permutations)
check:
name: Check Package
runs-on: large-8-core-32gb-22-04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-check-${{ hashFiles('**/Cargo.toml') }}
- name: Install stable toolchain
run: curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env && rustup default 1.77.1
- name: Install Dependencies
run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld valgrind
- name: Run cargo check (no features, exclude examples)
run: cargo check --no-default-features
- name: Run cargo check (default features)
run: cargo check --all-targets
- name: Run cargo check (all features)
run: cargo check --all-targets --all-features
- name: Run cargo check (proofs) (no features)
run: cargo check -p proofs --no-default-features
- name: Run cargo check (proofs) (all features)
run: cargo check -p proofs --all-features
- name: Run cargo check (proofs) (just "test" feature)
run: cargo check -p proofs --no-default-features --features="test"
- name: Run cargo check (proofs) (just "blitzar" feature)
run: cargo check -p proofs --no-default-features --features="blitzar"
test:
name: Test Suite
runs-on: large-8-core-32gb-22-04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }}
- name: Install stable toolchain
run: curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env && rustup default 1.77.1
- name: Install Dependencies
run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld valgrind
- name: Run cargo test
run: cargo test --all-features
- name: Dry run cargo test (proofs) (test feature only)
run: cargo test -p proofs --no-run --no-default-features --features="test"
- name: Dry run cargo test (proofs) (blitzar feature only)
run: cargo test -p proofs --no-run --no-default-features --features="blitzar"
- name: Dry run cargo test (proofs) (no features)
run: cargo test -p proofs --no-run --no-default-features
test-wasm:
name: Test Wasm
runs-on: large-8-core-32gb-22-04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }}
- name: Install stable toolchain
run: curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env && rustup default 1.77.1
- name: Install Dependencies
run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld valgrind
- name: Add Wasm toolchain
run: |
rustup target add wasm32-unknown-unknown
cargo install --force wasm-bindgen-cli
- name: Install Deno
run: curl -fsSL https://deno.land/install.sh | sh
- name: Build a Wasm
run: |
cargo build -p proofs-wasm-test --release --no-default-features --target wasm32-unknown-unknown
wasm-bindgen --target deno ./target/wasm32-unknown-unknown/release/proofs-wasm-test.wasm --out-dir ./wasm-deno-test
- name: Run Wasm with Deno
run: |
export DENO_INSTALL="$HOME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
deno run --allow-read ./wasm-deno-test/proofs-wasm-test.js | grep -F 'Result matches: true'
clippy:
name: Clippy
runs-on: large-8-core-32gb-22-04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }}
- name: Install stable toolchain
run: |
curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env && rustup default 1.77.1
rustup component add clippy
- name: Install Dependencies
run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld valgrind
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
# Run cargo fmt --all -- --config imports_granularity=Crate,group_imports=One --check
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
run: |
curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env && rustup default 1.77.1
rustup component add rustfmt
- name: Run cargo fmt
run: cargo fmt --all -- --config imports_granularity=Crate,group_imports=One --check
udeps:
name: Unused Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install nightly toolchain
run: |
curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal && source ~/.cargo/env && rustup default nightly
cargo install cargo-udeps --locked
- name: Run cargo udeps
run: cargo +nightly udeps --all-targets