diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..c700ed0f --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,161 @@ +unit_tests: &unit_tests + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: NPM Rebuild + command: npm install + - run: + name: Run unit tests. + command: npm run ci:test +canary_tests: &canary_tests + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: NPM Rebuild + command: npm install + - run: + name: Install Webpack Canary + command: npm i --no-save webpack@next + - run: + name: Run unit tests. + command: npm run ci:test + +version: 2 +jobs: + dependency_cache: + docker: + - image: webpackcontrib/circleci-node-base:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: Install Dependencies + command: npm install + - save_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + paths: + - ./node_modules + + node8-latest: + docker: + - image: webpackcontrib/circleci-node8:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: NPM Rebuild + command: npm install + - run: + name: Run unit tests. + command: npm run ci:coverage + - run: + name: Submit coverage data to codecov. + command: bash <(curl -s https://codecov.io/bash) + when: on_success + node6-latest: + docker: + - image: webpackcontrib/circleci-node6:latest + <<: *unit_tests + node9-latest: + docker: + - image: webpackcontrib/circleci-node9:latest + <<: *unit_tests + node8-canary: + docker: + - image: webpackcontrib/circleci-node8:latest + <<: *canary_tests + analysis: + docker: + - image: webpackcontrib/circleci-node-base:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: NPM Rebuild + command: npm install + - run: + name: Run linting. + command: npm run lint + - run: + name: Run NSP Security Check. + command: npm run security + # - run: + # name: Validate Commit Messages + # command: npm run ci:lint:commits + publish: + docker: + - image: webpackcontrib/circleci-node-base:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: NPM Rebuild + command: npm install + # - run: + # name: Validate Commit Messages + # command: npm run release:validate + - run: + name: Publish to NPM + command: printf "noop running conventional-github-releaser" + +version: 2.0 +workflows: + version: 2 + validate-publish: + jobs: + - dependency_cache + - node6-latest: + requires: + - dependency_cache + filters: + tags: + only: /.*/ + - analysis: + requires: + - dependency_cache + filters: + tags: + only: /.*/ + - node8-latest: + requires: + - analysis + - node6-latest + filters: + tags: + only: /.*/ + - node9-latest: + requires: + - analysis + - node6-latest + filters: + tags: + only: /.*/ + - node8-canary: + requires: + - analysis + - node6-latest + filters: + tags: + only: /.*/ + - publish: + requires: + - node8-latest + - node9-latest + filters: + branches: + only: + - master \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1b87fb32..e8543b0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /node_modules .idea/ +/coverage \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9e840b88..00000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -sudo: false -language: node_js -branches: - only: - - master -matrix: - fast_finish: true - include: - # - os: linux - # node_js: '8' - # env: WEBPACK_VERSION="2.2.0" BITHOUND_CHECK=true JOB_PART=lint - - os: linux - node_js: '8' - env: WEBPACK_VERSION="2.2.0" JOB_PART=test - - os: linux - node_js: '4.8' - env: WEBPACK_VERSION="2.2.0" JOB_PART=test - - os: linux - node_js: '6' - env: WEBPACK_VERSION="2.2.0" JOB_PART=test - # - os: linux - # node_js: '8' - # env: WEBPACK_VERSION="2.2.0" JOB_PART=coverage -before_install: - - nvm --version - - node --version -before_script: - - if [ "$WEBPACK_VERSION" ]; then npm i webpack@^$WEBPACK_VERSION; fi - # - if [ "$BITHOUND_CHECK" ]; then npm install -g bithound; bithound check git@github.com:$TRAVIS_REPO_SLUG.git; fi -script: - - npm run travis:$JOB_PART -after_success: - - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/package.json b/package.json index 3ca93a83..8a32568d 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "devDependencies": { "css-loader": "^0.28.0", "file-loader": "^1.0.0", + "istanbul": "^0.4.5", "jsdom": "^9.0.0", "memory-fs": "^0.4.0", "mocha": "^4.0.0", @@ -30,7 +31,9 @@ }, "scripts": { "test": "mocha", - "travis:test": "npm t", + "test:coverage": "istanbul cover node_modules/mocha/bin/_mocha", + "ci:test": "npm run test", + "ci:coverage": "npm run test:coverage", "release": "standard-version" }, "repository": "https://github.com/webpack-contrib/style-loader.git",