Skip to content

Evm/per chain transceivers #1801

Evm/per chain transceivers

Evm/per chain transceivers #1801

Workflow file for this run

name: Solana CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- dev
defaults:
run:
working-directory: ./solana
jobs:
solana-sbf:
name: Solana Cargo SBF
runs-on: tilt-kube-public
env:
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v3
- name: Get rust toolchain version
id: toolchain
run: |
RUST_VERSION="$(awk '/channel =/ { print substr($3, 2, length($3)-2) }' rust-toolchain)"
echo "::set-output name=version::${RUST_VERSION}"
- name: Get solana version
id: solana
run: |
SOLANA_VERSION="$(awk '/solana-program =/ { print substr($3, 3, length($3)-3) }' Cargo.toml)"
echo "::set-output name=version::${SOLANA_VERSION}"
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb
with:
toolchain: ${{ steps.toolchain.outputs.version }}
components: "clippy,rustfmt"
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: "solana"
- name: Run `cargo fmt`
run: cargo fmt --check --all --manifest-path Cargo.toml
- name: Run `cargo check`
run: cargo check --workspace --tests --manifest-path Cargo.toml
- name: Run `cargo clippy`
run: cargo clippy --workspace --tests --manifest-path Cargo.toml -- -Dclippy::cast_possible_truncation
- name: Cache solana tools
id: cache-solana
uses: actions/cache@v3
env:
cache-name: solana-tools
with:
path: |
~/.local/share/solana/install/
~/.cache/solana/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ steps.solana.outputs.version }}
- if: ${{ steps.cache-solana.outputs.cache-hit != 'true' }}
name: Install solana tools
env:
SOLANA_VERSION: ${{ steps.solana.outputs.version }}
run: |
sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_VERSION}/install)"
~/.local/share/solana/install/active_release/bin/sdk/sbf/scripts/install.sh
- name: cargo build-sbf && cargo test-sbf && cargo test
env:
RUST_BACKTRACE: "1"
run: |
export BPF_OUT_DIR="$(pwd)/target/deploy"
export PATH="${HOME}/.local/share/solana/install/active_release/bin:${PATH}"
mkdir -p "${BPF_OUT_DIR}"
cargo build-sbf --features "mainnet"
cargo test-sbf --features "mainnet"
cargo test
check-version:
name: Check version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./scripts/sync-versions --check
shell: bash
anchor-test:
name: Anchor Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: metadaoproject/setup-anchor@v2
with:
node-version: "20.11.0"
solana-cli-version: "1.18.10"
anchor-version: "0.29.0"
- name: Cache node_modules
uses: actions/cache@v3
with:
path: ./solana/node_modules/
key: node-modules-${{ runner.os }}-build-${{ inputs.node-version }}
- name: Install node_modules
run: make node_modules
shell: bash
- name: Create keypair
run: solana-keygen new --no-bip39-passphrase
shell: bash
- name: Make Anchor.toml compatible with runner
run: sed -i 's:/user/:/runner/:' Anchor.toml
shell: bash
- name: Install Cargo toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustc
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: "solana"
- name: Setup SDK
run: make sdk
shell: bash
- name: Check idl
run: |
git diff --exit-code ts/idl
- name: Set default Rust toolchain
run: rustup default stable
shell: bash
- name: Run anchor lint
run: make anchor-lint
shell: bash
- name: Run tests
run: anchor test --skip-build
shell: bash