From eb9e9859657c1512fdc605a47538faabca77a3d9 Mon Sep 17 00:00:00 2001 From: fkleuver Date: Sun, 2 Sep 2018 02:48:00 +0200 Subject: [PATCH] chore(ci): upgrade to circleci 2.0 --- .circleci/config.yml | 70 ++++++++++++++++++++++++++++++++++++++++++++ build/tasks/test.js | 23 +++++++++++++++ circle.yml | 23 --------------- 3 files changed, 93 insertions(+), 23 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..925d28e1 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,70 @@ +# Defaults for all jobs + +defaults: &defaults + working_directory: ~/repo + docker: + - image: aureliaeffect/circleci-v1:latest + +# Variables +var_1: &cache_key aurelia-{{ .Branch }}-{{ checksum "package.json" }}{{ checksum "package-lock.json" }} + +version: 2 +jobs: + install: + <<: *defaults + steps: + - checkout + - run: npm ci + - run: jspm install + - run: git checkout -- package.json + - save_cache: + key: *cache_key + paths: + - node_modules + - jspm_packages + + build: + <<: *defaults + steps: + - checkout + - restore_cache: + key: *cache_key + - run: gulp build + - store_artifacts: + path: ./dist + + unit_tests: + <<: *defaults + steps: + - checkout + - restore_cache: + key: *cache_key + - run: gulp cover + - run: codecov -f ./build/reports/coverage/coverage-final.json + - store_test_results: + path: ./build/reports/coverage + - store_artifacts: + path: ./build/reports/coverage + + lint: + <<: *defaults + steps: + - checkout + - restore_cache: + key: *cache_key + - run: gulp lint + +workflows: + version: 2 + default_workflow: + jobs: + - install + - build: + requires: + - install + - unit_tests: + requires: + - install + - lint: + requires: + - install diff --git a/build/tasks/test.js b/build/tasks/test.js index af251d4f..8b1f9fd3 100644 --- a/build/tasks/test.js +++ b/build/tasks/test.js @@ -32,3 +32,26 @@ gulp.task('coveralls', ['test'], function (done) { gulp.src('build/reports/coverage/lcov/report-lcovonly.txt') .pipe(coveralls()); }); + + +/** + * Run test once with code coverage and exit + */ +gulp.task('cover', function (done) { + new karma.Server({ + configFile: __dirname + '/../../karma.conf.js', + singleRun: true, + reporters: ['progress', 'coverage'], + preprocessors: { + 'test/**/*.js': ['babel'], + 'src/**/*.js': ['babel', 'coverage'] + }, + coverageReporter: { + dir: 'build/reports/coverage', + reporters: [ + { type: 'html', subdir: 'report-html' }, + { type: 'json', subdir: '.', file: 'coverage-final.json' } + ] + } + }, done).start(); +}); diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 80492b47..00000000 --- a/circle.yml +++ /dev/null @@ -1,23 +0,0 @@ -##### -# Circle CI -# -# For running docker images on circle ci, see: https://circleci.com/docs/docker -# For circle.yml explanation, see: https://circleci.com/docs/manually -##### - -machine: - node: - version: 4.2.6 - -dependencies: - pre: - - npm install -g gulp - - npm install -g jspm - override: - - npm install - - jspm install - -test: - override: - - gulp build - - gulp test