Skip to content

Commit

Permalink
chore: Move Regression coverage to PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni committed Sep 8, 2020
1 parent 8bc72c9 commit e6a2ea6
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/coverage-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Regression Tests Coverage Report

on:
pull_request_target:
paths:
- "examples/**"
- "test/**"
- "!examples/landmarks/**"

jobs:
report:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/head

- name: Install dependencies
run: npm ci

- name: Run coverage report
run: |
node test/util/report.js >> coverage.log || true
- name: Comment on PR
uses: actions/github-script@0.9.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs');
const commentBody = '```' + fs.readFileSync('coverage.log', 'utf8') + '```';
if (commentBody.length === 0) {
return
}
// Get the existing comments.
const {data: comments} = await github.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
})
// Find any comment already made by the bot.
const botComment = comments.find(comment => comment.user.id === 41898282)
if (botComment) {
await github.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: commentBody
})
} else {
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
body: commentBody
})
}
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ jobs:
name: Spellcheck
script: npm run lint:spelling
env: ALLOW_FAILURE=true
- stage: Lint
name: Regression Tests Coverage Report
script: node test/util/report.js
env: ALLOW_FAILURE=true

- stage: Test
name: AVA Regression Tests
Expand Down

0 comments on commit e6a2ea6

Please sign in to comment.