Enhance build workflow with optional mpv_ref input
This commit is contained in:
1 parent
126e2cd233
commit
36c8ec3a7c
1 file changed
+76
-16
+76
-16
@@ -1,17 +1,25 @@
|
|||||||
|
|
||||||
name: build
|
name: build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
mpv_ref:
|
mpv_ref:
|
||||||
description: mpv branch, tag or commit
|
description: "mpv branch, tag or commit"
|
||||||
default: master
|
type: string
|
||||||
|
required: false
|
||||||
|
default: "master"
|
||||||
|
|
||||||
push:
|
push:
|
||||||
tags: ["v*"]
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
windows:
|
windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -29,10 +37,26 @@ jobs:
|
|||||||
|
|
||||||
- name: Clone mpv
|
- name: Clone mpv
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
env:
|
||||||
|
MPV_REF: ${{ inputs.mpv_ref }}
|
||||||
run: |
|
run: |
|
||||||
$ref = "${ github.event.inputs.mpv_ref }}"
|
$ref = $env:MPV_REF
|
||||||
if (-not $ref) { $ref = "master" }
|
if ([string]::IsNullOrWhiteSpace($ref)) {
|
||||||
git clone --depth 1 --branch $ref https://github.com/mpv-player/mpv.git mpv
|
$ref = "master"
|
||||||
|
}
|
||||||
|
|
||||||
|
git init mpv
|
||||||
|
git -C mpv remote add origin https://github.com/mpv-player/mpv.git
|
||||||
|
git -C mpv fetch --depth 1 origin $ref
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to fetch mpv ref: $ref"
|
||||||
|
}
|
||||||
|
|
||||||
|
git -C mpv checkout --detach FETCH_HEAD
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to checkout mpv ref: $ref"
|
||||||
|
}
|
||||||
|
|
||||||
git -C mpv log -1 --format='%h %cd %s' --date=short
|
git -C mpv log -1 --format='%h %cd %s' --date=short
|
||||||
|
|
||||||
- name: Apply ad_joc
|
- name: Apply ad_joc
|
||||||
@@ -40,41 +64,77 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
Copy-Item fork/files/audio/decode/* mpv/audio/decode/ -Force
|
Copy-Item fork/files/audio/decode/* mpv/audio/decode/ -Force
|
||||||
python fork/tools/apply_edits.py mpv
|
python fork/tools/apply_edits.py mpv
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to apply ad_joc patches"
|
||||||
|
}
|
||||||
|
|
||||||
- name: Build joc_core
|
- name: Build joc_core
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 https://github.com/TheM14/JustOneCacophony.git joc
|
git clone --depth 1 https://github.com/TheM14/JustOneCacophony.git joc
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to clone JustOneCacophony"
|
||||||
|
}
|
||||||
|
|
||||||
cmake -S joc -B joc/build -A x64
|
cmake -S joc -B joc/build -A x64
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "joc_core configuration failed"
|
||||||
|
}
|
||||||
|
|
||||||
cmake --build joc/build --config Release
|
cmake --build joc/build --config Release
|
||||||
$lib = Get-ChildItem joc/build -Recurse -Filter joc_core.lib | Select-Object -First 1
|
if ($LASTEXITCODE -ne 0) {
|
||||||
if (-not $lib) { throw "joc_core.lib not found" }
|
throw "joc_core build failed"
|
||||||
"JOC_CORE_DIR=$($lib.DirectoryName)" | Out-File -Append $env:GITHUB_ENV
|
}
|
||||||
|
|
||||||
|
$lib = Get-ChildItem joc/build -Recurse -Filter joc_core.lib |
|
||||||
|
Select-Object -First 1
|
||||||
|
if (-not $lib) {
|
||||||
|
throw "joc_core.lib not found"
|
||||||
|
}
|
||||||
|
|
||||||
|
"JOC_CORE_DIR=$($lib.DirectoryName)" |
|
||||||
|
Out-File -Append $env:GITHUB_ENV
|
||||||
|
|
||||||
- name: Build mpv
|
- name: Build mpv
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$bash = "C:\msys64\usr\bin\bash.exe"
|
$bash = "C:\msys64\usr\bin\bash.exe"
|
||||||
$dir = (Resolve-Path mpv).Path -replace '\\','/'
|
$dirWin = (Resolve-Path mpv).Path
|
||||||
$core = $env:JOC_CORE_DIR -replace '\\','/'
|
$dir = (& $bash -lc "cygpath -u '$dirWin'").Trim()
|
||||||
|
$core = (& $bash -lc "cygpath -u '$env:JOC_CORE_DIR'").Trim()
|
||||||
|
|
||||||
$lines = @(
|
$lines = @(
|
||||||
'set -e',
|
'set -e',
|
||||||
'export PATH=/mingw64/bin:/usr/bin:$PATH',
|
'export PATH=/mingw64/bin:/usr/bin:$PATH',
|
||||||
'export MSYSTEM=MINGW64',
|
'export MSYSTEM=MINGW64',
|
||||||
"cd $dir",
|
"cd '$dir'",
|
||||||
"meson setup build --buildtype=release -Dgpl=false -Dlua=luajit -Djoc-core-dir=$core",
|
"meson setup build --buildtype=release -Dgpl=false -Dlua=luajit -Djoc-core-dir='$core'",
|
||||||
'ninja -C build'
|
'ninja -C build'
|
||||||
)
|
)
|
||||||
($lines -join [Environment]::NewLine) | & $bash -lc "cat > /tmp/b.sh && bash /tmp/b.sh"
|
|
||||||
|
($lines -join "`n") |
|
||||||
|
& $bash -lc 'cat > /tmp/build-mpv.sh && bash /tmp/build-mpv.sh'
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "mpv build failed"
|
||||||
|
}
|
||||||
|
|
||||||
- name: Bundle
|
- name: Bundle
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$bash = "C:\msys64\usr\bin\bash.exe"
|
$bash = "C:\msys64\usr\bin\bash.exe"
|
||||||
$dir = (Resolve-Path mpv).Path -replace '\\','/'
|
$dirWin = (Resolve-Path mpv).Path
|
||||||
& $bash -lc "$env:GITHUB_WORKSPACE/fork/tools/bundle_dlls.sh '$dir/build'"
|
$dir = (& $bash -lc "cygpath -u '$dirWin'").Trim()
|
||||||
|
$workspace = (& $bash -lc "cygpath -u '$env:GITHUB_WORKSPACE'").Trim()
|
||||||
|
|
||||||
|
& $bash -lc "bash '$workspace/fork/tools/bundle_dlls.sh' '$dir/build'"
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "DLL bundling failed"
|
||||||
|
}
|
||||||
|
|
||||||
Copy-Item (Join-Path $env:JOC_CORE_DIR "joc_core.dll") mpv/build -Force
|
Copy-Item (Join-Path $env:JOC_CORE_DIR "joc_core.dll") mpv/build -Force
|
||||||
Copy-Item fork/mpv.conf.example mpv/build -Force
|
Copy-Item fork/mpv.conf.example mpv/build -Force
|
||||||
|
|
||||||
Compress-Archive -Path mpv/build/* -DestinationPath mpv-ad-joc.zip
|
Compress-Archive -Path mpv/build/* -DestinationPath mpv-ad-joc.zip
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
|
|||||||
Reference in new issue
Block a user