-
-
Notifications
You must be signed in to change notification settings - Fork 561
259 lines (212 loc) · 8.92 KB
/
Copy pathlinux-ci.yml
File metadata and controls
259 lines (212 loc) · 8.92 KB
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
name: linux-ci
on:
workflow_dispatch:
push:
branches:
- main
- linux-*.*.x
tags:
- linux-*
pull_request:
branches:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# INFO: We are cancelling the concurrency group if the change is on PR. For workflow dispatch, this will not work.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
id-token: write # needed for AWS
actions: read # needed for CodeQL
contents: read # needed for CodeQL
security-events: write # needed for CodeQL
env:
EGL_PLATFORM: surfaceless
jobs:
pre_job:
runs-on: ubuntu-24.04
outputs:
should_skip: ${{ github.event_name != 'workflow_dispatch' && steps.changed-files.outputs.linux_any_modified != 'true' }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
persist-credentials: false
- name: Get all Linux files that have changed
if: github.event_name != 'workflow_dispatch'
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files_yaml_from_source_file: .github/changed-files.yml
- name: List changed files
if: steps.changed-files.outputs.linux_any_modified == 'true'
run: |
echo "Changed file(s): ${{ steps.changed-files.outputs.linux_all_changed_files }}"
linux-build-and-test:
if: needs.pre_job.outputs.should_skip != 'true'
needs: pre_job
strategy:
fail-fast: true
matrix:
variant:
- renderer: vulkan
rust: false
- renderer: opengl
rust: false
- renderer: opengl
rust: true
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
with:
languages: cpp
- name: Install dependencies
run: .github/scripts/install-linux-deps
- uses: taiki-e/install-action@07b4745e0c39a41822af610387492e3e53aa222b # v2.83.4
with:
tool: armerge@2
- if: matrix.variant.rust
run: cargo install cxxbridge-cmd --version 1.0.157 --locked
- name: Install ctcache
run: |
# pending open PR https://github.com/matus-chochlik/ctcache/pull/94
git clone https://github.com/louwers/ctcache.git
cd ctcache
cd ..
mv ctcache /usr/local/bin
- name: Configure sccache
uses: ./.github/actions/configure-sccache-s3
with:
vars: ${{ toJSON(vars) }}
- name: Build MapLibre Native
env:
CI: 1
run: |
cmake --version
# ctcache configuration
export CTCACHE_HOST=34.229.50.221
export CTCACHE_PORT=5000
export CTCACHE_PROTO=http
if [ -n "${{ secrets.CTCACHE_AUTH_KEY }}" ]; then
echo "setting CTCACHE_AUTH_KEY"
export CTCACHE_AUTH_KEY=${{ secrets.CTCACHE_AUTH_KEY }}
else
# do not write to cache if CTCACHE_AUTH_KEY not set
export CTCACHE_HOST_READ_ONLY=1
fi
cmake --preset linux-${{ matrix.variant.renderer }} \
-DMLN_WITH_CLANG_TIDY=ON \
-DCLANG_TIDY_COMMAND=/usr/local/bin/ctcache/clang-tidy \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DMLN_WITH_COVERAGE=ON
cmake --build build-linux-${{ matrix.variant.renderer }} --target mbgl-core mbgl-test-runner mbgl-render-test-runner mbgl-expression-test mbgl-render mbgl-benchmark-runner
# mbgl-render (used for size test) & mbgl-benchmark-runner
- name: Show sccache stats
run: sccache --show-stats
- name: Upload mbgl-render as artifact
if: matrix.variant.renderer == 'opengl' && !matrix.variant.rust && github.event_name == 'pull_request'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: mbgl-render
path: |
build-linux-${{ matrix.variant.renderer }}/bin/mbgl-render
- name: Upload mbgl-benchmark-runner as artifact
if: matrix.variant.renderer == 'opengl' && !matrix.variant.rust && github.event_name == 'pull_request'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: mbgl-benchmark-runner
path: |
build-linux-${{ matrix.variant.renderer }}/mbgl-benchmark-runner
- name: Upload mbgl-render & mbgl-benchmark-runner to S3
if: matrix.variant.renderer == 'opengl' && !matrix.variant.rust && github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME
run: |
aws s3 cp build-linux-${{ matrix.variant.renderer }}/bin/mbgl-render s3://maplibre-native/mbgl-render-main
aws s3 cp build-linux-${{ matrix.variant.renderer }}/mbgl-benchmark-runner s3://maplibre-native/mbgl-benchmark-runner-main
# CodeQL
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
with:
category: "/language:cpp"
# unit tests
- run: chmod +x build-linux-${{ matrix.variant.renderer }}/mbgl-test-runner
- name: Run C++ tests
continue-on-error: ${{ matrix.variant.renderer == 'vulkan' }}
run: xvfb-run -a build-linux-${{ matrix.variant.renderer }}/mbgl-test-runner
# render tests
- run: chmod +x build-linux-${{ matrix.variant.renderer }}/mbgl-render-test-runner
- name: Run render test
id: render_test
run: |
renderer="${{ matrix.variant.renderer }}"
if [[ "$renderer" == *-rust ]]; then
renderer=${renderer%-rust}
fi
xvfb-run -a build-linux-${{ matrix.variant.renderer }}/mbgl-render-test-runner --manifestPath=metrics/linux-"$renderer".json
- name: Upload render test result
if: always() && steps.render_test.outcome == 'failure'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: render-test-result-${{ matrix.variant.renderer }}
path: |
metrics/linux-${{ matrix.variant.renderer }}.html
# expression tests
- run: chmod +x build-linux-${{ matrix.variant.renderer }}/expression-test/mbgl-expression-test
- name: Run expression test
run: build-linux-${{ matrix.variant.renderer }}/expression-test/mbgl-expression-test
linux-coverage:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
persist-credentials: false
- name: Install dependencies
run: .github/scripts/install-linux-deps
- name: Cache Bazel
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }}
restore-keys: |
${{ runner.os }}-bazel-
path: ~/.cache/bazel
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
- name: Start server
run: |
npm install
node test/storage/server.js &
- name: Generate coverage report
run: |
xvfb-run -a \
bazel coverage --combined_report=lcov --instrumentation_filter="//:mbgl-core" \
--test_output=errors --local_test_jobs=1 \
--repo_env=GCOV="$PWD/.github/scripts/gcov_wrapper" \
--test_env=DISPLAY --test_env=XAUTHORITY --copt="-DCI_BUILD" \
//test:core //render-test:render-test //expression-test:test --//:renderer=drawable
echo coverage_report="$(bazel info output_path)"/_coverage/_coverage_report.dat >> "$GITHUB_ENV"
- name: Upload coverage report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-report
path: ${{ env.coverage_report }}
linux-ci-result:
name: Linux CI Result
if: needs.pre_job.outputs.should_skip != 'true' && always()
runs-on: ubuntu-24.04
needs:
- pre_job
- linux-build-and-test
- linux-coverage
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- if: github.event_name == 'pull_request'
uses: ./.github/actions/save-pr-number
- name: Mark result as failed
if: needs.linux-build-and-test.result != 'success' || needs.linux-coverage.result != 'success'
run: exit 1