Skip to content

Commit

Permalink
ci: replace validate-commit-msg with commitlint on Travis (#3523)
Browse files Browse the repository at this point in the history
Former is [deprecated](https://www.npmjs.com/package/validate-commit-msg) in favor of later. Karma already uses commitlint + husky to do commit validation locally. Added a dedicated package to simplify Travis integration as described in the commitlint [documentation](https://commitlint.js.org/#/guides-ci-setup).

As a bonus it provides a good error message when Travis fails because of the bad commit message ([example](https://travis-ci.org/github/karma-runner/karma/jobs/688059354#L92)).
  • Loading branch information
devoto13 authored May 20, 2020
1 parent 5bb19a8 commit c22c297
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 112 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ jobs:
- node_js: "14"
script:
- npm run init
- echo "TRAVIS_COMMIT $TRAVIS_COMMIT"
- echo "TRAVIS_PULL_REQUEST_SHA $TRAVIS_PULL_REQUEST_SHA"
- COMMIT_TO_VALIDATE=${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT}
- echo "COMMIT_TO_VALIDATE $COMMIT_TO_VALIDATE"
- ./scripts/validate-commit-msg.sh $COMMIT_TO_VALIDATE
- commitlint-travis
- npm run lint
- npm run build
- npm run test:unit
Expand Down
3 changes: 1 addition & 2 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ module.exports = function (grunt) {
client: ['client/**/*.js'],
common: ['common/**/*.js'],
context: ['context/**/*.js'],
grunt: ['grunt.js', 'tasks/*.js'],
scripts: ['scripts/init-dev-env.js']
grunt: ['grunt.js', 'tasks/*.js']
},
browserify: {
client: {
Expand Down
100 changes: 52 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@
"devDependencies": {
"@commitlint/cli": "^8.3.4",
"@commitlint/config-conventional": "^8.3.4",
"@commitlint/travis-cli": "^8.3.5",
"@semantic-release/changelog": "^3.0.6",
"@semantic-release/git": "^7.0.18",
"browserify": "^16.2.3",
Expand Down Expand Up @@ -466,7 +467,6 @@
"sinon-chai": "^3.0.0",
"supertest": "^4.0.2",
"timer-shim": "^0.3.0",
"validate-commit-msg": "^2.11.1",
"which": "^1.3.1"
},
"main": "./lib/index",
Expand Down
38 changes: 0 additions & 38 deletions scripts/validate-commit-msg.sh

This file was deleted.

18 changes: 0 additions & 18 deletions tasks/init-dev-env.js

This file was deleted.

0 comments on commit c22c297

Please sign in to comment.