-
Notifications
You must be signed in to change notification settings - Fork 19
257 lines (247 loc) · 9.71 KB
/
Copy pathci.yml
File metadata and controls
257 lines (247 loc) · 9.71 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
# Cancel superseded runs on the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
defaults:
run:
shell: bash
env:
# Headless OpenGL EGL: render without an X server / display surface, and force
# the llvmpipe software rasterizer (CI runners have no GPU). Harmless for the
# other backends.
EGL_PLATFORM: surfaceless
LIBGL_ALWAYS_SOFTWARE: "1"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
submodules: true
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- if: github.event_name == 'pull_request'
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
max-size: 2G
- if: github.event_name == 'pull_request'
run: echo "MLN_CMAKE_CXX_LAUNCHER=ccache" >> $GITHUB_ENV
- run: echo "MLN_PRECOMPILE=0" >> $GITHUB_ENV
- run: echo "MLN_CORE_LIBRARY_USE_AMALGAM=0" >> $GITHUB_ENV
- run: rustup update stable && rustup default stable && rustup component add rustfmt && rustup component add clippy
- uses: taiki-e/install-action@bffeee26d4db9be238a4ea78d8826604ebcb594d # v2.82.5
with: { tool: "just" }
- run: just env-info install-dependencies 'vulkan'
- run: just ci-lint
slint-example:
name: Build slint example ${{ matrix.runs-on }} - ${{ matrix.backend }} - Precompiled ${{ matrix.precompiled }}
runs-on: ${{ matrix.runs-on }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
# Linux x86
- runs-on: ubuntu-latest
precompiled: 0
amalgam: 0
# Linux ARM
- runs-on: ubuntu-24.04-arm
precompiled: 0
amalgam: 0
# macOS ARM
- runs-on: macos-latest
precompiled: 0
amalgam: 0
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
submodules: true
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- uses: taiki-e/install-action@bffeee26d4db9be238a4ea78d8826604ebcb594d # v2.82.5
with: { tool: "just" }
- run: echo "MLN_PRECOMPILE=${{ matrix.precompiled }}" >> $GITHUB_ENV
- run: echo "MLN_CORE_LIBRARY_USE_AMALGAM=${{ matrix.amalgam }}" >> $GITHUB_ENV
- run: just env-info install-dependencies 'wgpu'
- run: rustup update stable && rustup default stable
- name: Build Slint example
run: just build-example_slint
test:
name: Test ${{ matrix.runs-on }} - ${{ matrix.backend }} - Precompiled ${{ matrix.precompiled }}
runs-on: ${{ matrix.runs-on }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
# Linux x86
- runs-on: ubuntu-latest
backend: vulkan
precompiled: 0
amalgam: 0
- runs-on: ubuntu-latest
backend: glx
precompiled: 0
amalgam: 0
- runs-on: ubuntu-latest
backend: vulkan
precompiled: 1 # also cover the prebuilt amalgam path
amalgam: 1
- runs-on: ubuntu-latest
backend: opengl
precompiled: 0
amalgam: 0
# Linux ARM
- runs-on: ubuntu-24.04-arm
backend: vulkan
precompiled: 0
amalgam: 0
# macOS ARM
- runs-on: macos-latest
backend: metal
precompiled: 0
amalgam: 0
- runs-on: macos-latest
backend: vulkan
precompiled: 0
amalgam: 0
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
submodules: true
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- if: github.event_name == 'pull_request'
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
max-size: 2G
- if: github.event_name == 'pull_request'
run: echo "MLN_CMAKE_CXX_LAUNCHER=ccache" >> $GITHUB_ENV
- uses: taiki-e/install-action@bffeee26d4db9be238a4ea78d8826604ebcb594d # v2.82.5
with: { tool: "just" }
- run: echo "MLN_PRECOMPILE=${{ matrix.precompiled }}" >> $GITHUB_ENV
- run: echo "MLN_CORE_LIBRARY_USE_AMALGAM=${{ matrix.amalgam }}" >> $GITHUB_ENV
- run: just env-info install-dependencies '${{ matrix.backend }}'
- if: startsWith(matrix.runs-on, 'macos') && matrix.backend == 'vulkan'
run: |
echo "VK_ICD_FILENAMES=$(brew --prefix molten-vk)/etc/vulkan/icd.d/MoltenVK_icd.json" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$(brew --prefix vulkan-loader)/lib" >> $GITHUB_ENV
- run: rustup update stable && rustup default stable
- name: Run CI tests (Linux OpenGL GLX via Xvfb)
if: startsWith(matrix.runs-on, 'ubuntu') && matrix.backend == 'glx'
run: xvfb-run -a --server-args="-screen 0 1280x1024x24" just ci-test ${{ matrix.backend }}
- name: Run CI tests
if: ${{ !(startsWith(matrix.runs-on, 'ubuntu') && matrix.backend == 'glx') }}
run: just ci-test ${{ matrix.backend }}
build-msrv:
name: Build MSRV ${{ matrix.runs-on }} - ${{ matrix.backend }}
runs-on: ${{ matrix.runs-on }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
# MSRV mainly checks Rust/toolchain compatibility.
# Backend-specific behavior is covered by the stable jobs above, so
# one Linux leg and one macOS leg are enough to cover build.rs target_os branches.
- runs-on: ubuntu-latest
backend: vulkan
precompiled: 0
amalgam: 0
- runs-on: macos-latest
backend: metal
precompiled: 0
amalgam: 0
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
submodules: true
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- if: github.event_name == 'pull_request'
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
max-size: 2G
- if: github.event_name == 'pull_request'
run: echo "MLN_CMAKE_CXX_LAUNCHER=ccache" >> $GITHUB_ENV
- uses: taiki-e/install-action@bffeee26d4db9be238a4ea78d8826604ebcb594d # v2.82.5
with: { tool: "just" }
- run: echo "MLN_PRECOMPILE=${{ matrix.precompiled }}" >> $GITHUB_ENV
- run: echo "MLN_CORE_LIBRARY_USE_AMALGAM=${{ matrix.amalgam }}" >> $GITHUB_ENV
- run: just env-info install-dependencies '${{ matrix.backend }}'
- name: Read MSRV
id: msrv
run: echo "value=$(just get-msrv)" >> $GITHUB_OUTPUT
- name: Install MSRV Rust ${{ steps.msrv.outputs.value }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.msrv.outputs.value }}
- name: Build with MSRV
run: just ci_mode=0 build-msrv ${{ matrix.backend }} # Ignore warnings in MSRV
# This final step is needed to mark the whole workflow as successful
# Don't change its name - it is used by the merge protection rules
ci-passed:
needs: [lint, test, build-msrv, slint-example]
if: always()
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Result of the needed steps
run: echo "${{ toJSON(needs) }}"
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
# Release unpublished packages or create a PR with changes
release-plz:
needs: [ci-passed]
if: |
always()
&& needs.ci-passed.result == 'success'
&& github.event_name == 'push'
&& github.ref == 'refs/heads/main'
&& github.repository_owner == 'maplibre'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
env:
MLN_PRECOMPILE: 1
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
submodules: true
- uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io if crate's version is newer
uses: release-plz/action@e8792575c7f2366cf6ff3ccc33ead9ace5b691c7 # v0.5.130
id: release
with: { command: release }
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ steps.release.outputs.releases_created == 'false' }}
name: If version is the same, create a PR proposing new version and changelog for the next release
uses: release-plz/action@e8792575c7f2366cf6ff3ccc33ead9ace5b691c7 # v0.5.130
with: { command: release-pr }
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}