-
Notifications
You must be signed in to change notification settings - Fork 7
194 lines (159 loc) · 4.7 KB
/
ci.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: CI
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
workflow_dispatch:
concurrency:
group: rust-validation-${{ github.head_ref }}
cancel-in-progress: true
env:
RUST_BACKTRACE: full
RUST_LOG: "gadget=trace"
CARGO_TERM_COLOR: always
IN_CI: "true"
jobs:
formatting:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: Check Formatting
run: cargo fmt -- --check
linting:
timeout-minutes: 120
name: cargo clippy
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Verify Forge installation
run: forge --version
- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- name: install protobuf and gmp
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libprotobuf-dev libgmp-dev
- name: Run Clippy
run: cargo clippy --tests --examples -- -D warnings
testing:
timeout-minutes: 30
name: cargo test
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
strategy:
fail-fast: false
matrix:
package:
[
# Blueprints
incredible-squaring-blueprint,
incredible-squaring-blueprint-eigenlayer,
# Macros
gadget-blueprint-proc-macro,
gadget-blueprint-proc-macro-core,
gadget-context-derive,
# Clients
gadget-client-eigenlayer,
gadget-client-evm,
gadget-client-tangle,
# Crypto
gadget-crypto-sp-core,
gadget-crypto-ed25519,
gadget-crypto-bls,
gadget-crypto-k256,
gadget-crypto-sr25519,
# Event listeners
gadget-event-listeners-core,
gadget-event-listeners-cronjob,
gadget-blueprint-serde,
gadget-config,
gadget-keystore,
gadget-std,
]
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Verify Forge installation
run: forge --version
- name: install rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: stable
- uses: swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- name: install protobuf and gmp
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libprotobuf-dev libgmp-dev
- uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Add extra args
run: |
# if test == "gadget_context_derive", add --features="networking", else ""
if [[ "${{ matrix.package }}" == "gadget-context-derive" ]]; then
echo "cargo_nextest_args=--features networking" >> $GITHUB_ENV
else
echo "cargo_nextest_args=" >> $GITHUB_ENV
fi
- name: tests
run: cargo nextest run --profile ci --package ${{ matrix.package }} ${{ env.cargo_nextest_args }}
# TODO: nextest doesn't support doc tests yet (https://github.com/nextest-rs/nextest/issues/16)
- name: doc tests
run: cargo test --package ${{ matrix.package }} --doc
macos_tests:
timeout-minutes: 30
name: cargo test
runs-on: macos-latest
env:
CARGO_TERM_COLOR: always
strategy:
fail-fast: false
matrix:
package:
[
gadget-networking,
gadget-executor,
gadget-utils-tangle,
]
steps:
- name: checkout code
uses: actions/checkout@v2
- name: install rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: stable
- uses: swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- name: install protobuf and gmp
run: |
brew install protobuf gmp
- uses: taiki-e/install-action@v2
with:
tool: nextest
- name: tests
run: cargo nextest run --profile serial --package ${{ matrix.package }}
# TODO: nextest doesn't support doc tests yet (https://github.com/nextest-rs/nextest/issues/16)
- name: doc tests
run: cargo test --package ${{ matrix.package }} --doc