forked from maplibre/maplibre-native
-
Notifications
You must be signed in to change notification settings - Fork 0
195 lines (168 loc) · 6.91 KB
/
pr-linux-tests.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
# Runs Bloaty (size test) and Google Benchmark and reports results on PR
name: pr-linux-tests
on:
workflow_run:
workflows: [linux-ci]
types:
- completed
env:
download_url: https://maplibre-native.s3.eu-central-1.amazonaws.com
legacy_maplibre_sha: d38709084a9865fe0bb8300aec70ebf8243b3d43
bloaty_sha: 8be8b448550b37c978e8defd9d421c0464c52cc7
permissions:
pull-requests: write
id-token: write # This is required for requesting the AWS JWT
jobs:
pre_job:
if: github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.check_skip.outputs.should_skip }}
steps:
- id: check_skip
run: |
conclusion=$(curl ${{ github.event.workflow_run.jobs_url }} | jq -r '.jobs[] | select(.name == "linux-build-and-test").conclusion')
should_skip=$([[ "$conclusion" = "skipped" || "$conclusion" = "cancelled" ]] && echo "true" || echo "false")
echo "should_skip=$should_skip" >> "$GITHUB_OUTPUT"
pr-bloaty:
needs: pre_job
if: needs.pre_job.outputs.should_skip == 'false'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/get-pr-number
id: get-pr-number
- uses: ./.github/actions/download-workflow-run-artifact
with:
artifact-name: mbgl-render
expect-files: "mbgl-render"
- name: Download mbgl-render-main
run: wget -O mbgl-render-main "${download_url}/mbgl-render-main"
- name: Download mbgl-render-legacy
id: download-mbgl-render-legacy
run: wget -O mbgl-render-legacy "${download_url}/mbgl-render-${legacy_maplibre_sha}"
continue-on-error: true
- name: Get latest CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: latest
ninjaVersion: latest
- name: Cache Bloaty
id: cache-bloaty
uses: actions/cache@v4
with:
path: bloaty/build/bloaty
key: bloaty-${{ env.bloaty_sha }}
# because Google is not making a release...
# https://github.com/google/bloaty/issues/334
- name: Compile Bloaty
if: ${{ !steps.cache-bloaty.outputs.cache-hit }}
run: |
git clone https://github.com/google/bloaty.git
cd bloaty
git checkout "$bloaty_sha"
cmake -B build -G Ninja -S .
cmake --build build
- name: Run Bloaty McBloatface on main
run: bloaty/build/bloaty mbgl-render -- mbgl-render-main -n 0 -s vm -d compileunits > tlus_diff_main.txt
- name: Run Bloaty McBloatface on legacy
if: steps.download-mbgl-render-legacy.outcome == 'success'
run: bloaty/build/bloaty mbgl-render -- mbgl-render-legacy -n 0 -s vm -d compileunits > tlus_diff_legacy.txt
- name: Configure AWS Credentials
if: github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ github.run_id }}
- name: Prepare Bloaty message (main)
run: |
report_path=bloaty-results/pr-${{ steps.get-pr-number.outputs.pr-number }}-compared-to-main.txt
aws s3 cp tlus_diff_main.txt s3://maplibre-native/"$report_path"
{
echo "# Bloaty Results 🐋"
echo 'Compared to main'
echo '```'
awk 'NR <= 2; END { print }' tlus_diff_main.txt
echo '```'
echo "Full report: $download_url/$report_path"
echo "---"
} >> message.md
- name: Prepare Bloaty message (legacy)
run: |
report_path=bloaty-results/pr-${{ steps.get-pr-number.outputs.pr-number }}-compared-to-legacy.txt
aws s3 cp tlus_diff_legacy.txt s3://maplibre-native/"$report_path"
{
echo "Compared to $legacy_maplibre_sha (legacy)"
echo '```'
awk 'NR <= 2; END { print }' tlus_diff_legacy.txt
echo '```'
echo "Full report: $download_url/$report_path"
} >> message.md
- name: Leave a comment with Bloaty results
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ steps.get-pr-number.outputs.pr-number }}
header: bloaty
path: message.md
pr-benchmark:
needs: pre_job
if: needs.pre_job.outputs.should_skip == 'false'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/get-pr-number
id: get-pr-number
- uses: ./.github/actions/download-workflow-run-artifact
with:
artifact-name: mbgl-benchmark-runner
expect-files: "mbgl-benchmark-runner"
- name: Download mbgl-benchmark-runner-main, set permissions
run: |
wget -O mbgl-benchmark-runner-main "${download_url}/mbgl-benchmark-runner-main"
chmod +x mbgl-benchmark-runner-main mbgl-benchmark-runner
# needed for compare.py
- name: Install scipy
run: pip3 install scipy
# not sure which one of these are runtime dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libcurl4-openssl-dev \
libuv1-dev \
libjpeg-dev \
libpng-dev \
libglfw3-dev \
libwebp-dev \
libopengl0
- name: Run Benchmarks
# excluding the API tests because they hang https://github.com/maplibre/maplibre-native/issues/1808
run: python3 vendor/benchmark/tools/compare.py --no-color benchmarks ./mbgl-benchmark-runner-main ./mbgl-benchmark-runner --benchmark_filter='^[^A][^P][^I].*' > benchmark_out.txt
- name: Configure AWS Credentials
if: github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ github.run_id }}
- name: Prepare Benchmark message
run: |
sed -n '/Comparing/,$p' benchmark_out.txt | tail -n +2 > benchmark_diff.txt
report_path=benchmark-results/pr-${{ steps.get-pr-number.outputs.pr-number }}-compared-to-main.txt
aws s3 cp benchmark_diff.txt s3://maplibre-native/"$report_path"
{
echo "Benchmark Results ⚡"
echo '```'
awk 'NR <= 2; END { print }' benchmark_diff.txt
echo '```'
echo "Full report: $download_url/$report_path"
} >> message.md
- name: Leave a comment with Benchmark results
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ steps.get-pr-number.outputs.pr-number }}
header: benchmark
path: message.md