Skip to content

Commit

Permalink
feat(ci): speed up travis builds (#4883)
Browse files Browse the repository at this point in the history
* feat(ci): speed up all the things

* chore(ci): try 2

* chore ci: try 3, update codecov and remove precache

* try 4: clean run

* try 5 LINT has a name

* Update .travis.yml

* fix(test): fix schematics test

* fix(ci): add install @schematics/angular@latest
  • Loading branch information
valorkin authored Dec 4, 2018
1 parent 0de72f9 commit c0b1870
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 65 deletions.
100 changes: 43 additions & 57 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,13 @@ env:
- LOGS_DIR=/tmp/logs

stages:
- &stage
name: precache
- name: Testing
if: ( branch = development AND type = push ) OR type = pull_request OR tag =~ ^v\d+
- <<: *stage
name: lint
- <<: *stage
name: test
- <<: *stage
name: cypress-tests:smoke
- <<: *stage
name: build
- name: deploy
if: branch = development AND type = push OR tag =~ ^v\d+
- name: publish
if: tag =~ ^v\d+
- <<: *stage
name: sauce-tests
- <<: *stage
name: cypress-tests:full:herokuapp
if: branch = development AND type = push OR tag =~ ^v\d+
- <<: *stage
name: cypress-tests:full:gh-pages
- name: cypress-tests:full
if: branch = development AND type = push OR tag =~ ^v\d+

before_install:
Expand All @@ -58,63 +43,63 @@ jobs:
fast_finish: true
allow_failures:
- env: NGV=next
- env: SAUCE=true
- stage: sauce-tests
- name: sauce-tests
include:
# precache npm and apt dependencies
- stage: precache
install:
- npm ci
script: true
addons:
chrome: stable
apt:
sources:
- ubuntu-toolchain-r-test
# required by node-gyp to build some packages
packages:
- g++-4.8

# - stage: precache
# install: npm ci
# script: true
# addons:
# chrome: stable
# apt:
# sources:
# - ubuntu-toolchain-r-test
# # required by node-gyp to build some packages
# packages:
# - g++-4.8
# run in parallel
- stage: Testing
# lint code
- stage: lint
install: true
script: npm run lint-src
name: "Lint"
install: true

# test
- &test
stage: test
script: npm run test-coverage
after_success:
- ./node_modules/.bin/codecov
- <<: *test
- script: npm run test-coverage
name: "Test with current Angular version"
after_success: ./node_modules/.bin/codecov
- script: npm run test
name: "Test with latest Angular version"
env: NGV=latest
# - <<: *test
# env: NGV=next
# env: NGV=next

# test cypress smoke
- stage: cypress-tests:smoke
- script:
- ng serve --prod &
- $(npm bin)/wait-on http-get://$URL
- npm run cy:run:smoke
# after all tests finish running we need
# to kill all background jobs (like "npm start &")
- kill $(jobs -p) || true
name: "Run cypress smoke testing"
env: URL=localhost:4200/#
before_script: ng serve --prod &
script: $(npm bin)/wait-on http-get://$URL && npm run cy:run:smoke

# check prod build
- &build
stage: build
script: npm run demo.ng-build
- <<: *build
- script: npm run demo.ng-build
name: "Check prod build with current Angular version"
- script: npm run demo.ng-build
name: "Check prod build with latest Angular version"
env: NGV=latest
# - <<: *build
# env: NGV=next
- stage: sauce-tests
- script: npm run test-cross
name: sauce-tests
env: SAUCE=true
addons:
sauce_connect:
username: $SAUCE_USERNAME_PR
access_key: $SAUCE_ACCESS_KEY_PR
before_script:
- mkdir -p $LOGS_DIR
script:
- npm run test-cross

# deploy to ngx-bootstrap.surge.sh
- &surge
stage: deploy
Expand Down Expand Up @@ -168,14 +153,15 @@ jobs:
tags: true

# test cypress full for herokuapp
- stage: cypress-tests:full:herokuapp
- stage: cypress-tests:full
name: "Run cypress to check SSR"
env: URL=https://ngx-universal.herokuapp.com/#
script: npm run cy:run:smoke && npm run cy:run:full

# test cypress full for gh-pages
- stage: cypress-tests:full:gh-pages
- script: npm run cy:run:smoke && npm run cy:run:full
name: "Run cypress to check demo pages"
env: URL=https://valor-software.com/ngx-bootstrap/#/
script: npm run cy:run:smoke && npm run cy:run:full

cache:
apt: true
Expand Down
23 changes: 17 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"bootstrap": "4.1.1",
"chai": "4.1.2",
"classlist-polyfill": "1.2.0",
"codecov": "3.0.2",
"codecov": "3.1.0",
"codelyzer": "4.3.0",
"compression": "1.7.2",
"conventional-changelog-cli": "1.3.22",
Expand Down
2 changes: 1 addition & 1 deletion schematics/src/ng-add/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ describe('ng-add schematic', () => {
const workspace = getWorkspace(tree);
const project = getProjectFromWorkspace(workspace);

expectProjectStyleFile(project, './node_modules/bootstrap/dist/css/bootstrap.css');
expectProjectStyleFile(project, './node_modules/bootstrap/dist/css/bootstrap.min.css');
});
});
1 change: 1 addition & 0 deletions scripts/ci/npm-ng-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ npm i @angular/animations@latest \
@angular/platform-browser-dynamic@latest \
@angular/router@latest \
@angular/service-worker@latest \
@angular-devkit/schematics@latest \
@schematics/angular@latest \
[email protected] \
[email protected] \
Expand Down

0 comments on commit c0b1870

Please sign in to comment.