Skip to content

Commit

Permalink
Adds visual regression output, spellcheck and prints the test PR via …
Browse files Browse the repository at this point in the history
…danger
  • Loading branch information
orta committed Nov 7, 2019
1 parent e2c94fa commit 4a66ae3
Show file tree
Hide file tree
Showing 4 changed files with 1,225 additions and 25 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,12 @@ jobs:
NOW_ACCESS_TOKEN: ${{ secrets.NOW_ACCESS_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}

# danger for PR builds
- if: github.event_name == 'pull_request'
run: 'if test -z "$GITHUB_TOKEN"; then echo "Skipping danger"; else yarn danger ci; fi'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Run any tests
- run: yarn workspaces run test --ci
40 changes: 40 additions & 0 deletions dangerfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// This Dangerfile only runs on same-repo PRs

// You can test it by running
// yarn danger pr https://github.com/microsoft/TypeScript-Website/pull/115

import { danger, message, markdown } from 'danger'
import {basename} from "path"
import spellcheck from 'danger-plugin-spellcheck'

// Spell check all the things
spellcheck({
settings: 'artsy/peril-settings@spellcheck.json',
codeSpellCheck: ['Examples/**/*.ts', 'Examples/**/*.js'],
})

// Print out the PR url
const deployURL = `https://typescript-v2-${danger.github.pr.number}.ortam.now.sh`
message(`Deployed to [a PR branch](${deployURL})`)

// Look for new snapshots and show in a HTML table
const snapshots = danger.git.fileMatch("packages/typescriptlang-org/_tests/backstop_data/bitmaps_reference/*.png")
if (snapshots.modified) {
const oldSha = danger.github.pr.base.sha
const newSha = danger.github.pr.head.sha

const tables = snapshots.getKeyedPaths().modified.map(p => {
const oldURL = `https://raw.githubusercontent.com/microsoft/TypeScript-Website/${oldSha}/${p}`
const newURL = `https://raw.githubusercontent.com/microsoft/TypeScript-Website/${newSha}/${p}`

return `
###### \`${basename(p)}\`
Before | After
:-------------------------:|:-------------------------:
![](${oldURL}) | ![](${newURL})
`
})

markdown(`## Snapshots updated\n\n ${tables.join("\n\n")}`)
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@
"semi": false,
"singleQuote": true,
"trailingComma": "es5"
},
"dependencies": {
"danger": "^9.2.4",
"danger-plugin-spellcheck": "^1.5.0"
}
}
Loading

0 comments on commit 4a66ae3

Please sign in to comment.