forked from tradingview/lightweight-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-graphics-tests.sh
executable file
·43 lines (33 loc) · 957 Bytes
/
run-graphics-tests.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
#!/bin/bash
set -e
if [ "$CMP_OUT_DIR" = "" ]; then
echo "Env variable CMP_OUT_DIR must be set"
exit 1
fi
echo "Checkout to merge-base and build..."
BUILD_SCRIPT="build"
TEST_FILE_MODE="development"
if [ "$PRODUCTION_BUILD" = "true" ]; then
BUILD_SCRIPT="build:prod"
TEST_FILE_MODE="production"
fi
HEAD_SHA1=$(git rev-parse HEAD)
git checkout $(git merge-base origin/master HEAD)
npm install
npm run $BUILD_SCRIPT
mv ./dist ./merge-base-dist
echo "Checkout to HEAD back and build..."
git checkout $HEAD_SHA1
npm install
npm run $BUILD_SCRIPT
echo "Graphics tests"
set +e
node ./tests/e2e/graphics/runner.js ./merge-base-dist/lightweight-charts.standalone.$TEST_FILE_MODE.js ./dist/lightweight-charts.standalone.$TEST_FILE_MODE.js
EXIT_CODE=$?
set -e
if [ $EXIT_CODE != 0 ]; then
echo "Generate archive with screenshots"
tar -czvf ./screenshots.tar.gz $CMP_OUT_DIR
mv ./screenshots.tar.gz $CMP_OUT_DIR/screenshots.tar.gz
exit $EXIT_CODE
fi