This repository has been archived by the owner on Dec 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
citgm-check.sh
executable file
·73 lines (60 loc) · 2.08 KB
/
citgm-check.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
#! /bin/bash -e
############################################################################
#
# (C) Copyright IBM Corp. 2018
#
# This program and the accompanying materials are made available
# under the terms of the Apache License v2.0 which accompanies
# this distribution.
#
# The Apache License v2.0 is available at
# http://www.opensource.org/licenses/apache2.0.php
#
# Contributors:
# Multiple authors (IBM Corp.) - initial implementation and documentation
############################################################################
. ./setup-nvs.sh
#Cleanup npm log files
rm -rf /tmp/npm-*
### Use CitGM to run custom-citgm-test.js on a module. ###
echo -e "\n\nParameters:\n
WORKSPACE: $WORKSPACE\n
NODE_VERSION: $NODE_VERSION\n
OS: $OS\n
ARCH: $ARCH\n
MODULE: $MODULE\n
MODULE_VERSION: $MODULE_VERSION\n\n"
[ -z "$NODE_VERSION" ] && echo "NODE_VERSION is undefined, bailing..." && exit 1
[ -z "$MODULE_VERSION" ] && echo "MODULE_VERSION is undefined, bailing..." && exit 1
[ -z "$OS" ] && echo "OS is undefined, bailing..." && exit 1
[ -z "$ARCH" ] && echo "ARCH is undefined, bailing..." && exit 1
[ -z "$MODULE" ] && echo "MODULE is undefined, bailing..." && exit 1
[ -z "$CITGM_LOGLEVEL" ] && CITGM_LOGLEVEL=info
nvs add $NODE_VERSION >/dev/null
nvs use $NODE_VERSION >/dev/null
npm install -g citgm nyc
set +e
citgm --verbose "$CITGM_LOGLEVEL" \
--tap "$WORKSPACE/$MODULE.tap" \
--customTest "$WORKSPACE/custom-citgm-test.js" \
--lookup "$WORKSPACE/lookup.json" "$MODULE@$MODULE_VERSION"
EXIT_STATUS="$?"
if [ "$EXIT_STATUS" != "0" ]; then
citgm --verbose "$CITGM_LOGLEVEL" \
--tap "$WORKSPACE/$MODULE.tap" \
--lookup "$WORKSPACE/lookup.json" "$MODULE@$MODULE_VERSION"
EXIT_STATUS="$?"
fi
set -e
export EXIT_STATUS
nvs add 8 >/dev/null
nvs use 8 >/dev/null
npm install >/dev/null
export TOKEN=$(node fetch-token.js)
node "$WORKSPACE/update-test.js"
if [ $EXIT_STATUS -eq 1 ]; then
node storing-logs.js
fi
node logout.js
#Cleanup npm log files
rm -rf /tmp/npm-*