Credix liquidity exchange IX #1387
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Test | |
on: | |
pull_request: | |
branches: [main, develop] | |
push: | |
branches: [main, develop] | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_TOOLCHAIN: 1.75.0 | |
SOLANA_VERSION: 1.18.21 | |
defaults: | |
run: | |
working-directory: ./ | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
fmt: | |
runs-on: ubuntu-latest | |
name: cargo fmt | |
steps: | |
# Checkout Repo | |
- uses: actions/checkout@v2 | |
# Installs Rust | |
- name: Cache rust | |
uses: Swatinem/rust-cache@v1 | |
- name: Rust toolchain installation | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
override: true | |
profile: default | |
components: rustfmt, clippy | |
# Run cargo fmt | |
- name: Run fmt | |
run: cargo fmt -- --check | |
clippy: | |
runs-on: ubuntu-latest | |
name: cargo clippy | |
steps: | |
# Checkout Repo | |
- uses: actions/checkout@v2 | |
# Installs Rust | |
- name: Cache rust | |
uses: Swatinem/rust-cache@v1 | |
- name: Rust toolchain installation | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
override: true | |
profile: default | |
components: rustfmt, clippy | |
# Run cargo clippy | |
- name: Run clippy | |
run: cargo clippy --all-targets -- --deny=warnings | |
tests: | |
runs-on: ubuntu-latest | |
name: Run tests | |
steps: | |
# Checkout Repo | |
- uses: actions/checkout@v2 | |
# Installs Rust | |
- name: Cache rust | |
uses: Swatinem/rust-cache@v1 | |
- name: Rust toolchain installation | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
override: true | |
profile: default | |
components: rustfmt, clippy | |
# Install Solana | |
- name: Install Linux dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pkg-config build-essential libudev-dev | |
- 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 | |
# Run tests | |
- name: Run tests | |
run: cargo test |