Skip to content

Commit 4a4cd9d

Browse files
committed
Try to fix actions
1 parent ce38912 commit 4a4cd9d

File tree

2 files changed

+73
-2
lines changed

2 files changed

+73
-2
lines changed

.github/workflows/cmake-multi-platform.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,20 @@ jobs:
5454
run: |
5555
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
5656
57+
- name: Set up MSVC toolchain
58+
uses: ilammy/msvc-dev-cmd@v1
59+
if: ${{ matrix.platform.name == 'Windows' }}
60+
with:
61+
arch: x64
62+
63+
- name: Set up ninja
64+
uses: ./.github/actions/setup-ninja
65+
5766
- uses: libsdl-org/setup-sdl@main
5867
id: sdl
5968
with:
60-
install-linux-dependencies: true
61-
version: 3-latest
69+
version: sdl3-latest
70+
cmake-generator: Ninja
6271

6372
- name: Configure CMake
6473
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: 'Setup ninja'
2+
description: 'Download ninja and add it to the PATH environment variable'
3+
inputs:
4+
version:
5+
description: 'Ninja version'
6+
default: '1.12.1'
7+
runs:
8+
using: 'composite'
9+
steps:
10+
- name: 'Calculate variables'
11+
id: calc
12+
shell: sh
13+
run: |
14+
case "${{ runner.os }}-${{ runner.arch }}" in
15+
"Linux-X86" | "Linux-X64")
16+
archive="ninja-linux.zip"
17+
;;
18+
"Linux-ARM64")
19+
archive="ninja-linux-aarch64.zip"
20+
;;
21+
"macOS-X86" | "macOS-X64" | "macOS-ARM64")
22+
archive="ninja-mac.zip"
23+
;;
24+
"Windows-X86" | "Windows-X64")
25+
archive="ninja-win.zip"
26+
;;
27+
"Windows-ARM64")
28+
archive="ninja-winarm64.zip"
29+
;;
30+
*)
31+
echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
32+
exit 1;
33+
;;
34+
esac
35+
echo "archive=${archive}" >> ${GITHUB_OUTPUT}
36+
echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
37+
- name: 'Restore cached ${{ steps.calc.outputs.archive }}'
38+
id: cache-restore
39+
uses: actions/cache/restore@v4
40+
with:
41+
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
42+
key: ${{ steps.calc.outputs.cache-key }}
43+
- name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
44+
if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
45+
shell: pwsh
46+
run: |
47+
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
48+
- name: 'Cache ${{ steps.calc.outputs.archive }}'
49+
if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
50+
uses: actions/cache/save@v4
51+
with:
52+
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
53+
key: ${{ steps.calc.outputs.cache-key }}
54+
- name: 'Extract ninja'
55+
shell: pwsh
56+
run: |
57+
7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
58+
- name: 'Set output variables'
59+
id: final
60+
shell: pwsh
61+
run: |
62+
echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH

0 commit comments

Comments
 (0)