Skip to content

Commit

Permalink
Chore: Expand Travis matrix to use Webpack v3 and v4 (#904)
Browse files Browse the repository at this point in the history
Close #902
  • Loading branch information
okonet authored and sapegin committed Mar 31, 2018
1 parent dea7bdd commit 7dbb284
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 288 deletions.
118 changes: 67 additions & 51 deletions .travis.yml
@@ -1,58 +1,74 @@
language: node_js
node_js:
- 6
- 8
- 9
cache:
directories:
- node_modules
before_install:
# Upgrade npm
- if [[ `npm -v` != 5* ]]; then npm install -g npm@latest; fi
- 8
- 6
env:
- WEBPACK_VERSION= # Current, from package.json
- WEBPACK_VERSION=3
install:
# Use npm 5.7.x since it has introduced `npm ci`
- if [[ `npm -v` != 5.7* ]]; then npm install -g npm@'>=5.7.1'; fi
- npm ci
before_script:
# Install Webpack version
- if [[ -n "$WEBPACK_VERSION" ]]; then npm install --no-save webpack@$WEBPACK_VERSION; fi
script:
# Run lint
- npm run lint
# Run tests and Danger.js
- |
if [[ "$TRAVIS_NODE_VERSION" == "9" ]]; then
npx danger ci
npm run test:coverage -- --runInBand
else
npm run test:jest -- --runInBand
fi
# Compile code
- npm run compile
# Build all examples
- npm run build
- npm run build:customised
- npm run build:sections
- |
if [[ "$TRAVIS_NODE_VERSION" == "9" ]]; then
# Check that examples really works: no JS errors on load
npm run test:browser:pre
npm run test:browser
npm run test:browser:customised
npm run test:browser:sections
# Run integration tests with cypress
npm run test:cypress:pre
npm run test:cypress:startServer &
npm run test:cypress:startServer:post
npm run test:cypress:run
fi
after_success:
# Make release with semantic-release if needed
- npm install -g semantic-release travis-deploy-once
- npm install --no-save semantic-release-tamia
- travis-deploy-once "semantic-release --analyze-commits semantic-release-tamia/analyzeCommits --verify-release semantic-release-tamia/verifyRelease --generate-notes semantic-release-tamia/generateNotes"
- |
if [[ "$TRAVIS_NODE_VERSION" == "9" ]]; then
# Upload coverage report to Codecov
bash <(curl -s https://codecov.io/bash)
# Update site
if [[ "$TRAVIS_BRANCH" == "master" ]]; then
curl -X POST -d '{}' https://api.netlify.com/build_hooks/591308eba700c425fc1e8a54
fi
fi
# Run tests without coverage since it's 2x faster
- npm run test:jest -- --runInBand
branches:
except:
- /^v\d+\.\d+\.\d+$/
stages:
- lint
- test
- integration
- coverage
- release
- name: documentation
if: branch = master
jobs:
include:
- stage: lint
script:
- npm run lint
- npx danger ci

- stage: integration
script:
# Compile JS
- npm run compile
# Build all examples
- npm run build:basic
- npm run build:customised
- npm run build:sections
# Check that examples really works: no JS errors on load
- npm run test:browser:pre
- npm run test:browser:basic
- npm run test:browser:customised
- npm run test:browser:sections
# Run integration tests with Cypress
- npm run test:cypress:pre
- npm run test:cypress:startServer &
- npm run test:cypress:startServer:post
- npm run test:cypress:run

- stage: coverage
script:
# Run tests with coverage
- npm run test:coverage -- --runInBand
# Upload coverage report to Codecov
- bash <(curl -s https://codecov.io/bash)

- stage: release
script:
- npm install --no-save semantic-release-tamia
- >-
npx semantic-release
--analyze-commits semantic-release-tamia/analyzeCommits
--verify-release semantic-release-tamia/verifyRelease
--generate-notes semantic-release-tamia/generateNotes
- stage: documentation
script:
- curl -X POST -d '{}' https://api.netlify.com/build_hooks/591308eba700c425fc1e8a54
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -147,12 +147,12 @@
"precompile": "rimraf lib/",
"compile": "babel --ignore '*.spec.js' -d lib/ src/",
"compile:watch": "babel --ignore '*.spec.js' --watch -d lib/ src/",
"build": "node bin/styleguidist.js build --config examples/basic/styleguide.config.js",
"prepublishOnly": "npm run compile",
"build:basic": "node bin/styleguidist.js build --config examples/basic/styleguide.config.js",
"build:customised": "node bin/styleguidist.js build --config examples/customised/styleguide.config.js",
"build:sections": "node bin/styleguidist.js build --config examples/sections/styleguide.config.js",
"prepare": "npm run compile",
"test:browser:pre": "npm i --no-save puppeteer",
"test:browser": "node test/browser.js examples/basic/styleguide/index.html",
"test:browser:basic": "node test/browser.js examples/basic/styleguide/index.html",
"test:browser:customised": "node test/browser.js examples/customised/styleguide/index.html",
"test:browser:sections": "node test/browser.js examples/sections/styleguide/index.html",
"precommit": "lint-staged",
Expand Down
199 changes: 1 addition & 198 deletions scripts/__tests__/__snapshots__/make-webpack-config.spec.js.snap
Expand Up @@ -49,204 +49,7 @@ Array [
]
`;

exports[`should return a development config 1`] = `
Object {
"entry": Array [
"~/lib/index",
"~/node_modules/react-dev-utils/webpackHotDevClient.js",
],
"mode": "development",
"optimization": Object {
"minimizer": Array [
UglifyJsPlugin {
"options": Object {
"cache": true,
"exclude": undefined,
"extractComments": false,
"include": undefined,
"parallel": true,
"sourceMap": false,
"test": /\\\\\\.js\\(\\\\\\?\\.\\*\\)\\?\\$/i,
"uglifyOptions": Object {
"compress": Object {
"keep_fnames": true,
"warnings": false,
},
"ecma": 5,
"ie8": false,
"mangle": Object {
"keep_fnames": true,
},
"output": Object {
"comments": /\\^\\\\\\*\\*!\\|@preserve\\|@license\\|@cc_on/,
},
},
"warningsFilter": [Function],
},
},
],
},
"output": Object {
"chunkFilename": "build/[name].js",
"filename": "build/[name].bundle.js",
"path": "~/scripts/__tests__",
},
"performance": Object {
"hints": false,
},
"plugins": Array [
StyleguidistOptionsPlugin {
"options": Object {
"editorConfig": Object {
"theme": "hl-theme",
},
"require": Array [],
"styleguideDir": "~/scripts/__tests__",
"title": "Style Guide",
},
"plugin": [Function],
},
MiniHtmlWebpackPlugin {
"options": Object {
"context": Object {
"container": "rsg-root",
"title": "Style Guide",
"trimWhitespace": true,
},
"template": [Function],
},
"plugin": [Function],
},
DefinePlugin {
"definitions": Object {
"process.env.NODE_ENV": "\\"test\\"",
"process.env.STYLEGUIDIST_ENV": "\\"development\\"",
},
},
HotModuleReplacementPlugin {
"fullBuildTimeout": 200,
"multiStep": undefined,
"options": Object {},
"requestTimeout": 10000,
},
],
"resolve": Object {
"alias": Object {
"rsg-codemirror-theme.css": "codemirror/theme/hl-theme.css",
"rsg-components": "~/lib/rsg-components",
},
"extensions": Array [
".js",
".jsx",
".json",
],
},
}
`;

exports[`should return a production config 1`] = `
Object {
"entry": Array [
"~/lib/index",
],
"mode": "production",
"optimization": Object {
"minimizer": Array [
UglifyJsPlugin {
"options": Object {
"cache": true,
"exclude": undefined,
"extractComments": false,
"include": undefined,
"parallel": true,
"sourceMap": false,
"test": /\\\\\\.js\\(\\\\\\?\\.\\*\\)\\?\\$/i,
"uglifyOptions": Object {
"compress": Object {
"keep_fnames": true,
"warnings": false,
},
"ecma": 5,
"ie8": false,
"mangle": Object {
"keep_fnames": true,
},
"output": Object {
"comments": /\\^\\\\\\*\\*!\\|@preserve\\|@license\\|@cc_on/,
},
},
"warningsFilter": [Function],
},
},
],
},
"output": Object {
"chunkFilename": "build/[name].[chunkhash:8].js",
"filename": "build/bundle.[chunkhash:8].js",
"path": "~/scripts/__tests__",
},
"performance": Object {
"hints": false,
},
"plugins": Array [
StyleguidistOptionsPlugin {
"options": Object {
"editorConfig": Object {
"theme": "hl-theme",
},
"require": Array [],
"styleguideDir": "~/scripts/__tests__",
"title": "Style Guide",
},
"plugin": [Function],
},
MiniHtmlWebpackPlugin {
"options": Object {
"context": Object {
"container": "rsg-root",
"title": "Style Guide",
"trimWhitespace": true,
},
"template": [Function],
},
"plugin": [Function],
},
DefinePlugin {
"definitions": Object {
"process.env.NODE_ENV": "\\"test\\"",
"process.env.STYLEGUIDIST_ENV": "\\"production\\"",
},
},
CleanWebpackPlugin {
"options": Object {
"allowExternal": false,
"dry": false,
"root": "~/scripts/__tests__",
"verbose": false,
},
"paths": Array [
"build",
],
},
Object {
"apply": [Function],
},
],
"resolve": Object {
"alias": Object {
"rsg-codemirror-theme.css": "codemirror/theme/hl-theme.css",
"rsg-components": "~/lib/rsg-components",
},
"extensions": Array [
".js",
".jsx",
".json",
],
},
}
`;

exports[`should use editorConfig theme over highlightTheme 1`] = `
exports[`should set aliases 1`] = `
Object {
"rsg-codemirror-theme.css": "codemirror/theme/hl-theme.css",
"rsg-components": "~/lib/rsg-components",
Expand Down

0 comments on commit 7dbb284

Please sign in to comment.