drift-rs 1.0.0-alpha.15

Rust SDK for Drift V2 Protocol on the Solana blockchain.
Documentation
name: Build

on:
  push:
    branches:
      - master
      - main
    paths:
      - "**.rs"
      - "**.toml"
      - "**.lock"
      - ".github/workflows/*.yml"
  pull_request:
    branches:
      - master
      - main
    paths:
      - "**.rs"
      - "**.toml"
      - "**.lock"
      - ".github/workflows/*.yml"

jobs:
  format-build-test:
    env:
      CARGO_DRIFT_FFI_PATH: /usr/lib
    runs-on: ubicloud
    timeout-minutes: 15
    steps:
      - name: Check out
        uses: actions/checkout@v4
        with:
          submodules: true
      - name: Cache Rust toolchain
        uses: actions/cache@v4
        with:
         path: |
           ~/.rustup
           ~/.cargo/registry
           ~/.cargo/git
           target
         key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
         restore-keys: |
           ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
      - name: Config rust toolchain
        run: |
          rustup show active-toolchain
          rustup component add clippy rustfmt
      - name: install latest libdrift_ffi_sys
        run: |
          # NB: this will break historic CI jobs (if breaking program changes happen)
          # better to ensure latest version works
          SO_URL=$(curl -s https://api.github.com/repos/drift-labs/drift-ffi-sys/releases/latest | jq -r '.assets[] | select(.name=="libdrift_ffi_sys.so") | .browser_download_url')
          echo "downloading libdrift: $SO_URL"
          curl -L -o libdrift_ffi_sys.so "$SO_URL"
          sudo cp libdrift_ffi_sys.so $CARGO_DRIFT_FFI_PATH
      - name: Format
        run: cargo fmt --all -- --check
      - name: Build
        run: cargo check
      - name: Test
        run: |
          cargo test --no-fail-fast --lib -- --nocapture
          cargo test --no-fail-fast --test integration -- --nocapture --test-threads 1
        env:
          TEST_DEVNET_RPC_ENDPOINT: ${{ secrets.DEVNET_RPC_ENDPOINT }}
          TEST_MAINNET_RPC_ENDPOINT: ${{ secrets.MAINNET_RPC_ENDPOINT }}
          TEST_PRIVATE_KEY: ${{ secrets.TEST_PRIVATE_KEY }}
          TEST_GRPC_X_TOKEN: ${{ secrets.TEST_GRPC_X_TOKEN }}