Skip to content

Fix GitHub Actions workflow issues with Cargo compatibility and Solan… #11

Fix GitHub Actions workflow issues with Cargo compatibility and Solan…

Fix GitHub Actions workflow issues with Cargo compatibility and Solan… #11

Workflow file for this run

name: build
on:
push:
branches: ['*']
tags: ['v[0-9]+.[0-9]+.[0-9]+']
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
# Rust setup and build with explicit update to latest version
- name: Install and Update Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Update Cargo to latest stable
run: |
rustup update stable
rustup default stable
cargo --version
- name: Install Solana CLI
run: |
# Install Solana CLI tools
sh -c "$(curl -sSfL https://release.solana.com/v1.16.0/install)"
# Add Solana to PATH for this job
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
# Also add to PATH for current shell session
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
# Verify installation
solana --version
- name: Build Solana program
run: |
# Ensure Solana binaries are in PATH
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
# Try the newer cargo build-sbf command first, fall back to cargo build-bpf if not available
# First check if the commands are directly available
if cargo build-sbf --help &> /dev/null; then
echo "Using cargo build-sbf"
cargo build-sbf
elif cargo build-bpf --help &> /dev/null; then
echo "Using cargo build-bpf"
cargo build-bpf
else
echo "Installing Solana BPF/SBF tools..."
solana-install update
# Add Solana's .cargo/bin to PATH (where cargo-build-bpf is installed)
export PATH="$HOME/.cargo/bin:$PATH"
# Try again after update
if cargo build-sbf --help &> /dev/null; then
echo "Using cargo build-sbf after update"
cargo build-sbf
else
echo "Using cargo build-bpf after update"
cargo build-bpf
fi
fi
- name: Run Solana tests
run: |
# Ensure Solana binaries are in PATH
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
# Try the newer cargo test-sbf command first, fall back to cargo test-bpf if not available
if cargo test-sbf --help &> /dev/null; then
echo "Using cargo test-sbf"
cargo test-sbf
elif cargo test-bpf --help &> /dev/null; then
echo "Using cargo test-bpf"
cargo test-bpf
else
echo "Installing Solana BPF/SBF tools..."
solana-install update
# Add Solana's .cargo/bin to PATH (where cargo-test-bpf is installed)
export PATH="$HOME/.cargo/bin:$PATH"
# Try again after update
if cargo test-sbf --help &> /dev/null; then
echo "Using cargo test-sbf after update"
cargo test-sbf
else
echo "Using cargo test-bpf after update"
cargo test-bpf
fi
fi
- name: Run Cargo Clippy
run: cargo clippy -- -D warnings
- name: Build client
run: cd client && bun install
- name: Run client tests
run: cd client && bun test