Skip to content

Commit

Permalink
Add basic npm tests for travis (qmk#154)
Browse files Browse the repository at this point in the history
* Add basic npm tests for travis

 - run eslint
 - run less to validate css file
 - edit travis to use a javascript environment

* Only run gh-pages flow on a merge

 Ignore it for pull requests
  • Loading branch information
yanfali authored Jun 18, 2018
1 parent 075bccf commit ee789f0
Show file tree
Hide file tree
Showing 6 changed files with 1,413 additions and 5 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stable
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
language: generic # don't install any environment
language: node_js
node_js:
- "node"
before_script:
- npm install --dev
script: bash ./deploy.sh
branches:
only:
Expand Down
5 changes: 4 additions & 1 deletion assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ $(document).ready(() => {
}).$mount('#controller-app');

ignoreKeypressListener($('input[type=text]'));
return;
return {
vueStatus,
vueInstance,
};

////////////////////////////////////////
//
Expand Down
9 changes: 8 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/bash
set -e # exit with nonzero exit code if anything fails

npm test

if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
# Exit if we're running a pull request
exit 0;
fi

rm -rf .git
git init
git remote add origin https://github.com/${TRAVIS_REPO_SLUG}
Expand All @@ -22,4 +29,4 @@ git commit -m "Deploy to GitHub Pages"
# repo's gh-pages branch. (All previous history on the gh-pages branch
# will be lost, since we are overwriting it.) We redirect any output to
# /dev/null to hide any sensitive credential data that might otherwise be exposed.
git push --force --quiet "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}" master:gh-pages > /dev/null 2>&1
git push --force --quiet "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}" master:gh-pages > /dev/null 2>&1
Loading

0 comments on commit ee789f0

Please sign in to comment.