From 0e8e5c0e17b14bec6ac6d35b46fa4a71c51b1074 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 12 Jul 2025 15:05:53 +0200
Subject: [PATCH] ci: updates for windows-latest compatibility
---
.github/actions/setup-ninja/action.yml | 8 ++--
.github/actions/setup-yasm/action.yml | 60 ++++++++++++++++++++++++++
.github/workflows/main.yml | 14 +++---
3 files changed, 71 insertions(+), 11 deletions(-)
create mode 100644 .github/actions/setup-yasm/action.yml
diff --git a/.github/actions/setup-ninja/action.yml b/.github/actions/setup-ninja/action.yml
index b9283598d..690c248cc 100644
--- a/.github/actions/setup-ninja/action.yml
+++ b/.github/actions/setup-ninja/action.yml
@@ -3,7 +3,7 @@ description: 'Download ninja and add it to the PATH environment variable'
inputs:
version:
description: 'Ninja version'
- default: '1.12.1'
+ default: '1.13.1'
runs:
using: 'composite'
steps:
@@ -41,17 +41,17 @@ runs:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
- if: ${{ !steps.cache-restore.outputs.cache-hit }}
+ if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
shell: pwsh
run: |
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Cache ${{ steps.calc.outputs.archive }}'
- if: ${{ !steps.cache-restore.outputs.cache-hit }}
+ if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
uses: actions/cache/save@v4
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- - name: 'Extract libusb'
+ - name: 'Extract ninja'
shell: pwsh
run: |
7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
diff --git a/.github/actions/setup-yasm/action.yml b/.github/actions/setup-yasm/action.yml
new file mode 100644
index 000000000..a962d3c04
--- /dev/null
+++ b/.github/actions/setup-yasm/action.yml
@@ -0,0 +1,60 @@
+# The pre-built yasm binaries are built with an older MSVCRT,
+# which is no longer installed on current Windows images.
+
+name: 'Setup yasm'
+description: 'Build yasm and add it to the PATH environment variable'
+runs:
+ using: 'composite'
+ steps:
+ - name: 'Calculate variables'
+ id: calc
+ shell: sh
+ run: |
+ echo "cache-key=yasm-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
+ - name: 'Restore yasm'
+ id: restore-yasm
+ uses: actions/cache/restore@v4
+ with:
+ path: |
+ ${{ github.workspace }}/yasm
+ key: ${{ steps.calc.outputs.cache-key }}
+ - name: 'Verify cached yasm'
+ if: ${{ steps.restore-yasm.outputs.cache-hit }}
+ shell: pwsh
+ run: |
+ ${{ github.workspace }}\yasm\bin\yasm --help
+ - name: 'Download yasm sources'
+ if: ${{ !steps.restore-yasm.outputs.cache-hit }}
+ uses: actions/checkout@v4
+ with:
+ repository: yasm/yasm
+ path: yasm-src
+ - name: 'Configure, build and install yasm'
+ if: ${{ !steps.restore-yasm.outputs.cache-hit }}
+ shell: pwsh
+ run: |
+ cmake -S yasm-src -B yasm-build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/yasm -DCMAKE_INSTALL_LIBDIR=bin -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
+ cmake --build yasm-build --parallel
+ cmake --install yasm-build
+ - name: 'Verify built yasm'
+ if: ${{ !steps.restore-yasm.outputs.cache-hit }}
+ shell: sh
+ run: |
+ set -e
+ if [ ! -f "yasm/bin/yasm.exe" -a -f "yasm/bin/vsyasm.exe" ]; then
+ cp "yasm/bin/vsyasm.exe" "yasm/bin/yasm.exe"
+ fi
+ yasm/bin/yasm --help
+ - name: 'Cache yasm'
+ if: ${{ !steps.restore-yasm.outputs.cache-hit }}
+ uses: actions/cache/save@v4
+ with:
+ path: |
+ ${{ github.workspace }}/yasm
+ key: ${{ steps.calc.outputs.cache-key }}
+ enableCrossOsArchive: true
+ - name: 'Set output variables'
+ id: final
+ shell: pwsh
+ run: |
+ echo "${{ github.workspace }}/yasm/bin" >> $env:GITHUB_PATH
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 512540522..79765dd1a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
platform:
- - { name: Windows (MSVC+CMake), os: windows-2019, shell: sh, cmake: '-DSDL2MIXER_VENDORED=ON -GNinja', msvc: 1, shared: 1, static: 0 }
+ - { name: Windows (MSVC+CMake), os: windows-latest, shell: sh, cmake: '-DSDL2MIXER_VENDORED=ON -GNinja', msvc: 1, shared: 1, static: 0 }
- { name: Windows (mingw32+autotools), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, shared: 1, static: 1 }
- { name: Windows (mingw64+CMake), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, shared: 1, static: 0,
cmake: '-DSDL2MIXER_VENDORED=OFF -G "Ninja Multi-Config"' }
@@ -94,13 +94,9 @@ jobs:
.github/fetch_sdl_vc.ps1
echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/SDL2-devel-VC" >> $Env:GITHUB_ENV
echo "::endgroup::"
- echo "::group::Downloading yasm"
- .github/fetch_yasm.ps1
- echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
- echo "::endgroup::"
- - name: Setup Ninja for MSVC
+ - name: Set up ninja
+ uses: ./.github/actions/setup-ninja
if: ${{ !contains(matrix.platform.shell, 'msys2') }}
- uses: aseprite/get-ninja@main
- uses: ilammy/msvc-dev-cmd@v1
if: "matrix.platform.msvc"
with:
@@ -111,6 +107,10 @@ jobs:
if: "runner.os == 'Linux' && matrix.platform.cmake"
run: ./build-scripts/test-versioning.sh
+ - name: Set up yasm for mpg123 (MSVC only)
+ uses: ./.github/actions/setup-yasm
+ if: ${{ matrix.platform.msvc }}
+
- name: Configure (CMake)
if: "matrix.platform.cmake"
run: |