Skip to content

Commit

Permalink
token-cli: Split out CI into separate step, run tests in serial (#3425)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
joncinque committed Aug 3, 2022
1 parent d7f352b commit 93ec6cf
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 23 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/pull-request-token.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,44 @@ jobs:
name: token-programs
path: target/deploy
- run: ./ci/js-test-token.sh

cargo-build-test-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE }}

- uses: actions/cache@v2
with:
path: ~/.cache/solana
key: solana-${{ env.SOLANA_VERSION }}

- name: Install dependencies
run: |
./ci/install-build-deps.sh
./ci/install-program-deps.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Build and test
run: |
BUILD_DEPENDENT_PROGRAMS=1 cargo build --manifest-path ./token/cli/Cargo.toml
cargo test --manifest-path ./token/cli/Cargo.toml
4 changes: 2 additions & 2 deletions ci/cargo-build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ set -x
make -C examples/c

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

# Run test-client sanity check
cargo +"$rust_stable" run --manifest-path=utils/test-client/Cargo.toml
Expand Down
42 changes: 21 additions & 21 deletions token/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3288,7 +3288,7 @@ async fn handle_tx<'a>(
mod tests {
use {
super::*,
serial_test::parallel,
serial_test::serial,
solana_sdk::{
bpf_loader,
signature::{write_keypair_file, Keypair, Signer},
Expand Down Expand Up @@ -3472,7 +3472,7 @@ mod tests {
}

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

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

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

#[tokio::test]
#[parallel(four)]
#[serial]
async fn account_info() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down Expand Up @@ -3565,7 +3565,7 @@ mod tests {
}

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

#[tokio::test]
#[parallel(two)]
#[serial]
async fn mint() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down Expand Up @@ -3613,7 +3613,7 @@ mod tests {
}

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

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

#[tokio::test]
#[parallel(one)]
#[serial]
async fn wrap() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down Expand Up @@ -3687,7 +3687,7 @@ mod tests {
}

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

#[tokio::test]
#[parallel(three)]
#[serial]
async fn transfer() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down Expand Up @@ -3748,7 +3748,7 @@ mod tests {
}

#[tokio::test]
#[parallel(four)]
#[serial]
async fn transfer_fund_recipient() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down Expand Up @@ -3781,7 +3781,7 @@ mod tests {
}

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

#[tokio::test]
#[parallel(two)]
#[serial]
async fn allow_non_system_account_recipient() {
let (test_validator, payer) = new_validator_for_test().await;
let config = test_config(&test_validator, &payer, &spl_token::id());
Expand Down Expand Up @@ -3845,7 +3845,7 @@ mod tests {
}

#[tokio::test]
#[parallel(three)]
#[serial]
async fn close_wrapped_sol_account() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down Expand Up @@ -3892,7 +3892,7 @@ mod tests {
}

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

#[tokio::test]
#[parallel(one)]
#[serial]
async fn gc() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down Expand Up @@ -3965,7 +3965,7 @@ mod tests {
}

#[tokio::test]
#[parallel(two)]
#[serial]
async fn set_owner() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down Expand Up @@ -3994,7 +3994,7 @@ mod tests {
}

#[tokio::test]
#[parallel(three)]
#[serial]
async fn transfer_with_account_delegate() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down Expand Up @@ -4089,7 +4089,7 @@ mod tests {
}

#[tokio::test]
#[parallel(four)]
#[serial]
async fn burn_with_account_delegate() {
let (test_validator, payer) = new_validator_for_test().await;
for program_id in [spl_token::id(), spl_token_2022::id()] {
Expand Down

0 comments on commit 93ec6cf

Please sign in to comment.