Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test work! #1288

Merged
merged 5 commits into from
May 12, 2015
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
/bower_components
/dist
/tooling/node_modules
1 change: 1 addition & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"function",
"typeof"
],
"excludeFiles": ["**/node_modules/**", "**/bower_components/**"],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ before_script:
script:
# We want to gate on passing tests and a successful build
- gulp
- ./travis-runner.sh
- ./test-runner.sh
19 changes: 13 additions & 6 deletions travis-runner.sh → test-runner.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/bash
set -o pipefail


get_changes ()
{
git remote add current https://github.com/tastejs/todomvc.git && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this file use 2 spaces indentation?

git fetch --quiet current && \
git diff HEAD origin/master --name-only | awk 'BEGIN {FS = "/"}; {print $1 "/" $2 "/" $3}' | uniq | grep -v \/\/ | grep examples | awk -F '[/]' '{print "--framework=" $2}'
}

if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]
then
git submodule add -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} site > /dev/null 2>&1
Expand All @@ -16,17 +24,16 @@ then
# 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
git remote add current https://github.com/tastejs/todomvc.git && \
git fetch current && \
cd browser-tests/ && \
npm i && \
changes=$(git diff HEAD origin/master --name-only | awk 'BEGIN {FS = "/"}; {print $1 "/" $2 "/" $3}' | uniq | grep -v \/\/ | grep examples | awk -F '[/]' '{print "--framework=" $2}')
changes=$(get_changes)

if [ "${#changes}" = 0 ]
then
exit 0
else
echo changes | xargs npm run test --
cd tooling && \
echo $changes | xargs ./run.sh && \
cd ../tests && \
echo $changes | xargs ./run.sh
fi

exit $?
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions tests/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

args="$@"

run_tests ()
{
npm i && \
eval "npm test -- $args"
}

if [ "$TRAVIS_PULL_REQUEST" == "true" ] && [ "$TRAVIS_SECURE_ENV_VARS" == "true" ]
then
run_tests
elif [ "$TRAVIS_PULL_REQUEST" == "true" ] && [ "$TRAVIS_SECURE_ENV_VARS" == "false" ]
then
exit 0
else
run_tests
fi
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions tooling/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"private": true,
"scripts": {
"lint": "jscs"
},
"dependencies": {
"jscs": "^1.13.1"
}
}
16 changes: 16 additions & 0 deletions tooling/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

PATHS=""
EXAMPLES_DIR="../examples/"

for arg in "$@"
do
case $arg in
--framework=*)
PATHS+=" "$EXAMPLES_DIR$(echo $arg | awk '{split($0,a,"="); print a[2]}')
;;
esac
done

npm i && \
eval "npm run lint -- -c ../.jscsrc $PATHS"