2020-08-08 12:22:42 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-08-13 22:33:39 -07:00
|
|
|
set -e
|
|
|
|
|
2020-08-08 12:22:42 -07:00
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
|
|
|
_() {
|
2020-08-14 11:14:03 -07:00
|
|
|
echo "travis_fold:start:_"
|
|
|
|
SECONDS=
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
"$@"
|
|
|
|
) || exit 1
|
|
|
|
echo "travis_fold:end:_"
|
|
|
|
declare elapsed_seconds=$SECONDS
|
|
|
|
|
|
|
|
# TODO: Use "travis_time" annotations instead of this fold hack:
|
|
|
|
echo "travis_fold:start:${elapsed_seconds}s"
|
|
|
|
echo "travis_fold:end:${elapsed_seconds}s"
|
2020-08-08 12:22:42 -07:00
|
|
|
}
|
|
|
|
|
2020-08-13 22:33:39 -07:00
|
|
|
export RUSTFLAGS="-D warnings"
|
|
|
|
export RUSTBACKTRACE=1
|
|
|
|
|
2020-08-14 11:14:03 -07:00
|
|
|
_ cargo fmt --all -- --check
|
|
|
|
_ cargo +nightly clippy --workspace --all-targets -- --deny=warnings
|
2020-08-13 22:33:39 -07:00
|
|
|
|
|
|
|
|
2020-08-14 11:14:03 -07:00
|
|
|
# Build client libraries
|
2020-08-27 21:12:19 -07:00
|
|
|
_ cargo build
|
|
|
|
_ cargo run --manifest-path=utils/test-client/Cargo.toml
|
|
|
|
|
2020-08-13 22:33:39 -07:00
|
|
|
|
2020-08-28 16:01:09 -07:00
|
|
|
# # Check generated C headers
|
|
|
|
# _ cargo run --manifest-path=utils/cgen/Cargo.toml
|
|
|
|
#
|
|
|
|
# _ git diff --exit-code token/program/inc/token.h
|
|
|
|
# _ cc token/program/inc/token.h -o target/token.gch
|
|
|
|
# _ git diff --exit-code token-swap/program/inc/token-swap.h
|
|
|
|
# _ cc token-swap/program/inc/token-swap.h -o target/token-swap.gch
|
2020-08-13 22:33:39 -07:00
|
|
|
|
|
|
|
|
2020-08-14 11:14:03 -07:00
|
|
|
# Run clippy for all program crates, with the `program` feature enabled
|
|
|
|
for Xargo_toml in $(git ls-files -- '*/Xargo.toml'); do
|
|
|
|
program_dir=$(dirname "$Xargo_toml")
|
|
|
|
(
|
2020-08-13 22:33:39 -07:00
|
|
|
|
2020-08-14 11:14:03 -07:00
|
|
|
cd $program_dir
|
|
|
|
_ cargo +nightly clippy --features=program -- --deny=warnings
|
|
|
|
)
|
|
|
|
|
|
|
|
_ ./do.sh build "$program_dir"
|
|
|
|
|
|
|
|
if [[ $program_dir =~ token-swap/* ]]; then
|
|
|
|
# TODO: Remove once "Undefined symbols for architecture x86_64: _sol_create_program_address" is resolved
|
|
|
|
_ echo "SKIPPED token-swap test due to: Undefined symbols for architecture x86_64: _sol_create_program_address"
|
|
|
|
else
|
|
|
|
_ ./do.sh test "$program_dir"
|
|
|
|
fi
|
|
|
|
done
|
2020-08-13 22:33:39 -07:00
|
|
|
|
2020-09-01 17:27:11 -07:00
|
|
|
# Run SPL Token's performance monitor
|
|
|
|
cargo test --manifest-path=token/perf-monitor/Cargo.toml -- --nocapture
|
|
|
|
|
2020-08-13 22:33:39 -07:00
|
|
|
|
|
|
|
# Test token js bindings
|
2020-08-14 11:14:03 -07:00
|
|
|
js_token() {
|
2020-08-24 10:18:38 -07:00
|
|
|
cd token/js
|
|
|
|
time npm install || exit $?
|
|
|
|
time npm run lint || exit $?
|
|
|
|
time npm run flow || exit $?
|
|
|
|
tsc module.d.ts || exit $?
|
|
|
|
|
2020-08-29 23:31:58 -07:00
|
|
|
npm run cluster:localnet || exit $?
|
|
|
|
npm run localnet:down
|
|
|
|
npm run localnet:update || exit $?
|
|
|
|
npm run localnet:up || exit $?
|
|
|
|
time npm run start || exit $?
|
2020-09-03 19:21:52 -07:00
|
|
|
time PROGRAM_VERSION=2.0.4 npm run start || exit $?
|
2020-08-29 23:31:58 -07:00
|
|
|
npm run localnet:down
|
2020-08-14 11:14:03 -07:00
|
|
|
}
|
|
|
|
_ js_token
|
2020-08-13 22:33:39 -07:00
|
|
|
|
|
|
|
# Test token-swap js bindings
|
2020-08-14 11:14:03 -07:00
|
|
|
js_token_swap() {
|
2020-08-24 10:18:38 -07:00
|
|
|
cd token-swap/js
|
|
|
|
time npm install || exit $?
|
|
|
|
time npm run lint || exit $?
|
2020-08-28 16:16:24 -07:00
|
|
|
|
|
|
|
# TODO: Restore flow
|
|
|
|
# time npm run flow || exit $?
|
2020-08-24 10:18:38 -07:00
|
|
|
|
|
|
|
# TODO: Uncomment once https://github.com/solana-labs/solana/issues/11465 is resolved
|
|
|
|
# npm run cluster:localnet || exit $?
|
|
|
|
# npm run localnet:down
|
|
|
|
# npm run localnet:update || exit $?
|
|
|
|
# npm run localnet:up || exit $?
|
|
|
|
# npm run start || exit $?
|
|
|
|
# npm run localnet:down
|
2020-08-14 11:14:03 -07:00
|
|
|
}
|
|
|
|
_ js_token_swap
|
2020-08-08 12:22:42 -07:00
|
|
|
|
|
|
|
exit 0
|