forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·54 lines (44 loc) · 1.28 KB
/
build.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
#!/bin/bash
set -euo pipefail
bail="--bail"
while [[ "${1:-}" != "" ]]; do
case $1 in
-h|--help)
echo "Usage: build.sh [--no-bail] [--force|-f]"
exit 1
;;
--no-bail)
bail="--no-bail"
;;
-f|--force)
export CDK_BUILD="--force"
;;
*)
echo "Unrecognized parameter: $1"
exit 1
;;
esac
shift
done
if [ ! -d node_modules ]; then
/bin/bash ./install.sh
fi
fail() {
echo "❌ Last command failed. Scroll up to see errors in log (search for '!!!!!!!!')."
exit 1
}
/bin/bash ./git-secrets-scan.sh
BUILD_INDICATOR=".BUILD_COMPLETED"
rm -rf $BUILD_INDICATOR
export PATH=node_modules/.bin:$PATH
# Speed up build by reusing calculated tree hashes
# On dev machine, this speeds up the TypeScript part of the build by ~30%.
export MERKLE_BUILD_CACHE=$(mktemp -d)
trap "rm -rf $MERKLE_BUILD_CACHE" EXIT
echo "============================================================================================="
echo "building..."
time lerna run $bail --stream build || fail
echo "============================================================================================="
echo "testing..."
lerna run $bail --stream test || fail
touch $BUILD_INDICATOR