Skip to content

Commit

Permalink
feat: Add danger (getsentry#1574)
Browse files Browse the repository at this point in the history
* feat: Add danger

* feat: Add travis danger job

* meta: Add sizecheck to danger

* ref: Delete dead code
  • Loading branch information
HazAT authored Sep 24, 2018
1 parent 9c131a0 commit 48fce4d
Show file tree
Hide file tree
Showing 6 changed files with 309 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ cache:

matrix:
include:
- name: '@sentry/packages - danger'
node_js: '8'
script: .travis/danger.sh
- name: '@sentry/packages - lint'
node_js: '8'
script: .travis/lint.sh
Expand Down
7 changes: 7 additions & 0 deletions .travis/danger.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e

yarn
# We have to build it first, so that TypeScript Types are recognized correctly
yarn build
yarn danger ci
1 change: 0 additions & 1 deletion .travis/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ yarn
# We have to build it first, so that TypeScript Types are recognized correctly
yarn build
yarn lint

21 changes: 21 additions & 0 deletions dangerfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { exec } from 'child_process';
import { danger, message, schedule, warn } from 'danger';
import { promisify } from 'util';

export default async () => {
if (!danger.github) {
return;
}

const hasChangelog = danger.git.modified_files.indexOf('CHANGELOG.md') !== -1;
const isTrivial = (danger.github.pr.body + danger.github.pr.title).includes('#trivial');

if (!hasChangelog && !isTrivial) {
warn('Please add a changelog entry for your changes.');
}

schedule(async () => {
const result = (await promisify(exec)('cd packages/browser; yarn size:check')).stdout;
message(`@sentry/browser gzip minified size: ${result.split('\n')[1]}`);
});
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@types/sinon": "^4.3.1",
"chai": "^4.1.2",
"codecov": "^3.0.2",
"danger": "^4.0.2",
"jest": "^22.4.3",
"karma-sinon": "^1.0.5",
"lerna": "3.4.0",
Expand Down
Loading

0 comments on commit 48fce4d

Please sign in to comment.