diff --git a/.travis.yml b/.travis.yml index a77695e496d8..0ac194e116ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,11 @@ os: - linux - osx -script: ./bin/travis.sh +script: + - npm run postinstall + - npm run build + - npm run test:ci + env: TASK=test install: npm install --ignore-scripts @@ -21,12 +25,18 @@ matrix: - node_js: "8" os: linux env: TASK=code-lint + # Running Code Linter -- Requires @loopback/build so it's bootstrapped + script: + - lerna bootstrap --scope @loopback/build --scope @loopback/tslint-config + - npm run lint - node_js: "8" os: linux env: TASK=commit-lint + script: commitlint-travis - node_js: "8" os: linux env: TASK=verify-docs + script: ./bin/verify-doc-changes.sh branches: only: diff --git a/bin/travis.sh b/bin/travis.sh deleted file mode 100755 index 21c7da01fb0a..000000000000 --- a/bin/travis.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -set -e - -# Running Code Linter -- Requires @loopback/build so it's bootstrapped -if [ $TASK = "code-lint" ]; then - echo "TASK => LINTING CODE" - lerna bootstrap --scope @loopback/build --scope @loopback/tslint-config - npm run lint - -# Commit Message Linter -elif [ $TASK = "commit-lint" ]; then - echo "TASK => COMMIT MESSAGE LINTING" - commitlint-travis - -# Test LoopBack.io will build if changes made to @loopback/docs -elif [ $TASK = "verify-docs" ]; then - echo "TASK => VERIFY DOCS" - if git diff --name-only --quiet $TRAVIS_BRANCH docs/; then - echo "No changes to @loopback/docs in this PR" - exit 0 - else - echo "Testing @loopback/docs" - npm run verify:docs - fi - -# Mocha Tests -else - echo "TASK => MOCHA TESTS" - npm run postinstall - npm run test:ci -fi diff --git a/bin/verify-doc-changes.sh b/bin/verify-doc-changes.sh new file mode 100755 index 000000000000..6c47504c72e2 --- /dev/null +++ b/bin/verify-doc-changes.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +# Test LoopBack.io will build if changes made to @loopback/docs +echo "TASK => VERIFY DOCS" +if git diff --name-only --quiet $TRAVIS_BRANCH docs/; then + echo "No changes to @loopback/docs in this PR" + exit 0 +else + echo "Testing @loopback/docs" + npm run verify:docs +fi diff --git a/package.json b/package.json index dca7705cd2ad..b12aada2bf50 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ "build:full": "npm run clean:lerna && npm install && npm run clean && npm run build", "pretest": "npm run clean && npm run build", "test": "node packages/build/bin/run-nyc npm run mocha --scripts-prepend-node-path", - "pretest:ci": "npm run build", "test:ci": "node packages/build/bin/run-nyc npm run mocha --scripts-prepend-node-path", "verify:docs": "npm run build:site -- --verify", "build:site": "./bin/build-docs-site.sh",