-
Notifications
You must be signed in to change notification settings - Fork 22
216 lines (206 loc) · 7.46 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
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
name: ci
on:
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
security_audit:
name: security_audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install cargo-audit from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-audit
- run: cargo audit --ignore RUSTSEC-2022-0093 --ignore RUSTSEC-2023-0065 --ignore RUSTSEC-2024-0344 --ignore RUSTSEC-2024-0421
code_gen:
# cargo b && ./target/debug/jito-restaking-cli --markdown-help > ./docs/_tools/00_cli.md && ./target/debug/jito-shank-cli && yarn generate-clients && cargo b
name: code generation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
toolchain: nightly-2024-07-25
- name: cargo build
run: cargo b -r
- name: Generate the CLI markdown
run: ./target/release/jito-restaking-cli --markdown-help > ./docs/_tools/00_cli.md
- name: Verify no CLI files changes
uses: tj-actions/verify-changed-files@v20
with:
fail-if-changed: true
fail-message: 'Unexpected changes in the CLI files. Please run `./target/release/jito-restaking-cli --markdown-help > ./docs/_tools/00_cli.md` to regenerate the files.'
- name: Regenerate Shank IDL files
run: ./target/release/jito-shank-cli
- name: Verify no changed files
uses: tj-actions/verify-changed-files@v20
with:
fail-if-changed: true
fail-message: 'Unexpected changes in the shank IDL files. Please run `./target/release/jito-shank-cli` to regenerate the files.'
- name: Set Node.js 22.x
uses: actions/setup-node@v3
with:
node-version: 22.x
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install
- name: Generate kinobi IDL files
uses: borales/actions-yarn@v4
with:
cmd: generate-clients
- name: Verify no changed files
uses: tj-actions/verify-changed-files@v20
id: verify-changed-kinobi-files
- name: Run step only when any of the above files change.
if: steps.verify-changed-kinobi-files.outputs.files_changed == 'true'
env:
CHANGED_FILES: ${{ steps.verify-changed-kinobi-files.outputs.changed_files }}
run: |
echo "Changed files: $CHANGED_FILES"
echo "Unexpected changes in the client files. Please run `yarn generate-clients` to regenerate the files."
exit 1
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
toolchain: nightly-2024-07-25
- name: Install cargo-sort from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-sort
- run: cargo sort --workspace --check
- run: cargo fmt --all --check
- run: cargo clippy --all-features -- -D warnings -D clippy::all -D clippy::nursery -D clippy::integer_division -D clippy::arithmetic_side_effects -D clippy::style -D clippy::perf
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: aarcangeli/[email protected]
with:
path: config
filenames: program.env
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: install solana toolsuite
run: sh -c "$(curl -sSfL https://release.solana.com/v1.18.22/install)"
- name: add to path
run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Building programs
run: cargo-build-sbf
env:
RESTAKING_PROGRAM_ID: RestkWeAVL8fRGgzhfeoqFhsqKRchg6aa1XrcH96z4Q
VAULT_PROGRAM_ID: Vau1t6sLNxnzB7ZDsef8TLbPLfyZMYXH8WTNqUdm9g8
verified_build:
name: verified_build
runs-on: big-runner-1
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- run: docker pull --platform linux/amd64 ellipsislabs/solana:1.18.11
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install solana-verify from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: solana-verify
- run: solana-verify build --library-name jito_restaking_program --base-image ellipsislabs/solana:1.18.11
- run: solana-verify build --library-name jito_vault_program --base-image ellipsislabs/solana:1.18.11
- name: Upload jito_restaking_program.so
uses: actions/upload-artifact@v4
with:
name: jito_restaking_program.so
path: target/deploy/jito_restaking_program.so
- name: Upload jito_vault_program.so
uses: actions/upload-artifact@v4
with:
name: jito_vault_program.so
path: target/deploy/jito_vault_program.so
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
toolchain: nightly-2024-07-25
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
env:
RESTAKING_PROGRAM_ID: RestkWeAVL8fRGgzhfeoqFhsqKRchg6aa1XrcH96z4Q
VAULT_PROGRAM_ID: Vau1t6sLNxnzB7ZDsef8TLbPLfyZMYXH8WTNqUdm9g8
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: jito-foundation/restaking
fail_ci_if_error: true
codecov_yml_path: codecov.yaml
test_sbf:
name: cargo test
runs-on: ubuntu-latest
needs:
- verified_build
steps:
- uses: actions/checkout@v4
- uses: aarcangeli/[email protected]
with:
path: config
filenames: program.env
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Download restaking program
uses: actions/download-artifact@v4
with:
name: jito_restaking_program.so
path: target/sbf-solana-solana/release/
- name: Download vault program
uses: actions/download-artifact@v4
with:
name: jito_vault_program.so
path: target/sbf-solana-solana/release/
- uses: taiki-e/install-action@nextest
- run: cargo nextest run --all-features
env:
SBF_OUT_DIR: ${{ github.workspace }}/target/sbf-solana-solana/release
create_release:
name: Create Release
needs:
- build
- test_sbf
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- run: ls -lh
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
*.so
fail_on_unmatched_files: true