Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
install:
runs-on: ubuntu-latest
container:
image: rust:latest
image: rust:1.89.0
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
Expand All @@ -34,7 +34,7 @@ jobs:
rust-checks:
runs-on: ubuntu-latest
container:
image: rust:latest
image: rust:1.89.0

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -82,6 +82,10 @@ jobs:
~/.cache/solana/
~/.local/share/solana/
key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
- name: Install protoc (protobuf-compiler)
run: |
apt-get update
apt-get install -y protobuf-compiler
- name: Build shared object
run: |
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/publish-crate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publish Crates & SDKs
on:
release:
types: [ published ]
push:
branches:
- 'release/v*'
workflow_dispatch:

env:
rust_version: 1.89.0

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: install essentials
run: |
sudo apt-get update
sudo apt-get install -y pkg-config build-essential libudev-dev
npm install --global yarn

- name: Install Rust
shell: "bash"
run: rustup toolchain install ${{ env.rust_version }} --profile minimal

- name: Cache rust
uses: Swatinem/rust-cache@v2

lint:
needs: install
runs-on: ubuntu-latest
defaults:
run:
working-directory: rust/

steps:
- uses: actions/checkout@v4
- name: Run fmt
run: cargo fmt -- --check

- name: Run clippy
run: cargo clippy -- --deny=warnings

publish:
needs: [install, lint]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: run build
working-directory: rust/
run: |
cargo build
cargo test

- name: Set DRY_RUN based on trigger
run: echo "DRY_RUN=true" >> $GITHUB_ENV
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/v')

- name: cargo publish
working-directory: rust/
run: |
DRY_RUN_FLAG=""
if [ "${DRY_RUN}" = "true" ]; then
DRY_RUN_FLAG="--dry-run"
fi

if [ "${DRY_RUN}" = "true" ]; then
NO_VERIFY_FLAG="--no-verify"
fi

cargo publish $DRY_RUN_FLAG --manifest-path=Cargo.toml --token $CRATES_TOKEN $NO_VERIFY_FLAG
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
DRY_RUN: ${{ env.DRY_RUN }}
Loading