-
Notifications
You must be signed in to change notification settings - Fork 136
188 lines (151 loc) · 4.99 KB
/
ci.yaml
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: CI
on:
merge_group:
push:
branches: [main]
pull_request:
branches: ["*"]
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
compile:
name: Compile
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Run cargo check
run: cargo check
- name: Run cargo check and stark instruments
run: |
cargo check --features instruments
- name: Run cargo check cli, stark instruments and parallel
run: |
cargo check --features instruments,parallel
- name: Run cargo check for math with no-std
run: cargo check --package lambdaworks-math --no-default-features
- name: Run cargo check for math with wasm target
run: cargo check --package lambdaworks-math --no-default-features --target wasm32-unknown-unknown
- name: Run cargo check for crypto with wasm target
run: cargo check --package lambdaworks-crypto --no-default-features --target wasm32-unknown-unknown
- name: Run cargo build ensure-no_std crate
run: |
cd ensure-no_std
cargo build
- name: Run cargo build for all workspace
run: |
cargo build --workspace
- name: Run cargo build ensure-no_std crate for wasm
run: |
cd ensure-no_std
cargo build --target wasm32-unknown-unknown
- name: Check benchmarks
run: cargo check --benches
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run clippy
run: make clippy
- name: Run clippy math and crypto no std
run: cargo clippy --package lambdaworks-math --package lambdaworks-crypto --no-default-features -- -D warnings
- name: Run clippy math no std + alloc
run: cargo clippy --package lambdaworks-math --no-default-features --features=alloc,lambdaworks-serde-string,lambdaworks-serde-binary -- -D warnings
test:
name: Test (Ubuntu)
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Install testing tools
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov
- name: Run tests with no std
run: cargo test --package lambdaworks-math --package lambdaworks-crypto --no-default-features
- name: Run tests for math with no std + alloc
run: cargo test --package lambdaworks-math --no-default-features --features=alloc,lambdaworks-serde-string,lambdaworks-serde-binary
- name: Run tests and generate code coverage
run: make coverage
- name: Cache coverage data
uses: actions/cache/save@v4
with:
path: lcov.info
key: coverage-${{ github.sha }}
coverage:
name: Upload Coverage to Codecov
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- name: Fetch coverage data
uses: actions/cache/restore@v4
with:
path: lcov.info
key: coverage-${{ github.sha }}
fail-on-cache-miss: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
test_wasm_pack:
name: Test wasm-pack
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Install wasm-pack tools for testing
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
test_macos:
name: Test (macOS, Apple sillicon)
runs-on: macos-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- name: install GCC/GMP
run: |
brew install gcc
brew install gmp
- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- name: Run clippy
run: make clippy-metal
- name: Run tests
run: make test-metal