Skip to content

Commit fdcea93

Browse files
committed
Add test profile to docker-compose.yml. Update GH checks workflow to use docker compose for build and test jobs. Add vitest and tsup to ts-sdk manifests.
1 parent 94174ad commit fdcea93

File tree

9 files changed

+173
-78
lines changed

9 files changed

+173
-78
lines changed

.github/workflows/checks.yml

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,60 +10,24 @@ concurrency:
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-latest
13+
runs-on: blacksmith-8vcpu-ubuntu-2404
1414
steps:
1515
- name: Checkout repository
1616
uses: actions/checkout@v5
17-
- name: Setup Anchor
18-
uses: ./.github/actions/anchor
19-
- name: Install dependencies
20-
run: yarn install
21-
- name: Build packages
22-
run: yarn build --output-style static
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
- name: Build all packages
20+
run: docker compose --profile build up
2321

2422
test:
25-
if: false # temporarily disable test script
26-
runs-on: ubuntu-latest
23+
runs-on: blacksmith-8vcpu-ubuntu-2404
2724
steps:
2825
- name: Checkout repository
2926
uses: actions/checkout@v5
30-
- name: Add swap to increase memory
31-
run: |
32-
sudo fallocate -l 16G /swapfile
33-
sudo chmod 600 /swapfile
34-
sudo mkswap /swapfile
35-
sudo swapon /swapfile
36-
free -h
37-
- name: Remove Unnecessary Files
38-
uses: ./.github/actions/cleanup
39-
- name: Setup Anchor
40-
uses: ./.github/actions/anchor
41-
- name: Install dependencies
42-
run: yarn install
43-
- name: Build common SDK
44-
run: yarn workspace @orca-so/common-sdk build
45-
- name: Build Whirlpool program (IDL)
46-
run: yarn workspace @orca-so/whirlpools-program build
47-
- name: Build legacy SDK only
48-
env:
49-
NODE_OPTIONS: --max-old-space-size=8192
50-
run: yarn workspace @orca-so/whirlpools-sdk build
51-
- name: Run LiteSVM-safe tests
52-
env:
53-
NODE_OPTIONS: --max-old-space-size=8192
54-
VITEST_SEGFAULT_RETRY: "2"
55-
run: |
56-
yarn vitest run legacy-sdk/whirlpool \
57-
--config legacy-sdk/whirlpool/vitest.config.mts \
58-
--reporter verbose
59-
- name: Run remaining Nx tests
60-
run: |
61-
yarn nx run-many \
62-
--target=test \
63-
--all \
64-
--exclude=whirlpools-sdk \
65-
--exclude=legacy-sdk/integration \
66-
--exclude=rust-sdk/integration
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
- name: Run all tests
30+
run: docker compose --profile test up
6731

6832
lint:
6933
runs-on: ubuntu-latest

docker-compose.yml

Lines changed: 144 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,32 @@ name: whirlpools
22

33
services:
44
build-solana-program:
5-
image: backpackapp/build:v0.32.1
5+
platform: linux/amd64
6+
image: solanafoundation/anchor:v0.32.1
67
working_dir: /usr/src/whirlpools
78
command: >
89
anchor build
9-
profiles: [build]
10+
profiles: [build, test]
1011
volumes:
1112
- ./:/usr/src/whirlpools
1213

1314
yarn-install:
15+
platform: linux/amd64
1416
image: rust:1.84.0
1517
working_dir: /usr/src/whirlpools
1618
command: >
1719
sh -c "curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
1820
&& apt-get update && apt-get install -y nodejs
1921
&& corepack enable && corepack prepare [email protected] --activate
2022
&& yarn install"
21-
profiles: [build]
23+
profiles: [build, test]
2224
volumes:
2325
- ./:/usr/src/whirlpools
2426
- node_modules:/usr/src/whirlpools/node_modules
2527
- yarn_cache:/usr/src/whirlpools/.yarn/cache
2628

2729
build-ts-sdk:
30+
platform: linux/amd64
2831
image: rust:1.84.0
2932
working_dir: /usr/src/whirlpools
3033
command: >
@@ -37,7 +40,7 @@ services:
3740
&& yarn workspace @orca-so/tx-sender build
3841
&& yarn workspace @orca-so/whirlpools build
3942
&& yarn workspace @orca-so/whirlpools-lint format"
40-
profiles: [build]
43+
profiles: [build, test]
4144
depends_on:
4245
build-solana-program:
4346
condition: service_completed_successfully
@@ -49,6 +52,7 @@ services:
4952
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
5053

5154
build-legacy-sdk:
55+
platform: linux/amd64
5256
image: rust:1.84.0
5357
working_dir: /usr/src/whirlpools
5458
command: >
@@ -58,7 +62,7 @@ services:
5862
&& yarn workspace @orca-so/common-sdk build
5963
&& yarn workspace @orca-so/whirlpools-sdk build
6064
&& yarn workspace @orca-so/whirlpools-sdk-cli build"
61-
profiles: [build]
65+
profiles: [build, test]
6266
depends_on:
6367
build-solana-program:
6468
condition: service_completed_successfully
@@ -70,25 +74,27 @@ services:
7074
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
7175

