forked from near/nearcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_nearlib.sh
executable file
·57 lines (44 loc) · 1.62 KB
/
test_nearlib.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -ex
./scripts/requirements_check.sh
repo_dir=$(realpath -e "$(dirname "${BASH_SOURCE[0]}")/..")
# Builds and starts `neard`, assumes it's running in ${repo_dir}'
# May fail silently, leading to hard to debug CI failures
# TODO: add option to build only and run checks, this will allow us to see those errors synchronously.
# TODO: This test leaves `near` process running even after the test is over
# pkill near || echo "Nothing to kill"
(cd "${repo_dir}"; RUST_BACKTRACE=full "${repo_dir}"/scripts/start_unittest.py --local) &
export NEAR_PID=$!
trap 'pkill -15 -P $NEAR_PID' 0
# "${repo_dir}"/scripts/build_wasm.sh
rm -rf "${repo_dir}"/near-api-js "${repo_dir}"/near-shell "${repo_dir}"/create-near-app
git clone https://github.com/near/near-api-js.git "${repo_dir}"/near-api-js
git clone https://github.com/near/near-shell.git "${repo_dir}"/near-shell
git clone https://github.com/near/create-near-app.git "${repo_dir}"/create-near-app
# Make sure to use local nearcore for tests
export NODE_ENV=local
export HOME="{$repo_dir}"/testdir
# Run near-api-js tests
pushd "${repo_dir}/near-api-js"
# TODO(CREATE ISSUE) We should add a new file with all requirement checks.
if [[ $(yarn --version) != "1."* ]]; then
echo "You version of yarn is too old $(yarn --version) < 1.0"
echo "Install with npm install --global yarn"
exit 1
fi
yarn
yarn build
yarn list
popd
"${repo_dir}"/scripts/waitonserver.sh
# TODO(#5757) Disabling yarn test for now
# yarn test
# yarn doc
# Run create-near-app tests
# cd ../create-near-app
# yarn
# yarn test
# Run near-shell tests
# cd ../near-shell
# yarn
# HOME=../testdir yarn test