-
Notifications
You must be signed in to change notification settings - Fork 42
/
ci.sh
executable file
·61 lines (52 loc) · 1.46 KB
/
ci.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
#!/usr/bin/env bash
set -eu
set -o pipefail
node --version
PUBLISH_BINARIES=false;
REPUBLISH_BINARIES=false;
SKIP_TESTS=false;
if [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]]; then
PUBLISH_BINARIES=true;
fi;
if [[ ${COMMIT_MESSAGE} =~ "[republish binary]" ]]; then
REPUBLISH_BINARIES=true;
fi;
if [[ ${COMMIT_MESSAGE} =~ "[skip tests]" ]]; then
SKIP_TESTS=true;
fi;
function publish() {
echo "### Publish ###"
if [[ $PUBLISH_BINARIES == true ]]; then
npx node-pre-gyp package testpackage;
npx node-pre-gyp publish;
npx node-pre-gyp info;
elif [[ $REPUBLISH_BINARIES == true ]]; then
npx node-pre-gyp package testpackage;
npx node-pre-gyp unpublish;
npx node-pre-gyp publish;
npx node-pre-gyp info;
fi;
}
function npm_test() {
if [[ $SKIP_TESTS == true ]]; then
return;
fi;
echo "### Running tests ###";
if [[ $(uname -s) == 'Darwin' ]]; then
export GST_PLUGIN_SYSTEM_PATH=/usr/local/lib/gstreamer-1.0;
npx mocha \
--skip=callback \
--skip=error \
tests/__run__.js
else
xvfb-run -a npm test -- --skip=callback;
fi;
}
# test installing from source
if [[ $PUBLISH_BINARIES == false ]] && [[ $REPUBLISH_BINARIES == false ]]; then
npm_test
else
echo "### Building binaries for publishing ###"
npm_test
publish
fi