-
Notifications
You must be signed in to change notification settings - Fork 1
292 lines (277 loc) · 11.9 KB
/
benchmarks.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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
name: Benchmarks
on:
workflow_dispatch:
inputs:
pr_id:
description: 'Pull Request number'
required: true
default: ''
workflow_run:
workflows: ["BuildAndReleaseMaster"]
types:
- completed
jobs:
invoke_jasmine_tests:
name: Invoke Jasmine performance tests
runs-on: self-hosted-runner-ubuntu
steps:
- name: Cleanup build folder
run: |
ls -la ./
rm -rf ./* ./.??* || true
ls -la ./
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gconf-service libgbm-dev libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 \
libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 \
libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release xdg-utils wget \
libudev-dev cargo npm imagemagick libmagickwand-dev cmake jq
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22.4.0
- name: Install Ruby and related tools
run: |
whoami
npm install -g corepack
corepack enable
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install -y yarn software-properties-common
apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update && sudo apt-get install -y rvm
echo 'source "/etc/profile.d/rvm.sh"' >> ~/.bashrc
source /etc/profile.d/rvm.sh
rvm install ruby-3.1.2
ruby --version
sudo chown -R $(whoami) /usr/local
rvm use 3.1.2 --default
- name: Install cargo tools
run: |
cargo install nj-cli wasm-pack --locked
- name: Prepare environment
run: |
npm install -g tslib
export PATH="/usr/share/rvm:$PATH"
gem install dotenv json octokit tmpdir fileutils
- name: Get PR details
if: github.event_name == 'workflow_dispatch'
uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const fs = require('fs');
const pr = await github.rest.pulls.get({
owner: 'esrlabs',
repo: 'chipmunk',
pull_number: ${{ github.event.inputs.pr_id }}
});
fs.appendFileSync(process.env.GITHUB_ENV, `REPO_OWNER=${pr.data.user.login}\n`);
fs.appendFileSync(process.env.GITHUB_ENV, `REPO_NAME=${pr.data.base.repo.name}\n`);
- name: Run Jasmine performance tests
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="/root/.cargo/bin:$PATH"
source ~/.bashrc
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
echo "PR head repo: ${{ env.REPO_NAME }}"
echo "PR head owner: ${{ env.REPO_OWNER }}"
ruby scripts/tools/run_benchmarks.rb PR~${{ github.event.inputs.pr_id }}
else
export REPO_OWNER='esrlabs'
export REPO_NAME='chipmunk'
ruby scripts/tools/run_benchmarks.rb 10
fi
- name: List files in the results folder
run: |
echo "Event is: ${{ github.event_name }}"
ls -la /chipmunk/chipmunk_performance_results
push_data_to_chipmunk_docs:
name: Move benchmark data to chipmunk-docs repository
needs: invoke_jasmine_tests
runs-on: self-hosted-runner-ubuntu
steps:
- name: Checkout chipmunk-docs repository
uses: actions/checkout@v2
with:
repository: esrlabs/chipmunk-docs
path: './chipmunk-docs'
token: ${{ secrets.DOCS_PUSH_TOKEN }}
- name: Push benchmark data
working-directory: ./chipmunk-docs
run: |
git config user.name "esrlabs"
git config user.email "[email protected]"
git remote set-url origin "https://esrlabs:${{secrets.DOCS_PUSH_TOKEN}}@github.com/esrlabs/chipmunk-docs"
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
cp /chipmunk/chipmunk_performance_results/Benchmark_PR_${{ github.event.inputs.pr_id }}.json ./jekyll/benchmarks/data/pull_request/
git add ./jekyll/benchmarks/data/pull_request/Benchmark_PR_${{ github.event.inputs.pr_id }}.json
git commit -m "Adding PR benchmark results for chipmunk PR #${{ github.event.inputs.pr_id }}"
else
cp /chipmunk/chipmunk_performance_results/data.json ./jekyll/benchmarks/data/data.json
git add ./jekyll/benchmarks/data/data.json
git commit -m "Updating data.json for latest tag"
fi
git push origin master
# name: Benchmarks
# on:
# workflow_dispatch:
# inputs:
# pr_id:
# description: 'Pull Request number'
# required: true
# default: ''
# workflow_run:
# workflows: ["BuildAndReleaseMaster"]
# types:
# - completed
# jobs:
# invoke_jasmine_tests:
# name: Invoke Jasmine performance tests
# runs-on: self-hosted-runner-ubuntu
# steps:
# - name: 'Cleanup build folder'
# run: |
# ls -la ./
# rm -rf ./* || true
# rm -rf ./.??* || true
# ls -la ./
# - name: Checkout
# uses: actions/checkout@v3
# - name: Install pre-requisite dependencies
# run: |
# sudo apt-get update && sudo apt-get install -y gconf-service libgbm-dev libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release xdg-utils wget ca-certificates
# sudo apt-get install -y libudev-dev cargo npm imagemagick libmagickwand-dev cmake jq
# - name: install node
# uses: actions/setup-node@v4
# with:
# node-version: 22.4.0
# - name: Install ruby and other related tools
# run: |
# whoami
# npm install -g corepack
# corepack enable
# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# apt-get update
# sudo apt-get install -y yarn
# yarn --version
# apt update
# apt-get install -y software-properties-common
# apt-add-repository -y ppa:rael-gc/rvm
# apt-get update
# apt-get install -y rvm
# echo 'source "/etc/profile.d/rvm.sh"' >> ~/.bashrc
# source /etc/profile.d/rvm.sh
# which rvm
# rvm install ruby-3.1.2
# ruby --version
# sudo chown -R $(whoami) /usr/local
# rvm use 3.1.2 --default
# rvm --version
# rvm info
# which rvm
# ruby --version
# - name: cargo install nj-cli
# run: |
# cargo install nj-cli --locked
# cargo install wasm-pack --locked
# - name: Prepare environment
# run: |
# npm i -g tslib
# export PATH="/usr/share/rvm:$PATH"
# which ruby
# ruby --version
# pwd
# gem install dotenv json octokit tmpdir fileutils
# - name: Get PR details
# if: github.event_name == 'workflow_dispatch'
# uses: actions/github-script@v7
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# script: |
# const fs = require('fs');
# const pr = await github.rest.pulls.get({
# owner: 'esrlabs',
# repo: 'chipmunk',
# pull_number: ${{ github.event.inputs.pr_id }}
# });
# const PR_OWNER = pr.data.user.login;
# const PR_REPO = pr.data.base.repo.name;
# console.log(`owner is ${PR_OWNER}`);
# console.log(`repo is ${PR_REPO}`);
# // Setting environment variables
# fs.appendFileSync(process.env.GITHUB_ENV, `PR_OWNER=${PR_OWNER}\n`);
# fs.appendFileSync(process.env.GITHUB_ENV, `PR_REPO=${PR_REPO}\n`);
# - name: Run Jasmine performance tests for the latest release
# if: github.event_name != 'workflow_dispatch'
# run: |
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# export PATH="/root/.cargo/bin:$PATH"
# . "/root/.cargo/env"
# source ~/.bashrc
# ruby scripts/tools/run_benchmarks.rb 1
# env:
# REPO_OWNER: 'esrlabs'
# REPO_NAME: 'chipmunk'
# - name: Run Jasmine performance tests for the latest pull request
# if: github.event_name == 'workflow_dispatch'
# run: |
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# export PATH="/root/.cargo/bin:$PATH"
# . "/root/.cargo/env"
# source ~/.bashrc
# echo "PR head repo: ${{ env.PR_OWNER }}"
# echo "PR head owner: ${{ env.PR_REPO }}"
# pwd
# ls -la
# ruby scripts/tools/run_benchmarks.rb PR~${{ github.event.inputs.pr_id }}
# env:
# REPO_NAME: ${{ env.PR_REPO }}
# REPO_OWNER: ${{ env.PR_OWNER }}
# - name: List files in the results folder
# run: |
# echo "Event is: ${{ github.event_name }}"
# ls -la /chipmunk/chipmunk_performance_results
# push_data_to_chipmunk_docs:
# name: Move benchmark data to chipmunk-docs repository
# needs: invoke_jasmine_tests
# runs-on: self-hosted-runner-ubuntu
# steps:
# - name: Checkout chipmunk-docs repository
# uses: actions/checkout@v2
# with:
# repository: esrlabs/chipmunk-docs
# path: './chipmunk-docs'
# token: ${{secrets.DOCS_PUSH_TOKEN}}
# - name: Push tag for release
# working-directory: ./chipmunk-docs
# if: github.event_name != 'workflow_dispatch'
# run: |
# ls -la
# cp /chipmunk/chipmunk_performance_results/data.json ./jekyll/benchmarks/data/data.json
# git config user.name "esrlabs"
# git config user.email "[email protected]"
# git remote set-url origin "https://esrlabs:${{secrets.DOCS_PUSH_TOKEN}}@github.com/esrlabs/chipmunk-docs"
# git add ./jekyll/benchmarks/data/data.json
# git commit -m "Updating data.json for latest tag"
# git push origin master
# - name: Push PR data to chipmunk-docs
# working-directory: ./chipmunk-docs
# if: github.event_name == 'workflow_dispatch'
# run: |
# ls -la
# cp /chipmunk/chipmunk_performance_results/Benchmark_PR_${{ github.event.inputs.pr_id }}.json ./jekyll/benchmarks/data/pull_request/Benchmark_PR_${{ github.event.inputs.pr_id }}.json
# git config user.name "esrlabs"
# git config user.email "[email protected]"
# git remote set-url origin "https://esrlabs:${{secrets.DOCS_PUSH_TOKEN}}@github.com/esrlabs/chipmunk-docs"
# git add ./jekyll/benchmarks/data/pull_request/Benchmark_PR_${{ github.event.inputs.pr_id }}.json
# git commit -m "Adding PR benchmark results for chipmunk PR # ${{ github.event.inputs.pr_id }}"
# git push origin master