Skip to content

Commit 1346120

Browse files
committed
ci: updates for windows-latest compatibility
(cherry picked from commit 0e8e5c0)
1 parent f332598 commit 1346120

File tree

3 files changed

+71
-11
lines changed

3 files changed

+71
-11
lines changed

.github/actions/setup-ninja/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: 'Download ninja and add it to the PATH environment variable'
33
inputs:
44
version:
55
description: 'Ninja version'
6-
default: '1.12.1'
6+
default: '1.13.1'
77
runs:
88
using: 'composite'
99
steps:
@@ -41,17 +41,17 @@ runs:
4141
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
4242
key: ${{ steps.calc.outputs.cache-key }}
4343
- name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
44-
if: ${{ !steps.cache-restore.outputs.cache-hit }}
44+
if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
4545
shell: pwsh
4646
run: |
4747
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
4848
- name: 'Cache ${{ steps.calc.outputs.archive }}'
49-
if: ${{ !steps.cache-restore.outputs.cache-hit }}
49+
if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
5050
uses: actions/cache/save@v4
5151
with:
5252
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
5353
key: ${{ steps.calc.outputs.cache-key }}
54-
- name: 'Extract libusb'
54+
- name: 'Extract ninja'
5555
shell: pwsh
5656
run: |
5757
7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"

.github/actions/setup-yasm/action.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# The pre-built yasm binaries are built with an older MSVCRT,
2+
# which is no longer installed on current Windows images.
3+
4+
name: 'Setup yasm'
5+
description: 'Build yasm and add it to the PATH environment variable'
6+
runs:
7+
using: 'composite'
8+
steps:
9+
- name: 'Calculate variables'
10+
id: calc
11+
shell: sh
12+
run: |
13+
echo "cache-key=yasm-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
14+
- name: 'Restore yasm'
15+
id: restore-yasm
16+
uses: actions/cache/restore@v4
17+
with:
18+
path: |
19+
${{ github.workspace }}/yasm
20+
key: ${{ steps.calc.outputs.cache-key }}
21+
- name: 'Verify cached yasm'
22+
if: ${{ steps.restore-yasm.outputs.cache-hit }}
23+
shell: pwsh
24+
run: |
25+
${{ github.workspace }}\yasm\bin\yasm --help
26+
- name: 'Download yasm sources'
27+
if: ${{ !steps.restore-yasm.outputs.cache-hit }}
28+
uses: actions/checkout@v4
29+
with:
30+
repository: yasm/yasm
31+
path: yasm-src
32+
- name: 'Configure, build and install yasm'
33+
if: ${{ !steps.restore-yasm.outputs.cache-hit }}
34+
shell: pwsh
35+
run: |
36+
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
37+
cmake --build yasm-build --parallel
38+
cmake --install yasm-build
39+
- name: 'Verify built yasm'
40+
if: ${{ !steps.restore-yasm.outputs.cache-hit }}
41+
shell: sh
42+
run: |
43+
set -e
44+
if [ ! -f "yasm/bin/yasm.exe" -a -f "yasm/bin/vsyasm.exe" ]; then
45+
cp "yasm/bin/vsyasm.exe" "yasm/bin/yasm.exe"
46+
fi
47+
yasm/bin/yasm --help
48+
- name: 'Cache yasm'
49+
if: ${{ !steps.restore-yasm.outputs.cache-hit }}
50+
uses: actions/cache/save@v4
51+
with:
52+
path: |
53+
${{ github.workspace }}/yasm
54+
key: ${{ steps.calc.outputs.cache-key }}
55+
enableCrossOsArchive: true
56+
- name: 'Set output variables'
57+
id: final
58+
shell: pwsh
59+
run: |
60+
echo "${{ github.workspace }}/yasm/bin" >> $env:GITHUB_PATH

.github/workflows/main.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
platform:
18-
- { name: Windows (MSVC+CMake), os: windows-2019, shell: sh, cmake: '-DSDL2MIXER_VENDORED=ON -GNinja', msvc: 1, shared: 1, static: 0 }
18+
- { name: Windows (MSVC+CMake), os: windows-latest, shell: sh, cmake: '-DSDL2MIXER_VENDORED=ON -GNinja', msvc: 1, shared: 1, static: 0 }
1919
- { name: Windows (mingw32+autotools), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, shared: 1, static: 1 }
2020
- { name: Windows (mingw64+CMake), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, shared: 1, static: 0,
2121
cmake: '-DSDL2MIXER_VENDORED=OFF -G "Ninja Multi-Config"' }
@@ -94,13 +94,9 @@ jobs:
9494
.github/fetch_sdl_vc.ps1
9595
echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/SDL2-devel-VC" >> $Env:GITHUB_ENV
9696
echo "::endgroup::"
97-
echo "::group::Downloading yasm"
98-
.github/fetch_yasm.ps1
99-
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
100-
echo "::endgroup::"
101-
- name: Setup Ninja for MSVC
97+
- name: Set up ninja
98+
uses: ./.github/actions/setup-ninja
10299
if: ${{ !contains(matrix.platform.shell, 'msys2') }}
103-
uses: aseprite/get-ninja@main
104100
- uses: ilammy/msvc-dev-cmd@v1
105101
if: "matrix.platform.msvc"
106102
with:
@@ -111,6 +107,10 @@ jobs:
111107
if: "runner.os == 'Linux' && matrix.platform.cmake"
112108
run: ./build-scripts/test-versioning.sh
113109

110+
- name: Set up yasm for mpg123 (MSVC only)
111+
uses: ./.github/actions/setup-yasm
112+
if: ${{ matrix.platform.msvc }}
113+
114114
- name: Configure (CMake)
115115
if: "matrix.platform.cmake"
116116
run: |

0 commit comments

Comments
 (0)