Skip to content

Commit 2c2c7c1

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

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

.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)