-
Notifications
You must be signed in to change notification settings - Fork 21
187 lines (175 loc) · 5.72 KB
/
build.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
name: Build
on:
push:
branches:
- master
- steward-test-branch
tags:
- "v*"
pull_request:
branches:
- master
- steward-test-branch
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-0336 --ignore RUSTSEC-2024-0344 --ignore RUSTSEC-2024-0357
lint:
name: lint
runs-on: big-runner-1
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
toolchain: nightly-2024-02-04
- name: Install cargo-sort from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-sort
- run: cargo +nightly-2024-02-04 sort --workspace --check
- run: cargo +nightly-2024-02-04 fmt --all --check
- run: cargo +nightly-2024-02-04 clippy --all-features --all-targets --tests -- -D warnings
udeps:
name: udeps
runs-on: big-runner-1
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-02-04
- name: Install cargo-udeps from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-udeps
version: "0.1.45"
- run: cargo +nightly-2024-02-04 udeps --all-features --all-targets --tests
verified_build:
name: verified_build
runs-on: big-runner-1
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-02-04
- name: Install solana-verify from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: solana-verify
- name: Install anchor-cli from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: anchor-cli
version: "0.30.1"
- name: install solana toolsuite
run: sh -c "$(curl -sSfL https://release.solana.com/v1.18.11/install)"
- name: add to path
run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
# build the program and IDL; exit if error
- run: anchor build --idl idl
- name: Check for diff on IDL
run: git diff --exit-code
# run verified build
- run: solana-verify build --library-name validator_history
- run: solana-verify build --library-name jito_steward -- --features mainnet-beta
# create build for tests
- run: cargo build-sbf --manifest-path programs/steward/Cargo.toml --sbf-out-dir target/test
# upload the IDL and verified build
- name: Upload validator_history.so
uses: actions/upload-artifact@v4
with:
name: validator_history.so
path: target/deploy/validator_history.so
- name: Upload jito_steward.so
uses: actions/upload-artifact@v4
with:
name: jito_steward.so
path: target/deploy/jito_steward.so
- name: Upload test jito_steward.so
uses: actions/upload-artifact@v4
with:
name: jito_steward_test.so
path: target/test/jito_steward.so
- name: Upload Validator History IDL
uses: actions/upload-artifact@v4
with:
name: validator_history.json
path: programs/validator-history/idl/validator_history.json
- name: Upload Jito Steward IDL
uses: actions/upload-artifact@v4
with:
name: jito_steward.json
path: programs/steward/idl/steward.json
# tests run on verified build
test:
name: test
runs-on: big-runner-1
needs:
- verified_build
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-02-04
- uses: actions/download-artifact@v4
with:
name: validator_history.so
path: target/deploy/
- uses: actions/download-artifact@v4
with:
name: jito_steward_test.so
path: target/test/
- name: Rename test artifact to jito_steward.so
run: mv ./target/test/jito_steward.so ./target/deploy/jito_steward.so
shell: bash
- name: cargo test
run: cargo test --package tests --all-features --color auto
shell: bash
env:
RUST_LOG: trace
SBF_OUT_DIR: ${{ github.workspace }}/target/deploy
RUST_MIN_STACK: 5000000
# release only runs on tagged commits
# it should wait for all the other steps to finish, to ensure releases are the highest quality
# after waiting, it will download the verified build and IDL from the verified_build step and release the artifacts
release:
name: release
runs-on: big-runner-1
if: startsWith(github.ref, 'refs/tags/')
needs:
- security_audit
- lint
- udeps
- verified_build
- test
steps:
- uses: actions/download-artifact@v4
with:
name: validator_history.so
- uses: actions/download-artifact@v4
with:
name: validator_history.json
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
validator_history.so
validator_history.json