Jordy/liq helpers (#175) #504
This file contains hidden or 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: 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 | |
id: cache-rust-target-restore | |
uses: actions/cache/restore@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 2 | |
cargo test --no-fail-fast --test jupiter -- --nocapture --test-threads 2 | |
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_MAINNET_PRIVATE_KEY: ${{ secrets.TEST_MAINNET_PRIVATE_KEY }} | |
TEST_GRPC_X_TOKEN: ${{ secrets.TEST_GRPC_X_TOKEN }} | |
- name: Cache Rust toolchain (save) | |
uses: actions/cache/save@v4 | |
if: success() || failure() | |
with: | |
path: | | |
~/.rustup | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ steps.cache-rust-target-restore.outputs.cache-primary-key }} |