7276
build-rust-sdk:
77+
platform: linux/amd64
7378
image: rust:1.84.0
7479
working_dir: /usr/src/whirlpools
7580
command: >
7681
sh -c "rustup component add clippy rustfmt
77-
&& cargo build --manifest-path rust-sdk/macros/Cargo.toml --locked
78-
&& cargo build --manifest-path rust-sdk/core/Cargo.toml --locked
79-
&& cargo build --manifest-path rust-sdk/client/Cargo.toml --locked
80-
&& cargo build --manifest-path rust-sdk/whirlpool/Cargo.toml --locked
81-
&& cargo build --manifest-path rust-sdk/tx-sender/Cargo.toml --locked
82+
&& cargo build --manifest-path rust-sdk/macros/Cargo.toml
83+
&& cargo build --manifest-path rust-sdk/core/Cargo.toml
84+
&& cargo build --manifest-path rust-sdk/client/Cargo.toml
85+
&& cargo build --manifest-path rust-sdk/whirlpool/Cargo.toml
86+
&& cargo build --manifest-path rust-sdk/tx-sender/Cargo.toml
8287
&& cargo clippy --fix --allow-dirty --allow-staged
8388
&& cargo fmt"
84-
profiles: [build]
89+
profiles: [build, test]
8590
depends_on:
8691
build-solana-program:
8792
condition: service_completed_successfully
8893
volumes:
8994
- ./:/usr/src/whirlpools
9095

9196
build-integration:
97+
platform: linux/amd64
9298
image: rust:1.84.0
9399
working_dir: /usr/src/whirlpools
94100
command: >
@@ -109,6 +115,7 @@ services:
109115
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
110116

111117
build-docs:
118+
platform: linux/amd64
112119
image: rust:1.84.0
113120
working_dir: /usr/src/whirlpools
114121
command: >
@@ -133,14 +140,15 @@ services:
133140
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
134141

135142
build-examples:
143+
platform: linux/amd64
136144
image: rust:1.84.0
137145
working_dir: /usr/src/whirlpools
138146
command: >
139147
sh -c "curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
140148
&& apt-get update && apt-get install -y nodejs
141149
&& corepack enable && corepack prepare [email protected] --activate
142150
&& yarn workspace @orca-so/whirlpools-example-ts-next build
143-
&& cargo build --manifest-path examples/rust-sdk/whirlpool_repositioning_bot/Cargo.toml --locked"
151+
&& cargo build --manifest-path examples/rust-sdk/whirlpool_repositioning_bot/Cargo.toml"
144152
profiles: [build]
145153
depends_on:
146154
build-rust-sdk:
@@ -153,6 +161,7 @@ services:
153161
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
154162

155163
build:
164+
platform: linux/amd64
156165
image: alpine:3
157166
working_dir: /usr/src/whirlpools
158167
command: >
@@ -178,6 +187,129 @@ services:
178187
volumes:
179188
- ./:/usr/src/whirlpools
180189

