Skip to content

Commit

Permalink
Circleci (#245)
Browse files Browse the repository at this point in the history
* start configuring for circleci workflows

* more config tweaks

* force

* force

* try to run test as workflow

* try circle1

* try again

* try to build

* shift build

* simple build again

* try adding workflows again

* tweak circelci

* tweak circelci

* workflow tweak

* add fan out

* cache node_modules

* test both versions of node fetch

* chrome headless tests

* try circleci docker with browsers

* firefox and lint

* added deploy step

* final tweaks to tasks
  • Loading branch information
wheresrhys authored Jan 16, 2018
1 parent 1b4ec3d commit a7995c4
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 26 deletions.
102 changes: 102 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
version: 2.0
jobs:
checkout_code:
docker:
- image: circleci/node:8.9.0
steps:
- checkout
- run: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules

lint:
docker:
- image: circleci/node:8.9.0
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: make lint

nodefetch2:
docker:
- image: circleci/node:8.9.0
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: make coverage-report

nodefetch1:
docker:
- image: circleci/node:8.9.0
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: npm install node-fetch@1
- run: make test-unit

chrome:
docker:
- image: circleci/node:8.9.0-browsers
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: make test-chrome

firefox:
docker:
- image: circleci/node:8.9.0-browsers
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: npm install karma-firefox-launcher
- run: make test-firefox

deploy:
docker:
- image: circleci/node:8.9.0
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: npm version --no-git-tag-version ${CIRCLE_TAG}
- run: npm publish --access public

workflows:
version: 2
checkout_and_test:
jobs:
- checkout_code
- nodefetch1:
requires:
- checkout_code
- nodefetch2:
requires:
- checkout_code
- chrome:
requires:
- checkout_code
- firefox:
requires:
- checkout_code
- lint:
requires:
- checkout_code
- deploy:
requires:
- nodefetch1
- nodefetch2
- chrome
- firefox
- lint
filters:
tags:
only: /v.*/


9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ build-sw:
test-dev: build-sw
./node_modules/karma/bin/karma start

test-browser: build-sw
./node_modules/karma/bin/karma start --single-run
test-chrome: build-sw
./node_modules/karma/bin/karma start --single-run --browsers=Chrome

test-firefox: build-sw
./node_modules/karma/bin/karma start --single-run --browsers=Firefox

test-unit:
./node_modules/.bin/mocha test/server.js

lint:
./node_modules/.bin/eslint src test

test: test-unit lint test-browser coverage-report

coverage-report:
istanbul cover node_modules/.bin/_mocha --report=lcovonly 'test/server.js'
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
12 changes: 1 addition & 11 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

module.exports = function(karma) {

var configuration = {

frameworks: [ 'mocha', 'chai', 'browserify'],
Expand All @@ -24,20 +25,9 @@ module.exports = function(karma) {
'plugins': ['transform-object-assign']
}]
]
},
browsers: ['Chrome'],
customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}
};

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

karma.set(configuration);

};
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
"karma-browserify": "^5.1.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.0.0",
"karma-firefox-launcher": "^1.0.0",
"karma-mocha": "^1.2.0",
"karma-phantomjs-launcher": "^1.0.2",
"mocha": "^2.2.4",
"mockery": "^1.4.0",
"sinon": "^1.17.0",
Expand Down

0 comments on commit a7995c4

Please sign in to comment.