Add tarvis staging

This commit is contained in:
Crawl
2017-05-13 18:42:15 +02:00
parent b0d4b53d6b
commit eab5c9e7f1
3 changed files with 61 additions and 29 deletions

View File

@@ -1,16 +1,20 @@
language: node_js
node_js:
- "6"
- "7"
cache:
directories:
- node_modules
install: npm install
script:
- bash ./deploy/deploy.sh
env:
global:
- ENCRYPTION_LABEL: "af862fa96d3e"
- COMMIT_AUTHOR_EMAIL: "amishshah.2k@gmail.com"
dist: trusty
sudo: false
language: node_js
node_js:
- "6"
- "7"
cache:
directories:
- node_modules
install: npm install
jobs:
include:
- stage: test
script: bash ./deploy/test.sh
- stage: build
script: bash ./deploy/deploy.sh
env:
global:
- ENCRYPTION_LABEL: "af862fa96d3e"
- COMMIT_AUTHOR_EMAIL: "amishshah.2k@gmail.com"
dist: trusty
sudo: false

View File

@@ -3,13 +3,6 @@
set -e
function tests {
npm run lint
npm run docs:test
VERSIONED=false npm run webpack
exit 0
}
function build {
npm run lint
npm run docs
@@ -22,10 +15,10 @@ if [[ "$TRAVIS_BRANCH" == revert-* ]]; then
exit 0
fi
# For PRs, only run tests
# For PRs, do nothing
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "\e[36m\e[1mBuild triggered for PR #${TRAVIS_PULL_REQUEST} to branch \"${TRAVIS_BRANCH}\" - only running tests."
tests
echo -e "\e[36m\e[1mBuild triggered for PR #${TRAVIS_PULL_REQUEST} to branch \"${TRAVIS_BRANCH}\" - doing nothing."
exit 0
fi
# Figure out the source of the build
@@ -39,10 +32,10 @@ else
SOURCE_TYPE="branch"
fi
# For Node != 6, only run tests
# For Node != 6, do nothing
if [ "$TRAVIS_NODE_VERSION" != "6" ]; then
echo -e "\e[36m\e[1mBuild triggered with Node v${TRAVIS_NODE_VERSION} - only running tests."
tests
echo -e "\e[36m\e[1mBuild triggered with Node v${TRAVIS_NODE_VERSION} - doing nothing."
exit 0
fi
build

35
deploy/test.sh Normal file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
set -e
function tests {
npm run lint
npm run docs:test
VERSIONED=false npm run webpack
exit 0
}
# For revert branches, do nothing
if [[ "$TRAVIS_BRANCH" == revert-* ]]; then
echo -e "\e[36m\e[1mTest triggered for reversion branch \"${TRAVIS_BRANCH}\" - doing nothing."
exit 0
fi
# For PRs
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "\e[36m\e[1mTest triggered for PR #${TRAVIS_PULL_REQUEST} to branch \"${TRAVIS_BRANCH}\" - only running tests."
tests
fi
# Figure out the source of the test
if [ -n "$TRAVIS_TAG" ]; then
echo -e "\e[36m\e[1mTest triggered for tag \"${TRAVIS_TAG}\"."
else
echo -e "\e[36m\e[1mTest triggered for branch \"${TRAVIS_BRANCH}\"."
fi
# For Node != 6
if [ "$TRAVIS_NODE_VERSION" != "6" ]; then
echo -e "\e[36m\e[1mTest triggered with Node v${TRAVIS_NODE_VERSION} - only running tests."
tests
fi