Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 93ec6cf

Browse files
authored
token-cli: Split out CI into separate step, run tests in serial (#3425)
* token-cli: Split out CI into separate step, run tests in serial * Remove dependency on cargo-test-bpf to speed things up * Don't download programs since they won't be available
1 parent d7f352b commit 93ec6cf

File tree

3 files changed

+64
-23
lines changed

3 files changed

+64
-23
lines changed

.github/workflows/pull-request-token.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,44 @@ jobs:
139139
name: token-programs
140140
path: target/deploy
141141
- run: ./ci/js-test-token.sh
142+
143+
cargo-build-test-cli:
144+
runs-on: ubuntu-latest
145+
steps:
146+
- uses: actions/checkout@v2
147+
148+
- name: Set env vars
149+
run: |
150+
source ci/rust-version.sh
151+
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
152+
source ci/solana-version.sh
153+
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
154+
155+
- uses: actions-rs/toolchain@v1
156+
with:
157+
toolchain: ${{ env.RUST_STABLE }}
158+
override: true
159+
profile: minimal
160+
161+
- uses: actions/cache@v2
162+
with:
163+
path: |
164+
~/.cargo/registry
165+
~/.cargo/git
166+
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE }}
167+
168+
- uses: actions/cache@v2
169+
with:
170+
path: ~/.cache/solana
171+
key: solana-${{ env.SOLANA_VERSION }}
172+
173+
- name: Install dependencies
174+
run: |
175+
./ci/install-build-deps.sh
176+
./ci/install-program-deps.sh
177+
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
178+
179+
- name: Build and test
180+
run: |
181+
BUILD_DEPENDENT_PROGRAMS=1 cargo build --manifest-path ./token/cli/Cargo.toml
182+
cargo test --manifest-path ./token/cli/Cargo.toml

ci/cargo-build-test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ set -x
1515
make -C examples/c
1616

1717
# Build/test all host crates
18-
BUILD_DEPENDENT_PROGRAMS=1 cargo +"$rust_stable" build
19-
cargo +"$rust_stable" test -- --nocapture
18+
cargo +"$rust_stable" build --workspace --exclude spl-token-cli
19+
cargo +"$rust_stable" test --workspace --exclude spl-token-cli -- --nocapture
2020

2121
# Run test-client sanity check
2222
cargo +"$rust_stable" run --manifest-path=utils/test-client/Cargo.toml