190+
test-program:
191+
platform: linux/amd64
192+
image: rust:1.84.0
193+
working_dir: /usr/src/whirlpools
194+
command: >
195+
cargo test -p whirlpool
196+
profiles: [test]
197+
depends_on:
198+
build-solana-program:
199+
condition: service_completed_successfully
200+
volumes:
201+
- ./:/usr/src/whirlpools
202+
203+
test-program-integration:
204+
platform: linux/amd64
205+
image: ubuntu:24.04
206+
working_dir: /usr/src/whirlpools
207+
command: >
208+
sh -c "apt-get update && apt-get install -y curl ca-certificates
209+
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
210+
&& apt-get install -y nodejs
211+
&& corepack enable && corepack prepare [email protected] --activate
212+
&& yarn install
213+
&& yarn workspace @orca-so/whirlpools-sdk test"
214+
profiles: [test]
215+
depends_on:
216+
build-solana-program:
217+
condition: service_completed_successfully
218+
yarn-install:
219+
condition: service_completed_successfully
220+
build-legacy-sdk:
221+
condition: service_completed_successfully
222+
volumes:
223+
- ./:/usr/src/whirlpools
224+
- node_modules:/usr/src/whirlpools/node_modules
225+
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
226+
227+
test-ts-sdk:
228+
platform: linux/amd64
229+
image: rust:1.84.0
230+
working_dir: /usr/src/whirlpools
231+
command: >
232+
sh -c "curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
233+
&& apt-get update && apt-get install -y nodejs
234+
&& corepack enable && corepack prepare [email protected] --activate
235+
&& yarn workspace @orca-so/whirlpools-client test
236+
&& yarn workspace @orca-so/whirlpools-core test
237+
&& yarn workspace @orca-so/tx-sender test
238+
&& yarn workspace @orca-so/whirlpools test"
239+
profiles: [test]
240+
depends_on:
241+
build-solana-program:
242+
condition: service_completed_successfully
243+
yarn-install:
244+
condition: service_completed_successfully
245+
build-ts-sdk:
246+
condition: service_completed_successfully
247+
volumes:
248+
- ./:/usr/src/whirlpools
249+
- node_modules:/usr/src/whirlpools/node_modules
250+
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
251+
252+
test-rust-sdk:
253+
platform: linux/amd64
254+
image: rust:1.84.0
255+
working_dir: /usr/src/whirlpools
256+
command: >
257+
sh -c "cp legacy-sdk/whirlpool/tests/external_program/token_2022.20250510.so target/deploy/
258+
&& cargo test --manifest-path rust-sdk/macros/Cargo.toml --lib
259+
&& cargo test --manifest-path rust-sdk/core/Cargo.toml --lib
260+
&& cargo test --manifest-path rust-sdk/client/Cargo.toml --lib
261+
&& cargo test --manifest-path rust-sdk/whirlpool/Cargo.toml --lib
262+
&& cargo test --manifest-path rust-sdk/tx-sender/Cargo.toml --lib"
263+
profiles: [test]
264+
depends_on:
265+
build-solana-program:
266+
condition: service_completed_successfully
267+
build-rust-sdk:
268+
condition: service_completed_successfully
269+
volumes:
270+
- ./:/usr/src/whirlpools
271+
272+
test-integration:
273+
image: rust:1.84.0
274+
working_dir: /usr/src/whirlpools
275+
command: >
276+
sh -c "curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
277+
&& apt-get update && apt-get install -y nodejs
278+
&& corepack enable && corepack prepare [email protected] --activate
279+
&& yarn workspace @orca-so/whirlpools-integration test
280+
&& yarn workspace @orca-so/whirlpools-rust-integration test"
281+
profiles: [test-integration]
282+
depends_on:
283+
build-rust-sdk:
284+
condition: service_completed_successfully
285+
build-ts-sdk:
286+
condition: service_completed_successfully
287+
build-integration:
288+
condition: service_completed_successfully
289+
volumes:
290+
- ./:/usr/src/whirlpools
291+
- node_modules:/usr/src/whirlpools/node_modules:ro
292+
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
293+
294+
test:
295+
platform: linux/amd64
296+
image: alpine:3
297+
working_dir: /usr/src/whirlpools
298+
command: >
299+
echo "Tests Completed"
300+
depends_on:
301+
# test-program:
302+
# condition: service_completed_successfully
303+
# test-program-integration:
304+
# condition: service_completed_successfully
305+
# test-ts-sdk:
306+
# condition: service_completed_successfully
307+
test-rust-sdk:
308+
condition: service_completed_successfully
309+
profiles: [test]
310+
volumes:
311+
- ./:/usr/src/whirlpools
312+
181313
volumes:
182314
node_modules:
183315
yarn_cache:

legacy-sdk/whirlpool/vitest.config.mts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,6 @@ export default defineConfig({
44
test: {
55
globals: true,
66
testTimeout: 60000,
7-
8-
// --- LiteSVM stability settings ---
9-
// Run tests sequentially — LiteSVM singleton is not thread-safe
10-
fileParallelism: false,
11-
maxConcurrency: 1,
12-
13-
// Use a single forked process to avoid native memory duplication
14-
pool: "forks",
15-
poolOptions: {
16-
forks: {
17-
singleFork: true, // all tests share one process
18-
},
19-
},
20-
21-
// Avoid isolating test environments so the singleton persists cleanly
22-
isolate: false,
7+
pool: 'forks',
238
},
249
});

ts-sdk/client/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
"@orca-so/whirlpools-program": "*",
3939
"@solana/kit": "^2.3.0",
4040
"codama": "^1.3.7",
41-
"typescript": "^5.9.3"
41+
"tsup": "^8.4.0",
42+
"typescript": "^5.9.3",
43+
"vitest": "^3.2.4"
4244
},
4345
"repository": {
4446
"type": "git",

ts-sdk/core/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
"devDependencies": {
2626
"@orca-so/whirlpools-client": "*",
2727
"@orca-so/whirlpools-rust-core": "*",
28+
"tsup": "^8.4.0",
2829
"typescript": "^5.9.3",
30+
"vitest": "^3.2.4",
2931
"wasm-pack": "^0.13.1"
3032
},
3133
"repository": {

ts-sdk/integration/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"devDependencies": {
1414
"tsx": "^4.19.3",
15-
"typescript": "^5.9.3"
15+
"typescript": "^5.9.3",
16+
"vitest": "^3.2.4"
1617
}
1718
}

ts-sdk/tx-sender/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"devDependencies": {
4040
"@solana/kit": "^3.0.3",
4141
"tsup": "^8.4.0",
42-
"typescript": "^5.9.3"
42+
"typescript": "^5.9.3",
43+
"vitest": "^3.2.4"
4344
},
4445
"repository": {
4546
"type": "git",

0 commit comments

Comments
 (0)