Skip to content

Commit 91aded0

Browse files
committed
open sourcing
0 parents  commit 91aded0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+9980
-0
lines changed

.cargo/config.toml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# placeholders for clippy and other tools
2+
# Program IDs may not be correct
3+
[env]
4+
REWARD_PROGRAM_ID = "Fv9aHCgvPQSr4jg9W8eTS6Ys1SNmh2qjyATrbsjEMaSH"
5+
RESTAKING_PROGRAM_ID = "6Weyp6uFyjJ3pzYz7XbXvCPAyvzLUhESEhHarFRm53Nb"
6+
VAULT_PROGRAM_ID = "4vB3bvqKEmxV68J7XtS1HqZomjok4ZXc1ELJH9p1K1D2"
7+
WEIGHT_TABLE_ID = "ENHcxLEWQxRyS8VbC7Pb6GKc739vVaBZ2toJvQSL68vM"

.github/workflows/ci.yaml

+191
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [ master ]
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
security_audit:
17+
name: security_audit
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
- name: Install cargo-audit from crates.io
24+
uses: baptiste0928/cargo-install@v3
25+
with:
26+
crate: cargo-audit
27+
- run: cargo audit --ignore RUSTSEC-2022-0093 --ignore RUSTSEC-2023-0065 --ignore RUSTSEC-2024-0344
28+
29+
code_gen:
30+
name: code generation
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
submodules: recursive
36+
- uses: actions-rust-lang/setup-rust-toolchain@v1
37+
with:
38+
components: rustfmt, clippy
39+
toolchain: nightly-2024-07-25
40+
- name: Regenerate Shank IDL files
41+
run: cargo b --release -p jito-shank-cli && ./target/release/jito-shank-cli
42+
- name: Verify no changed files
43+
uses: tj-actions/verify-changed-files@v20
44+
with:
45+
fail-if-changed: true
46+
fail-message: 'Unexpected changes in the shank IDL files. Please run `./target/release/jito-shank-cli` to regenerate the files.'
47+
- name: Set Node.js 22.x
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: 22.x
51+
- name: Run install
52+
uses: borales/actions-yarn@v4
53+
with:
54+
cmd: install
55+
- name: Generate kinobi IDL files
56+
uses: borales/actions-yarn@v4
57+
with:
58+
cmd: generate-clients
59+
- name: Verify no changed files
60+
uses: tj-actions/verify-changed-files@v20
61+
id: verify-changed-kinobi-files
62+
- name: Run step only when any of the above files change.
63+
if: steps.verify-changed-kinobi-files.outputs.files_changed == 'true'
64+
env:
65+
CHANGED_FILES: ${{ steps.verify-changed-kinobi-files.outputs.changed_files }}
66+
run: |
67+
echo "Changed files: $CHANGED_FILES"
68+
echo "Unexpected changes in the client files. Please run `yarn generate-clients` to regenerate the files."
69+
exit 1
70+
71+
lint:
72+
name: lint
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v4
76+
with:
77+
submodules: recursive
78+
- uses: actions-rust-lang/setup-rust-toolchain@v1
79+
with:
80+
components: rustfmt, clippy
81+
toolchain: nightly-2024-07-25
82+
- name: Install cargo-sort from crates.io
83+
uses: baptiste0928/cargo-install@v3
84+
with:
85+
crate: cargo-sort
86+
- run: cargo sort --workspace --check
87+
- run: cargo fmt --all --check
88+
- 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
89+
90+
build:
91+
name: build
92+
runs-on: ubuntu-latest
93+
steps:
94+
- uses: actions/checkout@v4
95+
- uses: aarcangeli/[email protected]
96+
with:
97+
path: config
98+
filenames: program.env
99+
- uses: actions-rust-lang/setup-rust-toolchain@v1
100+
- name: install solana toolsuite
101+
run: sh -c "$(curl -sSfL https://release.solana.com/v1.18.22/install)"
102+
- name: add to path
103+
run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
104+
- name: Building programs
105+
run: cargo-build-sbf
106+
env:
107+
RESTAKING_PROGRAM_ID: ${{ env.RESTAKING_PROGRAM_ID }}
108+
VAULT_PROGRAM_ID: ${{ env.VAULT_PROGRAM_ID }}
109+
- name: Upload restaking program
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: jito_restaking_program.so
113+
path: target/sbf-solana-solana/release/jito_restaking_program.so
114+
if-no-files-found: error
115+
- name: Upload vault program
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: jito_vault_program.so
119+
path: target/sbf-solana-solana/release/jito_vault_program.so
120+
if-no-files-found: error
121+
122+
coverage:
123+
name: coverage
124+
runs-on: ubuntu-latest
125+
steps:
126+
- uses: actions/checkout@v4
127+
- uses: actions-rust-lang/setup-rust-toolchain@v1
128+
with:
129+
components: rustfmt, clippy
130+
toolchain: nightly-2024-07-25
131+
- name: Install cargo-llvm-cov
132+
uses: taiki-e/install-action@cargo-llvm-cov
133+
- name: Generate code coverage
134+
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
135+
env:
136+
RESTAKING_PROGRAM_ID: Cnp3S1G3JaaAoFpFR3FhM94DdEF1mMBqy5vjwtDaVZLi
137+
VAULT_PROGRAM_ID: 94sqeuUnjJCmwZUp8nGK7Q7o8YnHSW9Y3TcPZJY2PycN
138+
- name: Upload coverage to Codecov
139+
uses: codecov/[email protected]
140+
with:
141+
token: ${{ secrets.CODECOV_TOKEN }}
142+
slug: jito-foundation/restaking
143+
fail_ci_if_error: true
144+
145+
test_sbf:
146+
name: cargo test
147+
runs-on: ubuntu-latest
148+
needs:
149+
- build
150+
steps:
151+
- uses: actions/checkout@v4
152+
- uses: aarcangeli/[email protected]
153+
with:
154+
path: config
155+
filenames: program.env
156+
- uses: actions-rust-lang/setup-rust-toolchain@v1
157+
- name: Download restaking program
158+
uses: actions/download-artifact@v4
159+
with:
160+
name: jito_restaking_program.so
161+
path: target/sbf-solana-solana/release/
162+
- name: Download vault program
163+
uses: actions/download-artifact@v4
164+
with:
165+
name: jito_vault_program.so
166+
path: target/sbf-solana-solana/release/
167+
- uses: taiki-e/install-action@nextest
168+
- run: cargo nextest run --all-features
169+
env:
170+
SBF_OUT_DIR: ${{ github.workspace }}/target/sbf-solana-solana/release
171+
172+
create_release:
173+
name: Create Release
174+
needs:
175+
- build
176+
- test_sbf
177+
runs-on: ubuntu-latest
178+
if: startsWith(github.ref, 'refs/tags/')
179+
steps:
180+
- name: Download all artifacts
181+
uses: actions/download-artifact@v4
182+
with:
183+
merge-multiple: true
184+
- run: ls -lh
185+
- name: Release
186+
uses: softprops/action-gh-release@v2
187+
if: startsWith(github.ref, 'refs/tags/')
188+
with:
189+
files: |
190+
*.so
191+
fail_on_unmatched_files: true
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build Jekyll site
2+
on:
3+
push:
4+
branches: [ "master" ]
5+
6+
permissions:
7+
contents: read
8+
pages: write
9+
id-token: write
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
# Build the cargo docs
18+
- uses: actions-rust-lang/setup-rust-toolchain@v1
19+
with:
20+
toolchain: nightly-2024-07-25
21+
- name: Generate Cargo Docs
22+
run: cargo doc --no-deps
23+
- name: Copy Cargo Docs to Jekyll source
24+
run: cp -R target/doc docs/api
25+
26+
# Setup Github Pages
27+
- name: Setup Pages
28+
uses: actions/configure-pages@v5
29+
- name: Build
30+
uses: actions/jekyll-build-pages@v1
31+
with:
32+
source: ./docs
33+
- name: Upload artifact
34+
uses: actions/upload-pages-artifact@v3
35+
deploy:
36+
runs-on: ubuntu-latest
37+
needs: build
38+
steps:
39+
- name: Deploy to GitHub Pages
40+
id: deployment
41+
uses: actions/deploy-pages@v4
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)