token/cli/src/main.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,7 +3288,7 @@ async fn handle_tx<'a>(
32883288
mod tests {
32893289
use {
32903290
super::*,
3291-
serial_test::parallel,
3291+
serial_test::serial,
32923292
solana_sdk::{
32933293
bpf_loader,
32943294
signature::{write_keypair_file, Keypair, Signer},
@@ -3472,7 +3472,7 @@ mod tests {
34723472
}
34733473

34743474
#[tokio::test]
3475-
#[parallel(one)]
3475+
#[serial]
34763476
async fn create_token_default() {
34773477
let (test_validator, payer) = new_validator_for_test().await;
34783478
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3492,7 +3492,7 @@ mod tests {
34923492
}
34933493

34943494
#[tokio::test]
3495-
#[parallel(two)]
3495+
#[serial]
34963496
async fn supply() {
34973497
let (test_validator, payer) = new_validator_for_test().await;
34983498
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3511,7 +3511,7 @@ mod tests {
35113511
}
35123512

35133513
#[tokio::test]
3514-
#[parallel(three)]
3514+
#[serial]
35153515
async fn create_account_default() {
35163516
let (test_validator, payer) = new_validator_for_test().await;
35173517
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3532,7 +3532,7 @@ mod tests {
35323532
}
35333533

35343534
#[tokio::test]
3535-
#[parallel(four)]
3535+
#[serial]
35363536
async fn account_info() {
35373537
let (test_validator, payer) = new_validator_for_test().await;
35383538
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3565,7 +3565,7 @@ mod tests {
35653565
}
35663566

35673567
#[tokio::test]
3568-
#[parallel(one)]
3568+
#[serial]
35693569
async fn balance() {
35703570
let (test_validator, payer) = new_validator_for_test().await;
35713571
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3585,7 +3585,7 @@ mod tests {
35853585
}
35863586

35873587
#[tokio::test]
3588-
#[parallel(two)]
3588+
#[serial]
35893589
async fn mint() {
35903590
let (test_validator, payer) = new_validator_for_test().await;
35913591
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3613,7 +3613,7 @@ mod tests {
36133613
}
36143614

36153615
#[tokio::test]
3616-
#[parallel(three)]
3616+
#[serial]
36173617
async fn balance_after_mint() {
36183618
let (test_validator, payer) = new_validator_for_test().await;
36193619
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3635,7 +3635,7 @@ mod tests {
36353635
}
36363636

36373637
#[tokio::test]
3638-
#[parallel(four)]
3638+
#[serial]
36393639
async fn accounts() {
36403640
let (test_validator, payer) = new_validator_for_test().await;
36413641
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3659,7 +3659,7 @@ mod tests {
36593659
}
36603660

36613661
#[tokio::test]
3662-
#[parallel(one)]
3662+
#[serial]
36633663
async fn wrap() {
36643664
let (test_validator, payer) = new_validator_for_test().await;
36653665
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3687,7 +3687,7 @@ mod tests {
36873687
}
36883688

36893689
#[tokio::test]
3690-
#[parallel(two)]
3690+
#[serial]
36913691
async fn unwrap() {
36923692
let (test_validator, payer) = new_validator_for_test().await;
36933693
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3714,7 +3714,7 @@ mod tests {
37143714
}
37153715

37163716
#[tokio::test]
3717-
#[parallel(three)]
3717+
#[serial]
37183718
async fn transfer() {
37193719
let (test_validator, payer) = new_validator_for_test().await;
37203720
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3748,7 +3748,7 @@ mod tests {
37483748
}
37493749

37503750
#[tokio::test]
3751-
#[parallel(four)]
3751+
#[serial]
37523752
async fn transfer_fund_recipient() {
37533753
let (test_validator, payer) = new_validator_for_test().await;
37543754
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3781,7 +3781,7 @@ mod tests {
37813781
}
37823782

37833783
#[tokio::test]
3784-
#[parallel(one)]
3784+
#[serial]
37853785
async fn failing_to_allow_non_system_account_recipient() {
37863786
let (test_validator, payer) = new_validator_for_test().await;
37873787
let config = test_config(&test_validator, &payer, &spl_token::id());
@@ -3808,7 +3808,7 @@ mod tests {
38083808
}
38093809

38103810
#[tokio::test]
3811-
#[parallel(two)]
3811+
#[serial]
38123812
async fn allow_non_system_account_recipient() {
38133813
let (test_validator, payer) = new_validator_for_test().await;
38143814
let config = test_config(&test_validator, &payer, &spl_token::id());
@@ -3845,7 +3845,7 @@ mod tests {
38453845
}
38463846

38473847
#[tokio::test]
3848-
#[parallel(three)]
3848+
#[serial]
38493849
async fn close_wrapped_sol_account() {
38503850
let (test_validator, payer) = new_validator_for_test().await;
38513851
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3892,7 +3892,7 @@ mod tests {
38923892
}
38933893

38943894
#[tokio::test]
3895-
#[parallel(four)]
3895+
#[serial]
38963896
async fn disable_mint_authority() {
38973897
let (test_validator, payer) = new_validator_for_test().await;
38983898
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3919,7 +3919,7 @@ mod tests {
39193919
}
39203920

39213921
#[tokio::test]
3922-
#[parallel(one)]
3922+
#[serial]
39233923
async fn gc() {
39243924
let (test_validator, payer) = new_validator_for_test().await;
39253925
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3965,7 +3965,7 @@ mod tests {
39653965
}
39663966

39673967
#[tokio::test]
3968-
#[parallel(two)]
3968+
#[serial]
39693969
async fn set_owner() {
39703970
let (test_validator, payer) = new_validator_for_test().await;
39713971
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -3994,7 +3994,7 @@ mod tests {
39943994
}
39953995

39963996
#[tokio::test]
3997-
#[parallel(three)]
3997+
#[serial]
39983998
async fn transfer_with_account_delegate() {
39993999
let (test_validator, payer) = new_validator_for_test().await;
40004000
for program_id in [spl_token::id(), spl_token_2022::id()] {
@@ -4089,7 +4089,7 @@ mod tests {
40894089
}
40904090

40914091
#[tokio::test]
4092-
#[parallel(four)]
4092+
#[serial]
40934093
async fn burn_with_account_delegate() {
40944094
let (test_validator, payer) = new_validator_for_test().await;
40954095
for program_id in [spl_token::id(), spl_token_2022::id()] {

0 commit comments

Comments
 (0)