forked from fabric8-ui/fabric8-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcico_run_tests.sh
executable file
·76 lines (56 loc) · 1.65 KB
/
cico_run_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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
APP_DIR="packages/toolchain"
# Exit on error
set -e
# Export needed vars
set +x
eval "$(./env-toolkit load -f jenkins-env.json \
BUILD_NUMBER \
BUILD_URL \
JENKINS_URL \
GIT_BRANCH \
GH_TOKEN \
NPM_TOKEN \
GIT_COMMIT \
QUAY_USERNAME \
QUAY_PASSWORD \
DEVSHIFT_TAG_LEN)"
export BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M:%S`+00:00
# Show command before executing
set -x
# We need to disable selinux for now, XXX
/usr/sbin/setenforce 0
# Print date
date
# Get all the deps in
yum -y install docker make git
systemctl start docker
echo "Docker Started: $(date)"
REGISTRY="quay.io"
TAG="1.0.0"
BUILDER_IMAGE=${REGISTRY}/openshiftio/fabric8-ui-fabric8-ui-builder:${TAG}
# Build builder image
if [ -n "${QUAY_USERNAME}" -a -n "${QUAY_PASSWORD}" ]; then
docker login -u ${QUAY_USERNAME} -p ${QUAY_PASSWORD} ${REGISTRY}
else
echo "Could not login, missing credentials for the registry"
fi
mkdir -p dist
docker build -t fabric8-ui-builder -f Dockerfile.builder .
docker tag fabric8-ui-builder $BUILDER_IMAGE
docker run --detach=true --name=fabric8-ui-builder -t \
-v $(pwd)/dist:/dist:Z \
$BUILDER_IMAGE
echo "NPM Install starting: $(date)"
# Build fabric8-ui
docker exec fabric8-ui-builder npm install
echo "NPM Install Complete: $(date)"
docker exec fabric8-ui-builder npm run bootstrap
echo "Lerna Bootstrap Complete: $(date)"
## Exec unit tests
docker exec fabric8-ui-builder ./run_unit_tests.sh
echo 'CICO: unit tests OK'
./upload_to_codecov.sh
## All ok, build prod version
docker exec fabric8-ui-builder npm run build --prefix ${APP_DIR}
echo "Build Complete: $(date)"