Skip to content

Commit

Permalink
Backport #101 (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalu authored Oct 10, 2023
1 parent 4c630b0 commit 6cfbb31
Show file tree
Hide file tree
Showing 10 changed files with 969 additions and 445 deletions.
75 changes: 54 additions & 21 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- master
env:
SOLANA_CLI_VERSION: 1.13.5
SOLANA_CLI_VERSION: 1.16.16
jobs:
build-and-test:
name: Build and test programs
Expand All @@ -28,29 +28,62 @@ jobs:
~/.cargo/git/db/
./target/
key: cargo-${{ runner.os }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- run: cargo install --git https://github.com/project-serum/anchor --tag v0.26.0 anchor-cli --locked --force
- run: cargo install --git https://github.com/coral-xyz/anchor --tag v0.28.0 anchor-cli --locked --force
- name: Install yarn dependencies
working-directory: ./mev-programs
run: yarn
- name: Run Anchor test
working-directory: ./mev-programs
run: anchor test
- uses: reinismu/clippy-check@master
with:
working-directory: ./mev-programs/programs
token: ${{ secrets.GITHUB_TOKEN }}
soteria:
needs: build-and-test
name: Runs soteria analysis
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-solana/
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- run: cd ./mev-programs && sh -c "$(curl -k https://supercompiler.xyz/install)" && cargo build-bpf
- run: cd ./mev-programs && ./soteria-linux-develop/bin/soteria -analyzeAll .
toolchain: nightly-2023-04-19-x86_64-unknown-linux-gnu
components: rustfmt, clippy
- name: clippy
working-directory: ./mev-programs
run: cargo +nightly-2023-04-19 clippy
shell: bash

# Build IDLs
- name: Build jito_tip_distribution
working-directory: ./mev-programs
run: anchor build --idl idl --program-name jito_tip_distribution
- name: Build jito_tip_payment
working-directory: ./mev-programs
run: anchor build --idl idl --program-name jito_tip_payment

# Test
- name: Run Anchor test
working-directory: ./mev-programs
run: anchor test

# Make sure no uncommitted changes
- name: Check for diff
run: git diff --exit-code

# verified-build:
# name: Build Verifiable Artifact
# runs-on: big-runner-1
# steps:
# - name: Checkout
# uses: actions/checkout@v3
#
# # --force because the cargo cache has it saved
# - name: Install Solana Verify
# run: |
# cargo install solana-verify --force
# solana-verify --version
#
# - name: Verifiable Build
# working-directory: ./mev-programs
# run: |
# solana-verify build --library-name jito_tip_distribution
# solana-verify build --library-name jito_tip_payment
#
# - name: Upload Artifact
# uses: actions/upload-artifact@v3
# with:
# name: build
# path: |
# mev-programs/target/deploy/jito_tip_distribution.so
# mev-programs/target/deploy/jito_tip_payment.so
# mev-programs/target/idl/jito_tip_distribution.json
# mev-programs/target/idl/jito_tip_payment.json
94 changes: 94 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Release
on:
push:
tags:
- 'v*'

env:
SOLANA_CLI_VERSION: 1.16.16
jobs:
release:
name: Create the jito programs release
runs-on: big-runner-1

steps:
# Setup
- uses: actions/checkout@v2
- uses: ./.github/actions/setup/
- uses: ./.github/actions/setup-solana/
- uses: actions/cache@v2
name: Cache Cargo registry + index
id: cache-anchor
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./mev-programs/target/
key: cargo-${{ runner.os }}-anchor-${{ hashFiles('**/Cargo.lock') }}
- run: cargo install --git https://github.com/coral-xyz/anchor --tag v0.28.0 anchor-cli --locked --force
- name: Install yarn dependencies
working-directory: ./mev-programs
run: yarn

# Build IDLs + programs
- name: Build jito_tip_distribution
working-directory: ./mev-programs
run: anchor build --idl idl --program-name jito_tip_distribution
- name: Build jito_tip_payment
working-directory: ./mev-programs
run: anchor build --idl idl --program-name jito_tip_payment

# Test
- name: Run Anchor test
working-directory: ./mev-programs
run: anchor test

# Verified build
# --force because the cargo cache has it saved
# - name: Install Solana Verify
# run: |
# cargo install solana-verify --force
# solana-verify --version
#
# - name: Verifiable Build
# working-directory: ./mev-programs
# run: |
# solana-verify build --library-name jito_tip_distribution
# solana-verify build --library-name jito_tip_payment

# Make sure no uncommitted changes
- name: Check for diff
run: git diff --exit-code

# Push to anchor repository
- name: Anchor Login
working-directory: ./mev-programs
run: anchor login ${{ secrets.ANCHOR_PUBLISH_TOKEN }}
- name: Publish tip-payment source code
working-directory: ./mev-programs
run: yes 'yes' | anchor publish jito_tip_payment --skip-build --provider.cluster mainnet
- name: Publish tip-distribution source code
working-directory: ./mev-programs
run: yes 'yes' | anchor publish jito_tip_distribution --skip-build --provider.cluster mainnet

# Upload artifacts
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: build
path: |
mev-programs/target/deploy/jito_tip_distribution.so
mev-programs/target/deploy/jito_tip_payment.so
mev-programs/target/idl/jito_tip_distribution.json
mev-programs/target/idl/jito_tip_payment.json
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
mev-programs/target/deploy/jito_tip_distribution.so
mev-programs/target/deploy/jito_tip_payment.so
mev-programs/target/idl/jito_tip_distribution.json
mev-programs/target/idl/jito_tip_payment.json
Loading

0 comments on commit 6cfbb31

Please sign in to comment.