forked from adobe/spectrum-web-components
-
Notifications
You must be signed in to change notification settings - Fork 4
90 lines (81 loc) · 3.73 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Performance check
on: pull_request
jobs:
compare:
name: Compare performance to latest release
# We can't currently run benchmarks on PRs from forked repos, because the
# tachometer action reports results by posting a comment, and we can't post
# comments without a github token.
if: github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: main
- uses: actions/checkout@v2
- name: Setup Node 14
uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Post Previews
uses: actions/github-script@v4
with:
script: |
const buildPreviewURLComment = require('./tasks/build-preview-urls-comment.cjs').buildPreviewURLComment;
const body = buildPreviewURLComment(process.env.GITHUB_HEAD_REF);
github.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
}).then(({data}) => {
const priorComment = data.find(comment => comment.body.startsWith('# Branch Preview'));
if (priorComment) {
github.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: priorComment.id,
body
});
} else {
github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
}
});
- name: Tachometer the changed packages
run: yarn test:changed
- name: Post Performance
uses: actions/github-script@v4
with:
script: |
const buildTachometerComment = require('./tasks/build-tachometer-comment.cjs').buildTachometerComment;
const body = buildTachometerComment();
github.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
}).then(({data}) => {
const priorComment = data.find(comment => comment.body.startsWith('# Tachometer results'));
if (priorComment) {
github.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: priorComment.id,
body
});
} else {
github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
}
});