-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
132 lines (110 loc) · 3.64 KB
/
benchmark.yaml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Benchmark
on:
pull_request:
branches: [master]
types: [labeled, synchronize]
jobs:
build:
runs-on: ubuntu-latest
if: >-
(github.event.action == 'labeled' && github.event.label.name == 'performance') ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'performance'))
env:
MSG_FOOTER: |-
<br/>
Workflow: [${{ github.run_id }}](/${{ github.repository }}/actions/runs/${{ github.run_id }})
*Adding new commits will generate a new report*
steps:
- name: Post comment
uses: jungwinter/comment@v1
id: create_comment
with:
type: create
body: |
Started a benchmark for this pull request.
This comment will be updated with the results.
${{ env.MSG_FOOTER }}
issue_number: ${{ github.event.number }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
with:
repository: yewstack/js-framework-benchmark
- name: Configure benchmark
run: |
search="{ git = \"https://github.com/jstarry/yew\", branch = \"keyed-list\" }"
replace="{ git = \"${{ github.event.pull_request.head.repo.html_url }}\", branch = \"${{ github.event.pull_request.head.ref }}\" }"
input=$(cat frameworks/keyed/yew/Cargo.toml)
output=${input//"$search"/"$replace"}
if [[ "$input" == "$output" ]]; then
echo "ERROR: failed to configure Cargo.toml"
exit 1
fi
echo "$output" > frameworks/keyed/yew/Cargo.toml
echo "$output"
- name: Setup ChromeDriver
uses: nanasess/setup-chromedriver@master
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/install@v0.1
with:
crate: wasm-bindgen-cli
version: latest
use-tool-cache: true
- uses: actions-rs/install@v0.1
with:
crate: wasm-pack
version: latest
use-tool-cache: true
- uses: actions-rs/install@v0.1
with:
crate: https
version: latest
use-tool-cache: true
- name: Start Server
run: http -p 8080 &
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 12
- name: npm Install
run: |
npm install
(cd webdriver-ts && npm install)
(cd webdriver-ts-results && npm install)
- name: Build
run: |
npm run build-prod
(cd webdriver-ts && npm run build-prod)
- name: Benchmark
run: npm run bench -- --headless
- name: Results
run: npm run results
- name: Write comment body
run: |
msg=$(cd results_diff && cargo run)
msg="${msg//'%'/'%25'}"
msg="${msg//$'\n'/'%0A'}"
msg="${msg//$'\r'/'%0D'}"
echo "::set-env name=MSG::$msg"
- name: Post results
uses: jungwinter/comment@v1
with:
type: edit
body: |
${{ env.MSG }}
${{ env.MSG_FOOTER }}
comment_id: ${{ steps.create_comment.outputs.id }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Post failure
if: ${{ failure() }}
uses: jungwinter/comment@v1
with:
type: edit
body: |
**The benchmark failed to complete.**
Please see the workflow for more details.
${{ env.MSG_FOOTER }}
comment_id: ${{ steps.create_comment.outputs.id }}
token: ${{ secrets.GITHUB_TOKEN }}