Skip to content

Commit 39925de

Browse files
committed
feat: run rust unit tests on CI
1 parent 9dffa10 commit 39925de

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

.github/actions/setup-anchor/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: "Setup node js and anchor cli"
33
runs:
44
using: "composite"
55
steps:
6-
- uses: actions/setup-node@v2
6+
- uses: actions/setup-node@v6
77
with:
88
node-version: ${{ env.NODE_VERSION }}
99
- run: cargo install --git https://github.com/coral-xyz/anchor --tag v${{ env.ANCHOR_CLI_VERSION }} anchor-cli --locked

.github/workflows/ci.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,25 @@ jobs:
5353
- run: anchor build
5454
shell: bash
5555

56-
program_test:
56+
unit_test:
57+
runs-on: ubuntu-latest
58+
needs: program_changed_files
59+
if: needs.program_changed_files.outputs.program == 'true'
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 1
64+
- uses: dtolnay/rust-toolchain@stable
65+
with:
66+
toolchain: ${{ env.TOOLCHAIN }}
67+
components: clippy
68+
- uses: Swatinem/rust-cache@v2
69+
- run: cargo test --package zap
70+
shell: bash
71+
- run: cargo test --package protocol-zap
72+
shell: bash
73+
74+
integration_test:
5775
runs-on: ubuntu-latest
5876
needs: program_changed_files
5977
if: needs.program_changed_files.outputs.program == 'true'

libs/dlmm/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ version = "0.10.1"
44
description = "Created with Anchor"
55
edition = "2021"
66

7+
[lib]
8+
doctest = false
9+
710
[dependencies]
811
anchor-lang = { workspace = true }
912
bytemuck = { workspace = true, features = ["min_const_generics"] }

programs/zap/src/tests/dlmm_rebalancing_tests/bid_ask_strategy_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn test_strategy_only_ask_side_single_bin() {
3232
let amount_in_bin = &amount_in_bins[0];
3333

3434
let diff = total_amount_x - amount_in_bin.amount_x;
35-
assert_eq!(diff, 12);
35+
assert_eq!(diff, 1);
3636
}
3737

3838
#[test]

0 commit comments

Comments
 (0)