Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Travis matrix to use Webpack v3 and v4 #904

Merged
merged 22 commits into from
Mar 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
26c7acf
Build: Use prebuild script instead of a separate command on Travis CI
Mar 29, 2018
112fac2
Build: Use build stages and expand test matrix to test Webpack v3 & v4
Mar 29, 2018
74e7ba5
Build: Use Webpack 3 for non-matrix tasks
Mar 29, 2018
884f0c3
Chore: Remove obsolete npm script
Mar 29, 2018
8cb5c1c
Chore: Remove debug information from .travis.yml
Mar 29, 2018
33df7d1
Build: Run tests without coverage on matrix since it's 2x faster
Mar 29, 2018
8b0a5f6
Test: Test make-webpack-config on both Webpack 3 and 4
Mar 30, 2018
9a22a3a
Merge branch 'master' into build-travis-ci-stages
Mar 30, 2018
4a50323
Build: Use Webpack 4 by default for build stages on Travis CI
Mar 30, 2018
224062d
Test: Update fixtures for webpack configs
Mar 30, 2018
4f3f9f8
Build: Fix semantic-release step
Mar 30, 2018
fe9eff2
Simplify tests, add uglify plugin in production only
sapegin Mar 31, 2018
625a5be
Ignore coverage for webpack version conditions
sapegin Mar 31, 2018
1cc235b
Fix semantic-release command
sapegin Mar 31, 2018
25a49cd
Try to speed up CI by not installing the same version of webpack
sapegin Mar 31, 2018
fb7f5b1
Fix integration tests
sapegin Mar 31, 2018
01bec00
Try to fix semantic-release command again
sapegin Mar 31, 2018
c1fad23
Use npm ci on CI
Mar 31, 2018
c101513
Remove node_modules cache since npm ci will remove it either way
Mar 31, 2018
d633b88
Use Node 9 by default to speed up build
Mar 31, 2018
fc1d1e0
Fix npm installation script
Mar 31, 2018
b5e283d
Fix semantic-release command again
sapegin Mar 31, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 67 additions & 51 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will downgrade 5.8+ to 5.7.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can check for npm ci directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it says >=5.7.1 so it should use latest afaik.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can check for npm ci directly.

Not sure I get this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it locally and it installed 5.8.0

- 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading