Files @ r28810:dd35d3d734ac
Branch filter:

Location: cpp/openttd-patchpack/source/.github/workflows/ci-build.yml - annotation

Peter Nelson
Fix d3c673e: Don't defer OnResize() after ReInit() (#12174)

Some windows resize themselves during painting and issue ReInit(). In this case deferred OnResize() causes a visible glitch as the event is handled on the next redraw.
  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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r26925:5ef943cec524
r26925:5ef943cec524
r26925:5ef943cec524
r26925:5ef943cec524
r24360:dda0f5874870
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r27709:13454adf22b6
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r28566:ec28e66fe6ee
r24439:3207de2680bf
r24439:3207de2680bf
r28566:ec28e66fe6ee
r24439:3207de2680bf
r24439:3207de2680bf
r27709:13454adf22b6
r26007:20bc49d0c3a9
r27904:73387ac1bea0
r26007:20bc49d0c3a9
r26007:20bc49d0c3a9
r26007:20bc49d0c3a9
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24938:c6d347f5a77a
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r24439:3207de2680bf
r27225:76d4bd86222b
r24439:3207de2680bf
r24439:3207de2680bf
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r27931:508a5c43327c
r28491:779a44bc4e9e
r28491:779a44bc4e9e
r27838:c23d9a6f3b9d
r27931:508a5c43327c
r28491:779a44bc4e9e
r28491:779a44bc4e9e
r27931:508a5c43327c
r27931:508a5c43327c
r27178:0b71cae1d77a
r27178:0b71cae1d77a
r24843:4999a1a6d9d8
r27838:c23d9a6f3b9d
r27178:0b71cae1d77a
r27178:0b71cae1d77a
r24843:4999a1a6d9d8
r27838:c23d9a6f3b9d
r27178:0b71cae1d77a
r27178:0b71cae1d77a
r24991:5b5476d39783
r28246:1a1aea5b33dc
r27282:08934aac09a5
r27838:c23d9a6f3b9d
r27178:0b71cae1d77a
r27178:0b71cae1d77a
r24424:844a9c7b4a2a
r28357:3c08572ba8e3
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24424:844a9c7b4a2a
r28566:ec28e66fe6ee
r24424:844a9c7b4a2a
r28360:bb1633c75235
r28566:ec28e66fe6ee
r28360:bb1633c75235
r28360:bb1633c75235
r28360:bb1633c75235
r28360:bb1633c75235
r28360:bb1633c75235
r28360:bb1633c75235
r24360:dda0f5874870
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24370:1d3dc6fcc807
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24840:38cda9f655b2
r26874:065b6bc49f35
r24360:dda0f5874870
r27221:3735cc2cef6b
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r27178:0b71cae1d77a
r24360:dda0f5874870
r24360:dda0f5874870
r27813:6b3a5970aa1b
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24424:844a9c7b4a2a
r27813:6b3a5970aa1b
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24938:c6d347f5a77a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24360:dda0f5874870
r24424:844a9c7b4a2a
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r24360:dda0f5874870
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28361:99a1cc03aea0
r28246:1a1aea5b33dc
r28246:1a1aea5b33dc
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r27178:0b71cae1d77a
r27178:0b71cae1d77a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r26654:c80753c09a6b
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r28566:ec28e66fe6ee
r24360:dda0f5874870
r28360:bb1633c75235
r28566:ec28e66fe6ee
r24424:844a9c7b4a2a
r28360:bb1633c75235
r28360:bb1633c75235
r28360:bb1633c75235
r28360:bb1633c75235
r24935:7306ae8fb1af
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r27323:b52577d1ca25
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r27323:b52577d1ca25
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24938:c6d347f5a77a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r25342:e23bc12c103b
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r26191:130915d6fd43
r24749:3150af924c26
r24424:844a9c7b4a2a
r27178:0b71cae1d77a
r27178:0b71cae1d77a
r24749:3150af924c26
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r28566:ec28e66fe6ee
r24424:844a9c7b4a2a
r28360:bb1633c75235
r28566:ec28e66fe6ee
r24360:dda0f5874870
r28360:bb1633c75235
r28360:bb1633c75235
r28360:bb1633c75235
r28360:bb1633c75235
r24935:7306ae8fb1af
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24360:dda0f5874870
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24424:844a9c7b4a2a
r24934:fc42440e6f82
r24934:fc42440e6f82
r24424:844a9c7b4a2a
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r27323:b52577d1ca25
r27323:b52577d1ca25
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24934:fc42440e6f82
r24360:dda0f5874870
r24360:dda0f5874870
r24424:844a9c7b4a2a
r24360:dda0f5874870
r27323:b52577d1ca25
r25342:e23bc12c103b
r25426:c16276cd8dc0
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r27178:0b71cae1d77a
r27178:0b71cae1d77a
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r28566:ec28e66fe6ee
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25658:b9fea6f599e0
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r27323:b52577d1ca25
r27323:b52577d1ca25
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r27323:b52577d1ca25
r27323:b52577d1ca25
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r27323:b52577d1ca25
r27323:b52577d1ca25
r27323:b52577d1ca25
r27323:b52577d1ca25
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r27323:b52577d1ca25
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r25637:b1d39954f0ec
r27323:b52577d1ca25
r25637:b1d39954f0ec
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r25637:b1d39954f0ec
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r25500:776475f473b8
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r25426:c16276cd8dc0
r28566:ec28e66fe6ee
name: CI

on:
  pull_request:
  push:
    branches:
    - master

env:
  CTEST_OUTPUT_ON_FAILURE: 1

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
  emscripten:
    name: Emscripten

    runs-on: ubuntu-20.04
    container:
      # If you change this version, change the number in the cache step too.
      image: emscripten/emsdk:3.1.42

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Setup cache
      uses: actions/cache@v4
      with:
        path: /emsdk/upstream/emscripten/cache
        key: 3.1.42-${{ runner.os }}

    - name: Patch Emscripten to support LZMA
      run: |
        cd /emsdk/upstream/emscripten
        patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-liblzma.patch

    - name: Build (host tools)
      run: |
        mkdir build-host
        cd build-host

        echo "::group::CMake"
        cmake .. -DOPTION_TOOLS_ONLY=ON
        echo "::endgroup::"

        echo "::group::Build"
        echo "Running on $(nproc) cores"
        cmake --build . -j $(nproc) --target tools
        echo "::endgroup::"

    - name: Install GCC problem matcher
      uses: ammaraskar/gcc-problem-matcher@master

    - name: Build
      run: |
        mkdir build
        cd build

        echo "::group::CMake"
        emcmake cmake .. -DHOST_BINARY_DIR=../build-host
        echo "::endgroup::"

        echo "::group::Build"
        echo "Running on $(nproc) cores"
        cmake --build . -j $(nproc) --target openttd
        echo "::endgroup::"

  linux:
    strategy:
      fail-fast: false
      matrix:
        include:
        - name: Clang - Debug
          compiler: clang-15
          cxxcompiler: clang++-15
          libraries: libsdl2-dev
        - name: Clang - Release
          compiler: clang-15
          cxxcompiler: clang++-15
          libraries: libsdl2-dev
          extra-cmake-parameters: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF
        - name: GCC - SDL2
          compiler: gcc
          cxxcompiler: g++
          libraries: libsdl2-dev
        - name: GCC - SDL1.2
          compiler: gcc
          cxxcompiler: g++
          libraries: libsdl1.2-dev
        - name: GCC - Dedicated
          compiler: gcc
          cxxcompiler: g++
          libraries: grfcodec
          extra-cmake-parameters: -DOPTION_DEDICATED=ON -DCMAKE_CXX_FLAGS_INIT="-DRANDOM_DEBUG" -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
          # Compile without SDL / SDL2, as that should compile fine too.

    name: Linux (${{ matrix.name }})

    runs-on: ubuntu-latest
    env:
      CC: ${{ matrix.compiler }}
      CXX: ${{ matrix.cxxcompiler }}

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Setup vcpkg caching
      uses: actions/github-script@v7
      with:
        script: |
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')

    - name: Install dependencies
      run: |
        echo "::group::Update apt"
        sudo apt-get update
        echo "::endgroup::"

        echo "::group::Install dependencies"
        sudo apt-get install -y --no-install-recommends \
          liballegro4-dev \
          libcurl4-openssl-dev \
          libfontconfig-dev \
          libharfbuzz-dev \
          libicu-dev \
          liblzma-dev \
          liblzo2-dev \
          ${{ matrix.libraries }} \
          zlib1g-dev \
          # EOF

        echo "::group::Install vcpkg dependencies"

        # Disable vcpkg integration, as we mostly use system libraries.
        mv vcpkg.json vcpkg-disabled.json

        # We only use breakpad from vcpkg, as its CMake files
        # are a bit special. So the Ubuntu's variant doesn't work.
        vcpkg install breakpad

        echo "::endgroup::"
      env:
        DEBIAN_FRONTEND: noninteractive

    - name: Get OpenGFX
      run: |
        mkdir -p ~/.local/share/openttd/baseset
        cd ~/.local/share/openttd/baseset

        echo "::group::Download OpenGFX"
        curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
        echo "::endgroup::"

        echo "::group::Unpack OpenGFX"
        unzip opengfx-all.zip
        echo "::endgroup::"

        rm -f opengfx-all.zip

    - name: Install GCC problem matcher
      uses: ammaraskar/gcc-problem-matcher@master

    - name: Build
      run: |
        mkdir build
        cd build

        echo "::group::CMake"
        cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ${{ matrix.extra-cmake-parameters }}
        echo "::endgroup::"

        echo "::group::Build"
        echo "Running on $(nproc) cores"
        cmake --build . -j $(nproc)
        echo "::endgroup::"

    - name: Test
      run: |
        (
          cd build
          ctest -j $(nproc) --timeout 120
        )

        # Re-enable vcpkg.
        mv vcpkg-disabled.json vcpkg.json

        # Check no tracked files have been modified.
        git diff --exit-code

  macos:
    strategy:
      fail-fast: false
      matrix:
        include:
        - arch: x64
          full_arch: x86_64

    name: Mac OS (${{ matrix.arch }})

    runs-on: macos-latest
    env:
      MACOSX_DEPLOYMENT_TARGET: 10.13

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Setup vcpkg caching
      uses: actions/github-script@v7
      with:
        script: |
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')

    - name: Install OpenGFX
      run: |
        mkdir -p ~/Documents/OpenTTD/baseset
        cd ~/Documents/OpenTTD/baseset

        echo "::group::Download OpenGFX"
        curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
        echo "::endgroup::"

        echo "::group::Unpack OpenGFX"
        unzip opengfx-all.zip
        echo "::endgroup::"

        rm -f opengfx-all.zip

    - name: Install GCC problem matcher
      uses: ammaraskar/gcc-problem-matcher@master

    - name: Build
      run: |
        mkdir build
        cd build

        echo "::group::CMake"
        cmake .. \
          -DCMAKE_OSX_ARCHITECTURES=${{ matrix.full_arch }} \
          -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-osx \
          -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
          # EOF
        echo "::endgroup::"

        echo "::group::Build"
        echo "Running on $(sysctl -n hw.logicalcpu) cores"
        cmake --build . -j $(sysctl -n hw.logicalcpu)
        echo "::endgroup::"

    - name: Test
      run: |
        cd build
        ctest -j $(sysctl -n hw.logicalcpu) --timeout 120

  windows:
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, windows-2019]
        arch: [x86, x64]

    name: Windows (${{ matrix.os }} / ${{ matrix.arch }})

    runs-on: ${{ matrix.os }}

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Setup vcpkg caching
      uses: actions/github-script@v7
      with:
        script: |
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')

    - name: Install OpenGFX
      shell: bash
      run: |
        mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
        cd "C:/Users/Public/Documents/OpenTTD/baseset"

        echo "::group::Download OpenGFX"
        curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
        echo "::endgroup::"

        echo "::group::Unpack OpenGFX"
        unzip opengfx-all.zip
        echo "::endgroup::"

        rm -f opengfx-all.zip

    - name: Install MSVC problem matcher
      uses: ammaraskar/msvc-problem-matcher@master

    - name: Configure developer command prompt for ${{ matrix.arch }}
      uses: ilammy/msvc-dev-cmd@v1
      with:
        arch: ${{ matrix.arch }}

    - name: Build
      shell: bash
      env:
        NINJA_STATUS: "[%f/%t -- %e] " # [finished_edges/total_edges -- elapsed_time], default value is "[%f/%t] "
      run: |
        mkdir build
        cd build

        echo "::group::CMake"
        cmake .. \
          -GNinja \
          -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
          -DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
          # EOF
        echo "::endgroup::"

        echo "::group::Build"
        cmake --build .
        echo "::endgroup::"

    - name: Test
      shell: bash
      run: |
        cd build
        ctest --timeout 120


  msys2:
    strategy:
      fail-fast: false
      matrix:
        include:
          - msystem: MINGW64
            arch: x86_64
          - msystem: MINGW32
            arch: i686

    name: MinGW (${{ matrix.arch }})

    runs-on: windows-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Setup MSYS2
      uses: msys2/setup-msys2@v2
      with:
        msystem: ${{ matrix.msystem }}
        release: false
        install: >-
          git
          make
          mingw-w64-${{ matrix.arch }}-cmake
          mingw-w64-${{ matrix.arch }}-gcc
          mingw-w64-${{ matrix.arch }}-lzo2
          mingw-w64-${{ matrix.arch }}-libpng
          mingw-w64-${{ matrix.arch }}-lld
          mingw-w64-${{ matrix.arch }}-ninja

    - name: Install OpenGFX
      shell: bash
      run: |
        mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
        cd "C:/Users/Public/Documents/OpenTTD/baseset"

        echo "::group::Download OpenGFX"
        curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
        echo "::endgroup::"

        echo "::group::Unpack OpenGFX"
        unzip opengfx-all.zip
        echo "::endgroup::"

        rm -f opengfx-all.zip

    - name: Install GCC problem matcher
      uses: ammaraskar/gcc-problem-matcher@master

    - name: Build
      shell: msys2 {0}
      env:
        NINJA_STATUS: "[%f/%t -- %e] " # [finished_edges/total_edges -- elapsed_time], default value is "[%f/%t] "
      run: |
        mkdir build
        cd build

        echo "::group::CMake"
        cmake .. \
          -GNinja \
          -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \
          # EOF
        echo "::endgroup::"

        echo "::group::Build"
        cmake --build .
        echo "::endgroup::"

    - name: Test
      shell: msys2 {0}
      run: |
        cd build
        ctest --timeout 120

  check_annotations:
    name: Check Annotations
    needs:
    - emscripten
    - linux
    - macos
    - windows
    - msys2

    if: always() && github.event_name == 'pull_request'

    runs-on: ubuntu-latest

    steps:
    - name: Check annotations
      uses: OpenTTD/actions/annotation-check@v5