Skip to content

Commit e20268a

Browse files
authored
[TKN-703, AMM-41] Dockerize CI build, test and lint jobs (#1160)
* 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. * Add lint profile and dockerize CI lint job. Add skip-changeset label to changeset CI check. * Fix label. Fix lint profile deps. * Fix changeset * Update litesvm vitest config * Update CI commands for docker compose * Update CI commands for docker compose * Update runs-on * Add temp diagnostics * Test updated CI flow * Test updated CI flow * Use macos latest for test * Install docker on macos-latest * Install docker on macos-latest * Install docker on macos-latest * Install docker on macos-latest * Install docker on macos-latest * Revert to Blacksmith. Use rust 1.85 image. * Revert to ubuntu image. Raise max_map_count * Add diagnostics * Add diagnostics * Update node version for litesvm tests * Update litesvm vitest config to exit after completion (using pool: forks). Remove memory/kernel settings in CI * Update all vitest config to exit after completion (using pool: forks). * Remove build-rust-sdk dep from test-rust-sdk. * Remove docker buildx from ci * Quiet cargo build and test. Use threads instead of forks in vitest config. * Update vitest config * Update vitest config * Split test profiles * Update vitest config * Silent logs for litesvm tests. * Update vitest config * Update service * Update test-program-integration service (node version) * Patch * Update service node version * Revert LiteSVM patch. Exclude LiteSVM tests from CI. * Update lint profile * Revert changeset check. Add changeset. * Fix typo
1 parent 94174ad commit e20268a

File tree

12 files changed

+210
-86
lines changed

12 files changed

+210
-86
lines changed

.changeset/silly-emus-open.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.github/workflows/checks.yml

Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -10,74 +10,28 @@ 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: Build all packages
18+
run: docker compose --profile build up --quiet-pull --abort-on-container-failure
2319

2420
test:
25-
if: false # temporarily disable test script
26-
runs-on: ubuntu-latest
21+
runs-on: blacksmith-8vcpu-ubuntu-2404
2722
steps:
2823
- name: Checkout repository
2924
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
25+
- name: Run tests
26+
run: docker compose --profile test up --quiet-pull --abort-on-container-failure
6727

6828
lint:
69-
runs-on: ubuntu-latest
29+
runs-on: blacksmith-8vcpu-ubuntu-2404
7030
steps:
7131
- name: Checkout repository
7232
uses: actions/checkout@v5
73-
- name: Remove Unnecessary Files
74-
uses: ./.github/actions/cleanup
75-
- name: Setup Anchor
76-
uses: ./.github/actions/anchor
77-
- name: Install dependencies
78-
run: yarn install
79-
- name: Run Lint
80-
run: yarn lint --output-style static
33+
- name: Run lint
34+
run: docker compose --profile lint up --quiet-pull --abort-on-container-failure
8135

8236
verify-generated:
8337
runs-on: ubuntu-latest

docker-compose.yml

Lines changed: 176 additions & 10 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-whirlpools-program, 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, lint]
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: >
@@ -70,15 +74,16 @@ 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 --quiet --manifest-path rust-sdk/macros/Cargo.toml
83+
&& cargo build --quiet --manifest-path rust-sdk/core/Cargo.toml
84+
&& cargo build --quiet --manifest-path rust-sdk/client/Cargo.toml
85+
&& cargo build --quiet --manifest-path rust-sdk/whirlpool/Cargo.toml
86+
&& cargo build --quiet --manifest-path rust-sdk/tx-sender/Cargo.toml
8287
&& cargo clippy --fix --allow-dirty --allow-staged
8388
&& cargo fmt"
8489
profiles: [build]
@@ -89,6 +94,7 @@ services:
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,163 @@ 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+
&& node --version
212+
&& corepack enable && corepack prepare [email protected] --activate
213+
&& yarn install
214+
&& yarn workspace @orca-so/common-sdk build
215+
&& yarn workspace @orca-so/whirlpools-sdk build
216+
&& yarn workspace @orca-so/whirlpools-sdk-integration test"
217+
profiles: [test-whirlpools-program]
218+
depends_on:
219+
build-solana-program:
220+
condition: service_completed_successfully
221+
volumes:
222+
- ./:/usr/src/whirlpools
223+
- node_modules:/usr/src/whirlpools/node_modules
224+
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
225+
226+
test-ts-sdk:
227+
platform: linux/amd64
228+
image: rust:1.84.0
229+
working_dir: /usr/src/whirlpools
230+
command: >
231+
sh -c "curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
232+
&& apt-get update && apt-get install -y nodejs
233+
&& corepack enable && corepack prepare [email protected] --activate
234+
&& yarn workspace @orca-so/whirlpools-client test
235+
&& yarn workspace @orca-so/whirlpools-core test
236+
&& yarn workspace @orca-so/tx-sender test
237+
&& yarn workspace @orca-so/whirlpools test"
238+
profiles: [test]
239+
depends_on:
240+
build-solana-program:
241+
condition: service_completed_successfully
242+
yarn-install:
243+
condition: service_completed_successfully
244+
build-ts-sdk:
245+
condition: service_completed_successfully
246+
volumes:
247+
- ./:/usr/src/whirlpools
248+
- node_modules:/usr/src/whirlpools/node_modules
249+
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
250+
251+
test-rust-sdk:
252+
platform: linux/amd64
253+
image: rust:1.84.0
254+
working_dir: /usr/src/whirlpools
255+
command: >
256+
sh -c "cp legacy-sdk/whirlpool/tests/external_program/token_2022.20250510.so target/deploy/
257+
&& cargo test --quiet --manifest-path rust-sdk/macros/Cargo.toml --lib
258+
&& cargo test --quiet --manifest-path rust-sdk/core/Cargo.toml --lib
259+
&& cargo test --quiet --manifest-path rust-sdk/client/Cargo.toml --lib
260+
&& cargo test --quiet --manifest-path rust-sdk/whirlpool/Cargo.toml --lib
261+
&& cargo test --quiet --manifest-path rust-sdk/tx-sender/Cargo.toml --lib"
262+
profiles: [test]
263+
depends_on:
264+
build-solana-program:
265+
condition: service_completed_successfully
266+
volumes:
267+
- ./:/usr/src/whirlpools
268+
269+
test-integration:
270+
image: rust:1.84.0
271+
working_dir: /usr/src/whirlpools
272+
command: >
273+
sh -c "curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
274+
&& apt-get update && apt-get install -y nodejs
275+
&& corepack enable && corepack prepare [email protected] --activate
276+
&& yarn workspace @orca-so/whirlpools-integration test
277+
&& yarn workspace @orca-so/whirlpools-rust-integration test"
278+
profiles: [test-integration]
279+
depends_on:
280+
build-rust-sdk:
281+
condition: service_completed_successfully
282+
build-ts-sdk:
283+
condition: service_completed_successfully
284+
build-integration:
285+
condition: service_completed_successfully
286+
volumes:
287+
- ./:/usr/src/whirlpools
288+
- node_modules:/usr/src/whirlpools/node_modules:ro
289+
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
290+
291+
test-whirlpools-program:
292+
platform: linux/amd64
293+
image: alpine:3
294+
working_dir: /usr/src/whirlpools
295+
command: >
296+
echo "Tests Completed"
297+
profiles: [test-whirlpools-program]
298+
depends_on:
299+
test-program:
300+
condition: service_completed_successfully
301+
test-program-integration:
302+
condition: service_completed_successfully
303+
volumes:
304+
- ./:/usr/src/whirlpools
305+
306+
test-sdks:
307+
platform: linux/amd64
308+
image: alpine:3
309+
working_dir: /usr/src/whirlpools
310+
command: >
311+
echo "Tests Completed"
312+
depends_on:
313+
test-ts-sdk:
314+
condition: service_completed_successfully
315+
test-rust-sdk:
316+
condition: service_completed_successfully
317+
profiles: [test]
318+
volumes:
319+
- ./:/usr/src/whirlpools
320+
321+
lint:
322+
platform: linux/amd64
323+
image: rust:1.84.0
324+
working_dir: /usr/src/whirlpools
325+
command: >
326+
sh -c "curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
327+
&& apt-get update && apt-get install -y nodejs
328+
&& corepack enable && corepack prepare [email protected] --activate
329+
&& rustup component add clippy rustfmt
330+
&& yarn workspace @orca-so/whirlpools-lint lint
331+
&& cargo clippy -p whirlpool && cargo fmt --check -p whirlpool
332+
&& cargo clippy --manifest-path rust-sdk/macros/Cargo.toml && cargo fmt --check --manifest-path rust-sdk/macros/Cargo.toml
333+
&& cargo clippy --manifest-path rust-sdk/core/Cargo.toml && cargo fmt --check --manifest-path rust-sdk/core/Cargo.toml
334+
&& cargo clippy --manifest-path rust-sdk/client/Cargo.toml && cargo fmt --check --manifest-path rust-sdk/client/Cargo.toml
335+
&& cargo clippy --manifest-path rust-sdk/whirlpool/Cargo.toml && cargo fmt --check --manifest-path rust-sdk/whirlpool/Cargo.toml
336+
&& cargo clippy --manifest-path rust-sdk/tx-sender/Cargo.toml && cargo fmt --check --manifest-path rust-sdk/tx-sender/Cargo.toml
337+
&& cargo clippy --manifest-path examples/rust-sdk/whirlpool_repositioning_bot/Cargo.toml && cargo fmt --check --manifest-path examples/rust-sdk/whirlpool_repositioning_bot/Cargo.toml"
338+
profiles: [lint]
339+
depends_on:
340+
yarn-install:
341+
condition: service_completed_successfully
342+
volumes:
343+
- ./:/usr/src/whirlpools
344+
- node_modules:/usr/src/whirlpools/node_modules:ro
345+
- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro
346+
181347
volumes:
182348
node_modules:
183349
yarn_cache:

legacy-sdk/whirlpool/vitest.config.mts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,8 @@ import { defineConfig } from "vitest/config";
33
export default defineConfig({
44
test: {
55
globals: true,
6-
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,
6+
pool: "threads",
7+
environment: "node",
8+
silent: true,
239
},
2410
});

0 commit comments

Comments
 (0)