Skip to content

Commit

Permalink
feat(ci): run tests and build with current, latest and beta ng version (
Browse files Browse the repository at this point in the history
  • Loading branch information
valorkin authored Sep 28, 2017
1 parent b7a4c4d commit 9e26b73
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 27 deletions.
106 changes: 82 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,96 @@
sudo: false
language: node_js
node_js: "8"
dist: precise

notifications:
email: false

git:
depth: 3
submodules: false

env:
global:
- SAUCE_USERNAME=valorkin
- SAUCE_ACCESS_KEY=aeaf806e-ad5c-484b-a8fe-4b4b9f54e99a

stages:
- name: precache
if: ( branch = development AND type = push ) OR type = pull_request
- name: lint
if: ( branch = development AND type = push ) OR type = pull_request
- name: test
if: ( branch = development AND type = push ) OR type = pull_request
- name: build
if: ( branch = development AND type = push ) OR type = pull_request
- name: deploy-surge
if: branch = development AND type = push

before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

script:
- npm run lint
- npm run build
- rm -rf node_modules/ngx-bootstrap
- npm i ./dist
- npm run demo.ng-build
# istanbul is broken, should be fixed
- npm run test-coverage

after_success:
- ./node_modules/.bin/codecov
#- npm run test-cross

addons:
# sauce labs tunel connector (read more https://docs.travis-ci.com/user/sauce-connect/ )
sauce_connect: true
firefox: "latest"
apt:
sources:
- ubuntu-toolchain-r-test
# required by node-gyp to build some packages
packages:
- g++-4.8

install:
- npm install > /dev/null
- npm run build > /dev/null
- if [[ "$NGV" == "latest" ]]; then ./scripts/ci/npm-ng-latest.sh; fi
- if [[ "$NGV" == "next" ]]; then ./scripts/ci/npm-ng-next.sh; fi
- npm i ./dist > /dev/null

jobs:
fast_finish: true
allow_failures:
- env: NGV=next
include:
# precache npm and apt dependencies
- stage: precache
install: npm install > /dev/null
script: true
addons:
# sauce labs tunel connector (read more https://docs.travis-ci.com/user/sauce-connect/ )
# sauce_connect: true
chrome: stable
apt:
sources:
- ubuntu-toolchain-r-test
# required by node-gyp to build some packages
packages:
- g++-4.8
# lint code
- stage: lint
install: true
script: npm run lint
# test
- &test
stage: test
script: npm run test-coverage
after_success:
- ./node_modules/.bin/codecov
- <<: *test
env: NGV=latest
- <<: *test
env: NGV=next
# check prod build
- &build
stage: build
script: npm run demo.ng-build
- <<: *build
env: NGV=latest
- <<: *build
env: NGV=next
# deploy to ngx-bootstrap.surge.sh
- stage: deploy-surge
script: npm run demo.build
deploy:
provider: surge
project: ./gh-pages/
domain: ngx-bootstrap.surge.sh
on: development

cache:
apt: true
npm: true
directories:
- node_modules
38 changes: 38 additions & 0 deletions .travis.yml-old
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
sudo: false
language: node_js
node_js: "8"
dist: precise

env:
global:
- SAUCE_USERNAME=valorkin
- SAUCE_ACCESS_KEY=aeaf806e-ad5c-484b-a8fe-4b4b9f54e99a

before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

script:
- npm run lint
- npm run build
- rm -rf node_modules/ngx-bootstrap
- npm i ./dist
- npm run demo.ng-build
# istanbul is broken, should be fixed
- npm run test-coverage

after_success:
- ./node_modules/.bin/codecov
#- npm run test-cross

addons:
# sauce labs tunel connector (read more https://docs.travis-ci.com/user/sauce-connect/ )
sauce_connect: true
firefox: "latest"
apt:
sources:
- ubuntu-toolchain-r-test
# required by node-gyp to build some packages
packages:
- g++-4.8
6 changes: 3 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ module.exports = function (config) {
singleRun: false,
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
base: 'ChromeHeadless',
flags: ['--disable-translate', '--disable-extensions']
}
},
mime: { 'text/x-typescript': ['ts','tsx'] },
client: { captureConsole: true, clearContext: false }
};

if (process.env.TRAVIS) {
configuration.browsers = ['Chrome_travis_ci'];
configuration.browsers = ['ChromeHeadless'];
}

if (process.env.SAUCE) {
Expand Down
15 changes: 15 additions & 0 deletions scripts/ci/npm-ng-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

npm i @angular/cli@latest \
@angular/common@latest \
@angular/compiler@latest \
@angular/compiler-cli@latest \
@angular/core@latest \
@angular/forms@latest \
@angular/http@latest \
@angular/language-service@latest \
@angular/platform-browser@latest \
@angular/platform-browser-dynamic@latest \
@angular/router@latest \
@angular/service-worker@latest \
@angular/tsc-wrapped@latest \
15 changes: 15 additions & 0 deletions scripts/ci/npm-ng-min.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

npm i @angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
@angular/[email protected] \
13 changes: 13 additions & 0 deletions scripts/ci/npm-ng-next.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

npm i @angular/common@next \
@angular/compiler@next \
@angular/compiler-cli@next \
@angular/core@next \
@angular/forms@next \
@angular/http@next \
@angular/language-service@next \
@angular/platform-browser@next \
@angular/platform-browser-dynamic@next \
@angular/router@next \
@angular/tsc-wrapped@next \

0 comments on commit 9e26b73

Please sign in to comment.