-
Notifications
You must be signed in to change notification settings - Fork 4
226 lines (178 loc) · 6.05 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
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
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: macos-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Install Foundry
run: |
curl -L https://foundry.paradigm.xyz | bash
source /Users/runner/.bashrc
foundryup
- name: Add Foundry to PATH
run: echo "${HOME}/.foundry/bin" >> $GITHUB_PATH
- 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
run: brew install protobuf
- name: Forge build
run: forge update && cd blueprints/incredible-squaring-eigenlayer && forge build --root ./contracts
- name: Run Clippy
run: cargo clippy --tests --examples -- -D warnings
testing:
timeout-minutes: 90
name: cargo test
runs-on: macos-14
strategy:
matrix:
package:
[
gadget-sdk,
gadget-context-derive,
gadget-blueprint-proc-macro,
gadget-blueprint-proc-macro-playground,
]
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Install Foundry
run: |
curl -L https://foundry.paradigm.xyz | bash
source /Users/runner/.bashrc
foundryup
- name: Add Foundry to PATH
run: echo "${HOME}/.foundry/bin" >> $GITHUB_PATH
- 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
run: brew install protobuf gmp
- name: Set Relevant M1 env vars
run: |
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib
export INCLUDE_PATH=$INCLUDE_PATH:/opt/homebrew/include
- name: install cargo-nextest
run: cargo install cargo-nextest --locked
- name: tests
run: cargo nextest run --nocapture --package ${{ matrix.package }} ${{ matrix.package == 'gadget-sdk' && '--features getrandom,std' || '' }}
# 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
incredible-squaring:
timeout-minutes: 90
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
with:
path: gadget
- name: Install Foundry
run: |
curl -L https://foundry.paradigm.xyz | bash
${FOUNDRY_DIR:-"$HOME/.foundry"}/bin/foundryup
env:
FOUNDRY_DIR: ${{ runner.temp }}/foundry
shell: bash
- name: Add Foundry to PATH
run: echo "${{ runner.temp }}/foundry/bin" >> $GITHUB_PATH
- name: Forge build
working-directory: gadget/blueprints/incredible-squaring
run: forge update && forge build
- 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
- name: install cargo-nextest
run: cargo install cargo-nextest --locked
- name: tests
working-directory: gadget
run: cargo nextest run --nocapture --package incredible-squaring-blueprint test_blueprint --retries 0
eigenlayer-tests:
timeout-minutes: 90
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Install Foundry
run: |
curl -L https://foundry.paradigm.xyz | bash
${FOUNDRY_DIR:-"$HOME/.foundry"}/bin/foundryup
env:
FOUNDRY_DIR: ${{ runner.temp }}/foundry
shell: bash
- name: Add Foundry to PATH
run: echo "${{ runner.temp }}/foundry/bin" >> $GITHUB_PATH
- name: Forge build
run: forge update && cd blueprints/incredible-squaring-eigenlayer && forge build --root ./contracts && cd ../../
- name: Set up Docker
uses: crazy-max/ghaction-setup-docker@v3
- name: Run anvil in background
run: anvil --version && anvil &
- 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
- name: install cargo-nextest
run: cargo install cargo-nextest --locked
- name: Build (release) integration test
run: cargo build --release -p incredible-squaring-blueprint-eigenlayer
- name: eigenlayer incredible squaring blueprint test
run: RUST_LOG=gadget=trace cargo test --package incredible-squaring-blueprint-eigenlayer test_eigenlayer_incredible_squaring_blueprint -- --nocapture
- name: eigenlayer context test
run: RUST_LOG=gadget=trace cargo test --package blueprint-examples test_eigenlayer_context -- --nocapture