This repository has been archived by the owner on Oct 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2570 from withspectrum/alpha
Merge to production
- Loading branch information
Showing
32 changed files
with
1,843 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,5 @@ test-extend.js | |
stats.json | ||
iris/.env | ||
.expo | ||
mobile/.expo | ||
mobile/.expo | ||
test-results.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// @flow | ||
import path from 'path'; | ||
import { warn, fail, message, markdown, schedule, danger } from 'danger'; | ||
import yarn from 'danger-plugin-yarn'; | ||
import jest from 'danger-plugin-jest'; | ||
import noTestShortcuts from 'danger-plugin-no-test-shortcuts'; | ||
|
||
const APP_FOLDERS = [ | ||
'admin', | ||
'athena', | ||
'chronos', | ||
'hermes', | ||
'hyperion', | ||
'iris', | ||
'mercury', | ||
'shared', | ||
'src', | ||
'vulcan', | ||
]; | ||
const CHECKBOXES = /^- \[x\] *(.*)?$/gim; | ||
const possibleAutoLabels = { | ||
wip: 'WIP: Building', | ||
'needs testing': 'WIP: Needs Testing', | ||
'ready for review': 'WIP: Ready for Review', | ||
}; | ||
|
||
// Make sure people describe what their PR is about | ||
if (danger.github.pr.body.length < 10) { | ||
fail('Please add a description to your PR.'); | ||
} | ||
|
||
// Add automatic labels to the PR | ||
schedule(async () => { | ||
const pr = danger.github.pr; | ||
const api = danger.github.api; | ||
const checkedBoxes = pr.body.match(CHECKBOXES); | ||
if (!checkedBoxes || checkedBoxes.length === 0) return; | ||
|
||
const matches = checkedBoxes.map(result => result[1]); | ||
|
||
const matchingLabels = matches.filter(match => | ||
Object.keys(possibleAutoLabels).includes(match.toLowerCase()) | ||
); | ||
|
||
if (!matchingLabels || matchingLabels.length === 0) return; | ||
|
||
await api.issues.addLabels({ | ||
owner: pr.owner, | ||
repo: pr.repo, | ||
number: pr.number, | ||
labels: matchingLabels, | ||
}); | ||
}); | ||
|
||
// Make sure the yarn.lock file is updated when dependencies get added and log any added dependencies | ||
APP_FOLDERS.forEach(folder => { | ||
schedule(yarn(path.join(__dirname, folder, 'package.json'))); | ||
}); | ||
|
||
// Log test failures if there are any | ||
jest(); | ||
|
||
// Make sure nobody does a it.only and blocks our entire test-suite from running | ||
noTestShortcuts({ | ||
testFilePredicate: filePath => filePath.endsWith('.test.js'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// flow-typed signature: 0bc9953088789fa140d0772a738d8153 | ||
// flow-typed version: <<STUB>>/danger-plugin-jest_v^1.1.0/flow_v0.66.0 | ||
|
||
/** | ||
* This is an autogenerated libdef stub for: | ||
* | ||
* 'danger-plugin-jest' | ||
* | ||
* Fill this stub out by replacing all the `any` types. | ||
* | ||
* Once filled out, we encourage you to share your work with the | ||
* community by sending a pull request to: | ||
* https://github.com/flowtype/flow-typed | ||
*/ | ||
|
||
declare module 'danger-plugin-jest' { | ||
declare module.exports: any; | ||
} | ||
|
||
/** | ||
* We include stubs for each file inside this npm package in case you need to | ||
* require those files directly. Feel free to delete any files that aren't | ||
* needed. | ||
*/ | ||
declare module 'danger-plugin-jest/dist/index' { | ||
declare module.exports: any; | ||
} | ||
|
||
declare module 'danger-plugin-jest/dist/types' { | ||
declare module.exports: any; | ||
} | ||
|
||
// Filename aliases | ||
declare module 'danger-plugin-jest/dist/index.js' { | ||
declare module.exports: $Exports<'danger-plugin-jest/dist/index'>; | ||
} | ||
declare module 'danger-plugin-jest/dist/types.js' { | ||
declare module.exports: $Exports<'danger-plugin-jest/dist/types'>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// flow-typed signature: 6eac443fa8195b12d311468f9d3dfcb8 | ||
// flow-typed version: <<STUB>>/danger-plugin-no-test-shortcuts_v^2.0.0/flow_v0.66.0 | ||
|
||
/** | ||
* This is an autogenerated libdef stub for: | ||
* | ||
* 'danger-plugin-no-test-shortcuts' | ||
* | ||
* Fill this stub out by replacing all the `any` types. | ||
* | ||
* Once filled out, we encourage you to share your work with the | ||
* community by sending a pull request to: | ||
* https://github.com/flowtype/flow-typed | ||
*/ | ||
|
||
declare module 'danger-plugin-no-test-shortcuts' { | ||
declare module.exports: any; | ||
} | ||
|
||
/** | ||
* We include stubs for each file inside this npm package in case you need to | ||
* require those files directly. Feel free to delete any files that aren't | ||
* needed. | ||
*/ | ||
declare module 'danger-plugin-no-test-shortcuts/dist/index' { | ||
declare module.exports: any; | ||
} | ||
|
||
// Filename aliases | ||
declare module 'danger-plugin-no-test-shortcuts/dist/index.js' { | ||
declare module.exports: $Exports<'danger-plugin-no-test-shortcuts/dist/index'>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// flow-typed signature: 7b69917a67b22d12810ba89bc8ffdec2 | ||
// flow-typed version: <<STUB>>/danger-plugin-yarn_v^1.2.1/flow_v0.66.0 | ||
|
||
/** | ||
* This is an autogenerated libdef stub for: | ||
* | ||
* 'danger-plugin-yarn' | ||
* | ||
* Fill this stub out by replacing all the `any` types. | ||
* | ||
* Once filled out, we encourage you to share your work with the | ||
* community by sending a pull request to: | ||
* https://github.com/flowtype/flow-typed | ||
*/ | ||
|
||
declare module 'danger-plugin-yarn' { | ||
declare module.exports: any; | ||
} | ||
|
||
/** | ||
* We include stubs for each file inside this npm package in case you need to | ||
* require those files directly. Feel free to delete any files that aren't | ||
* needed. | ||
*/ | ||
declare module 'danger-plugin-yarn/dist/danger-mock' { | ||
declare module.exports: any; | ||
} | ||
|
||
declare module 'danger-plugin-yarn/dist/index' { | ||
declare module.exports: any; | ||
} | ||
|
||
declare module 'danger-plugin-yarn/dist/index.test' { | ||
declare module.exports: any; | ||
} | ||
|
||
// Filename aliases | ||
declare module 'danger-plugin-yarn/dist/danger-mock.js' { | ||
declare module.exports: $Exports<'danger-plugin-yarn/dist/danger-mock'>; | ||
} | ||
declare module 'danger-plugin-yarn/dist/index.js' { | ||
declare module.exports: $Exports<'danger-plugin-yarn/dist/index'>; | ||
} | ||
declare module 'danger-plugin-yarn/dist/index.test.js' { | ||
declare module.exports: $Exports<'danger-plugin-yarn/dist/index.test'>; | ||
} |
Oops, something went wrong.