forked from tastejs/todomvc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-runner.sh
executable file
·44 lines (39 loc) · 1.25 KB
/
test-runner.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
#!/bin/bash
set -o pipefail
get_changes ()
{
git remote add current https://github.com/tastejs/todomvc.git && \
git fetch --quiet current && \
git diff HEAD origin/master --name-only | awk 'BEGIN {FS = "/"}; {print $1 "/" $2 "/" $3}' | grep -v \/\/ | grep examples | awk -F '[/]' '{print "--framework=" $2}'|uniq
}
npm i -g gulp
if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]
then
gulp
git submodule add -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} site > /dev/null 2>&1
cd site
if git checkout gh-pages; then git checkout -b gh-pages; fi
git rm -r .
cp -R ../dist/* .
cp ../dist/.* .
git add -f .
git config user.email '[email protected]'
git config user.name 'TasteBot'
git commit -am 'update the build files for gh-pages [ci skip]'
# Any command that using GH_OAUTH_TOKEN must pipe the output to /dev/null to not expose your oauth token
git push https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} HEAD:gh-pages > /dev/null 2>&1
else
changes=$(get_changes)
if [ "${#changes}" = 0 ]
then
exit 0
else
cd tooling && \
echo $changes | xargs ./run.sh && \
cd ../tests && \
(gulp test-server &) && \
sleep 2 && \
echo $changes | xargs ./run.sh
fi
exit $?
fi