2022-02-28 03:58:39 -08:00
|
|
|
name: Lint and Test
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: master
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
SOLANA_VERSION: "1.9.5"
|
|
|
|
RUST_TOOLCHAIN: stable
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Rust nightly
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
override: true
|
|
|
|
profile: minimal
|
|
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
|
|
components: rustfmt, clippy
|
|
|
|
- name: Cache dependencies
|
|
|
|
uses: Swatinem/rust-cache@v1
|
|
|
|
|
|
|
|
- name: Run fmt
|
|
|
|
run: cargo fmt -- --check
|
|
|
|
# The style and complexity lints have not been processed yet.
|
|
|
|
- name: Run clippy
|
|
|
|
run: cargo clippy -- --deny=warnings --allow=clippy::style --allow=clippy::complexity
|
|
|
|
|
|
|
|
tests:
|
|
|
|
name: Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Linux dependencies
|
|
|
|
run: sudo apt-get update && sudo apt-get install -y pkg-config build-essential libudev-dev
|
|
|
|
- name: Install Rust nightly
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
override: true
|
|
|
|
profile: minimal
|
|
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
|
|
- name: Cache dependencies
|
|
|
|
uses: Swatinem/rust-cache@v1
|
|
|
|
|
|
|
|
# Install Solana
|
|
|
|
- name: Cache Solana binaries
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.cache/solana
|
|
|
|
key: ${{ runner.os }}-${{ env.SOLANA_VERSION }}
|
|
|
|
- name: Install Solana
|
|
|
|
run: |
|
|
|
|
sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_VERSION }}/install)"
|
|
|
|
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
|
|
|
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
|
|
|
|
solana --version
|
|
|
|
echo "Generating keypair..."
|
|
|
|
solana-keygen new -o "$HOME/.config/solana/id.json" --no-passphrase --silent
|
2022-03-13 07:18:50 -07:00
|
|
|
- name: Build all deps
|
|
|
|
run: cargo build-bpf
|
2022-02-28 03:58:39 -08:00
|
|
|
- name: Run bpf tests
|
|
|
|
run: cargo test-bpf
|