Skip to content

Commit

Permalink
boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
coachchucksol committed Oct 31, 2024
0 parents commit d289f83
Show file tree
Hide file tree
Showing 65 changed files with 13,124 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# placeholders for clippy and other tools
# Program IDs may not be correct
[env]
MEV_TIP_DISTRIBUTION_NCN_PROGRAM_ID = "Fv9aHCgvPQSr4jg9W8eTS6Ys1SNmh2qjyATrbsjEMaSH"
RESTAKING_PROGRAM_ID = "6Weyp6uFyjJ3pzYz7XbXvCPAyvzLUhESEhHarFRm53Nb"
VAULT_PROGRAM_ID = "4vB3bvqKEmxV68J7XtS1HqZomjok4ZXc1ELJH9p1K1D2"
3 changes: 3 additions & 0 deletions .cargo/programs.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MEV_TIP_DISTRIBUTION_NCN_PROGRAM_ID=Fv9aHCgvPQSr4jg9W8eTS6Ys1SNmh2qjyATrbsjEMaSH
RESTAKING_PROGRAM_ID=6Weyp6uFyjJ3pzYz7XbXvCPAyvzLUhESEhHarFRm53Nb
VAULT_PROGRAM_ID=4vB3bvqKEmxV68J7XtS1HqZomjok4ZXc1ELJH9p1K1D2
191 changes: 191 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
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

code_gen:
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: Regenerate Shank IDL files
run: cargo b --release -p jito-shank-cli && ./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: ${{ env.RESTAKING_PROGRAM_ID }}
VAULT_PROGRAM_ID: ${{ env.VAULT_PROGRAM_ID }}
- name: Upload restaking program
uses: actions/upload-artifact@v4
with:
name: jito_restaking_program.so
path: target/sbf-solana-solana/release/jito_restaking_program.so
if-no-files-found: error
- name: Upload vault program
uses: actions/upload-artifact@v4
with:
name: jito_vault_program.so
path: target/sbf-solana-solana/release/jito_vault_program.so
if-no-files-found: error

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: Cnp3S1G3JaaAoFpFR3FhM94DdEF1mMBqy5vjwtDaVZLi
VAULT_PROGRAM_ID: 94sqeuUnjJCmwZUp8nGK7Q7o8YnHSW9Y3TcPZJY2PycN
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: jito-foundation/restaking
fail_ci_if_error: true

test_sbf:
name: cargo test
runs-on: ubuntu-latest
needs:
- 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
44 changes: 44 additions & 0 deletions .github/workflows/jekyll-gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build Jekyll site
on:
push:
branches: [ "master" ]

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# Build the cargo docs
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-07-25
- name: Generate Cargo Docs
run: cargo doc --no-deps
- name: Copy Cargo Docs to Jekyll source
run: cp -R target/doc docs/api

# Setup Github Pages
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/target

.developer
node_modules
Loading

0 comments on commit d289f83

Please sign in to comment.