Skip to content

Commit dd801fd

Browse files
committed
ci: use setup-yasm action
The pre-built binaries of yasm/yasm are built with an Visual Studio 2010, requiring MSVCR100.DLL. This runtime is no longer installed by default on current GitHub Actions images, so build yasm instead.
1 parent 2a9b683 commit dd801fd

File tree

3 files changed

+62
-38
lines changed

3 files changed

+62
-38
lines changed

.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/fetch_yasm.ps1

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,9 @@ jobs:
9999
if: ${{ runner.os == 'Linux' }}
100100
run: ./build-scripts/test-versioning.sh
101101

102-
- name: Set up yasm for mpg123
102+
- name: Set up yasm for mpg123 (MSVC only)
103+
uses: ./.github/actions/setup-yasm
103104
if: ${{ matrix.platform.msvc }}
104-
shell: pwsh
105-
run: |
106-
.github/fetch_yasm.ps1
107-
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
108105

109106
- name: Configure (CMake)
110107
run: |

0 commit comments

Comments
 (0)