mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-04 16:57:00 +01:00
fixed ci
This commit is contained in:
1 parent
4c842402a6
commit
6b0d5040f6
5 files changed
+95
-98
No files matched your search
@@ -1,51 +0,0 @@
|
|||||||
name: libmpv (Windows)
|
|
||||||
description: >
|
|
||||||
Provide libmpv's Windows development files. `libmpv2-sys` emits
|
|
||||||
`cargo:rustc-link-lib=mpv`, and mpv's Windows *player* build ships neither
|
|
||||||
mpv.lib nor libmpv-2.dll — they come from the separate mpv-dev archive. Sets
|
|
||||||
LIB for the linker, PATH so binaries find the DLL at run time, and
|
|
||||||
MPV_DEV_DIR for `scripts/build.ps1`.
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
dir:
|
|
||||||
description: Directory holding libmpv-2.dll and mpv.lib.
|
|
||||||
value: ${{ steps.mpv.outputs.dir }}
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
# lib.exe, for turning mpv.def into an import library.
|
|
||||||
- uses: ilammy/msvc-dev-cmd@v1
|
|
||||||
|
|
||||||
- id: mpv
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
$ErrorActionPreference = 'Stop'
|
|
||||||
$feed = [xml](Invoke-WebRequest -UseBasicParsing `
|
|
||||||
'https://sourceforge.net/projects/mpv-player-windows/rss?path=/libmpv').Content
|
|
||||||
# The "v3" variants are x86-64-v3 builds; take the baseline one.
|
|
||||||
$item = $feed.rss.channel.item |
|
|
||||||
Where-Object { $_.link -match 'mpv-dev-x86_64-2[^/]*\.7z/download$' } |
|
|
||||||
Select-Object -First 1
|
|
||||||
if (-not $item) { throw 'no mpv-dev build in the SourceForge feed' }
|
|
||||||
|
|
||||||
$archive = Join-Path $env:RUNNER_TEMP 'mpv-dev.7z'
|
|
||||||
$dir = Join-Path $env:RUNNER_TEMP 'mpv-dev'
|
|
||||||
Invoke-WebRequest -UseBasicParsing $item.link -OutFile $archive
|
|
||||||
7z x $archive "-o$dir" -y | Out-Null
|
|
||||||
|
|
||||||
$dll = Get-ChildItem -Path $dir -Filter 'libmpv-2.dll' -Recurse |
|
|
||||||
Select-Object -First 1
|
|
||||||
if (-not $dll) { throw "libmpv-2.dll not found under $dir" }
|
|
||||||
$libDir = $dll.Directory.FullName
|
|
||||||
|
|
||||||
# /NAME matters: without it the import library references mpv.dll, and
|
|
||||||
# the file that actually ships is libmpv-2.dll.
|
|
||||||
lib.exe /def:"$libDir\mpv.def" /name:libmpv-2.dll `
|
|
||||||
/out:"$libDir\mpv.lib" /machine:x64 | Out-Null
|
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'lib.exe failed to build mpv.lib' }
|
|
||||||
|
|
||||||
"dir=$libDir" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
|
|
||||||
"MPV_DEV_DIR=$libDir" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
|
|
||||||
"LIB=$libDir;$env:LIB" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
|
|
||||||
$libDir | Out-File $env:GITHUB_PATH -Append -Encoding utf8
|
|
||||||
+39
-15
@@ -10,11 +10,8 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
gate:
|
gate:
|
||||||
strategy:
|
name: Gate (Linux)
|
||||||
fail-fast: false
|
runs-on: ubuntu-24.04
|
||||||
matrix:
|
|
||||||
os: [ubuntu-24.04, windows-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -26,22 +23,49 @@ jobs:
|
|||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
# libmpv for pstr-player. On Windows the DLL and import library are
|
# libmpv for pstr-player.
|
||||||
# bundled from the mpv-dev build rather than installed system-wide.
|
- name: Install libmpv
|
||||||
- name: Install libmpv (Linux)
|
|
||||||
if: runner.os == 'Linux'
|
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libmpv-dev
|
sudo apt-get install -y libmpv-dev
|
||||||
|
|
||||||
# Without this the test binaries do not link: there is no mpv.lib on the
|
|
||||||
# runner. See .github/actions/libmpv-windows.
|
|
||||||
- name: Install libmpv (Windows)
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
uses: ./.github/actions/libmpv-windows
|
|
||||||
|
|
||||||
- run: cargo fmt --all -- --check
|
- run: cargo fmt --all -- --check
|
||||||
|
|
||||||
- run: cargo clippy --workspace --all-targets -- -D warnings
|
- run: cargo clippy --workspace --all-targets -- -D warnings
|
||||||
|
|
||||||
- run: cargo test --workspace --locked
|
- run: cargo test --workspace --locked
|
||||||
|
|
||||||
|
# The Windows artifacts are cross-compiled from Linux with mingw-w64 — see
|
||||||
|
# scripts/build-windows.sh — so this checks the target that actually ships.
|
||||||
|
# It is a compile check, not a test run: nothing here executes a Windows
|
||||||
|
# binary. libmpv is not linked at build time by anything but `-l mpv`, which
|
||||||
|
# is why the import library out of the mpv-dev archive is all it needs.
|
||||||
|
windows-cross:
|
||||||
|
name: Gate (Windows cross)
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
toolchain: "1.96"
|
||||||
|
components: clippy
|
||||||
|
targets: x86_64-pc-windows-gnu
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
- name: Install the cross toolchain
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y mingw-w64 p7zip-full
|
||||||
|
|
||||||
|
- name: Fetch libmpv's Windows development files
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
run: scripts/build-windows.sh --fetch-mpv mpv
|
||||||
|
|
||||||
|
- name: clippy (x86_64-pc-windows-gnu)
|
||||||
|
run: |
|
||||||
|
RUSTFLAGS="-L native=$PWD/dist/mpv-dev" \
|
||||||
|
cargo clippy --workspace --all-targets \
|
||||||
|
--target x86_64-pc-windows-gnu -- -D warnings
|
||||||
@@ -96,28 +96,35 @@ jobs:
|
|||||||
dist/*.rpm
|
dist/*.rpm
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
# Cross-compiled from Linux with mingw-w64, and the .msi built by wixl rather
|
||||||
|
# than WiX — scripts/build-windows.sh, which is how these artifacts have been
|
||||||
|
# produced by hand. A windows runner would need MSVC's mpv.lib, and current
|
||||||
|
# mpv-dev archives ship only the mingw import library.
|
||||||
windows:
|
windows:
|
||||||
name: Windows artifacts
|
name: Windows artifacts
|
||||||
needs: verify
|
needs: verify
|
||||||
runs-on: windows-latest
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
toolchain: "1.96"
|
toolchain: "1.96"
|
||||||
|
targets: x86_64-pc-windows-gnu
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
# Sets MPV_DEV_DIR, which is what build.ps1 reads when -MpvDev is absent.
|
# mingw-w64 for the cross compile, msitools for wixl, p7zip for the
|
||||||
- name: Install libmpv
|
# mpv-dev archive.
|
||||||
uses: ./.github/actions/libmpv-windows
|
- name: Install the cross toolchain
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y mingw-w64 msitools zip p7zip-full
|
||||||
|
|
||||||
# build.ps1 installs the WiX toolset itself if `wix` is missing, and the
|
|
||||||
# runner has the .NET SDK it needs for that.
|
|
||||||
- name: Build the portable .zip and the .msi
|
- name: Build the portable .zip and the .msi
|
||||||
shell: pwsh
|
env:
|
||||||
run: scripts\build.ps1 -Artifacts zip,msi
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
run: scripts/build-windows.sh --fetch-mpv
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
+15
-13
@@ -69,18 +69,20 @@ so the linker wants an import library named `mpv.lib` and the process wants
|
|||||||
`libmpv-2.dll` at run time. Neither ships with mpv's Windows *player* build —
|
`libmpv-2.dll` at run time. Neither ships with mpv's Windows *player* build —
|
||||||
both come from the separate **mpv-dev** archive:
|
both come from the separate **mpv-dev** archive:
|
||||||
|
|
||||||
<https://sourceforge.net/projects/mpv-player-windows/files/libmpv/>
|
<https://github.com/shinchiro/mpv-winbuild-cmake/releases/latest>
|
||||||
|
|
||||||
Unpack it and point the script at it:
|
(The SourceForge project these are better known by mirrors the same builds, but
|
||||||
|
its `/download` URLs hand anything that does not look like a browser an HTML
|
||||||
|
interstitial, so `--fetch-mpv` goes to the source.)
|
||||||
|
|
||||||
```powershell
|
**The cross build from Linux is the supported path, and the one CI uses** —
|
||||||
scripts\build.ps1 -MpvDev C:\mpv-dev
|
`scripts/build-windows.sh --fetch-mpv` fetches the archive, links against its
|
||||||
```
|
`libmpv.dll.a` with mingw-w64 and builds the `.msi` with `wixl`. On a real
|
||||||
|
Windows box `scripts\build.ps1 -MpvDev C:\mpv-dev` does the MSVC equivalent, but
|
||||||
If that directory has `mpv.def` but no `mpv.lib`, the script generates the import
|
note that it needs an `mpv.lib` or an `mpv.def` to generate one from with
|
||||||
library with `lib.exe` (`/name:libmpv-2.dll`, so it references the DLL that
|
`lib.exe`, and **current mpv-dev archives ship neither** — only the mingw import
|
||||||
actually ships). It finds `lib.exe` on `PATH` or imports the MSVC environment via
|
library. Producing `mpv.lib` from a recent archive means writing the `.def`
|
||||||
`vswhere`, so a plain PowerShell session works.
|
yourself from `dumpbin /exports libmpv-2.dll`.
|
||||||
|
|
||||||
There is no static libmpv worth shipping, so **"standalone exe" means the exe
|
There is no static libmpv worth shipping, so **"standalone exe" means the exe
|
||||||
plus `libmpv-2.dll` beside it** — that pair, plus `pstr.exe` and the README, is
|
plus `libmpv-2.dll` beside it** — that pair, plus `pstr.exe` and the README, is
|
||||||
@@ -131,9 +133,9 @@ almost every field in it is computed.
|
|||||||
## Releasing
|
## Releasing
|
||||||
|
|
||||||
A release is a `v<version>` tag on `main`; `.github/workflows/release.yml` does
|
A release is a `v<version>` tag on `main`; `.github/workflows/release.yml` does
|
||||||
the rest. It runs the CI gate and `scripts/build.sh tarball deb rpm` on Linux,
|
the rest. Every job runs on Linux: `scripts/build.sh tarball deb rpm` for the
|
||||||
`scripts\build.ps1 -Artifacts zip,msi` on Windows, and publishes both sets plus
|
Linux artifacts and `scripts/build-windows.sh --fetch-mpv` for the Windows ones,
|
||||||
a `SHA256SUMS` to a GitHub release. So the steps are:
|
published together with a `SHA256SUMS` to a GitHub release. So the steps are:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. bump Cargo.toml's workspace version *and* packaging/PKGBUILD's pkgver
|
# 1. bump Cargo.toml's workspace version *and* packaging/PKGBUILD's pkgver
|
||||||
|
|||||||
+26
-11
@@ -45,7 +45,13 @@ readonly CLI_BIN="pstr.exe"
|
|||||||
|
|
||||||
# The mpv-dev archive: libmpv-2.dll plus the import library to link against.
|
# The mpv-dev archive: libmpv-2.dll plus the import library to link against.
|
||||||
# mpv's *player* build ships neither.
|
# mpv's *player* build ships neither.
|
||||||
readonly MPV_INDEX="https://sourceforge.net/projects/mpv-player-windows/rss?path=/libmpv"
|
#
|
||||||
|
# Fetched from shinchiro's releases rather than the SourceForge mirror the
|
||||||
|
# archive is better known by: SourceForge's `/download` URLs answer anything
|
||||||
|
# that does not look like a browser with an HTML interstitial, which lands as a
|
||||||
|
# file called mpv-dev.7z that is not an archive. These are the same builds — the
|
||||||
|
# SourceForge project mirrors them.
|
||||||
|
readonly MPV_RELEASE="https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest"
|
||||||
|
|
||||||
VERSION="$(grep -m1 '^version' "$ROOT/Cargo.toml" | cut -d'"' -f2)"
|
VERSION="$(grep -m1 '^version' "$ROOT/Cargo.toml" | cut -d'"' -f2)"
|
||||||
readonly VERSION
|
readonly VERSION
|
||||||
@@ -66,6 +72,7 @@ usage() {
|
|||||||
usage: scripts/build-windows.sh [options] [artifact ...]
|
usage: scripts/build-windows.sh [options] [artifact ...]
|
||||||
|
|
||||||
artifacts
|
artifacts
|
||||||
|
mpv resolve libmpv's development files into dist/mpv-dev and stop
|
||||||
binaries cargo build --release --target ${TARGET}, then stage dist/windows
|
binaries cargo build --release --target ${TARGET}, then stage dist/windows
|
||||||
zip dist/${PKGNAME}-${VERSION}-x86_64-windows.zip
|
zip dist/${PKGNAME}-${VERSION}-x86_64-windows.zip
|
||||||
msi dist/${PKGNAME}-${VERSION}-x64.msi (needs wixl)
|
msi dist/${PKGNAME}-${VERSION}-x64.msi (needs wixl)
|
||||||
@@ -100,7 +107,7 @@ done
|
|||||||
[[ ${#TARGETS[@]} -eq 0 ]] && TARGETS=(all)
|
[[ ${#TARGETS[@]} -eq 0 ]] && TARGETS=(all)
|
||||||
for t in "${TARGETS[@]}"; do
|
for t in "${TARGETS[@]}"; do
|
||||||
case "$t" in
|
case "$t" in
|
||||||
binaries|zip|msi|all) ;;
|
mpv|binaries|zip|msi|all) ;;
|
||||||
*) echo "unknown artifact: $t" >&2; usage >&2; exit 2 ;;
|
*) echo "unknown artifact: $t" >&2; usage >&2; exit 2 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -128,15 +135,20 @@ fetch_mpv() {
|
|||||||
have curl || die "--fetch-mpv needs curl"
|
have curl || die "--fetch-mpv needs curl"
|
||||||
have 7z || die "--fetch-mpv needs 7z (p7zip)"
|
have 7z || die "--fetch-mpv needs 7z (p7zip)"
|
||||||
|
|
||||||
|
# The asset names are mpv-dev-<arch>-<date>-git-<sha>.7z; the date is what
|
||||||
|
# keeps this off the i686, aarch64 and v3 builds in the same release.
|
||||||
local url
|
local url
|
||||||
url="$(curl -sL --max-time 60 "$MPV_INDEX" \
|
url="$(curl -sL --max-time 60 ${GITHUB_TOKEN:+-H "Authorization: Bearer $GITHUB_TOKEN"} "$MPV_RELEASE" \
|
||||||
| grep -o '<link>[^<]*mpv-dev-x86_64-2[^<]*\.7z/download</link>' \
|
| grep -o '"browser_download_url": *"[^"]*mpv-dev-x86_64-20[0-9]*-git-[^"]*\.7z"' \
|
||||||
| sed 's|<link>||; s|</link>||' | head -1)"
|
| sed 's|.*: *"||; s|"$||' | head -1)"
|
||||||
[[ -n "$url" ]] || die "could not find an mpv-dev build in the SourceForge feed"
|
[[ -n "$url" ]] || die "no mpv-dev build in the latest shinchiro/mpv-winbuild-cmake release"
|
||||||
|
|
||||||
log "downloading $(basename "$(dirname "$url")")"
|
log "downloading $(basename "$url")"
|
||||||
mkdir -p "$dest"
|
mkdir -p "$dest"
|
||||||
curl -L --max-time 600 -o "$dest.7z" "$url"
|
curl -L --max-time 600 -o "$dest.7z" "$url"
|
||||||
|
# A download that fetched an error page instead of the archive fails inside 7z
|
||||||
|
# with something unrelated to what went wrong; say it here.
|
||||||
|
[[ "$(head -c2 "$dest.7z")" == "7z" ]] || die "$url did not return a 7z archive"
|
||||||
7z x -y -o"$dest" "$dest.7z" >/dev/null
|
7z x -y -o"$dest" "$dest.7z" >/dev/null
|
||||||
rm -f "$dest.7z"
|
rm -f "$dest.7z"
|
||||||
MPV_DEV="$dest"
|
MPV_DEV="$dest"
|
||||||
@@ -156,9 +168,9 @@ resolve_mpv() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -n "$MPV_DEV" ]] || die "$(cat <<EOF
|
[[ -n "$MPV_DEV" ]] || die "$(cat <<EOF
|
||||||
no libmpv development files. Either pass --fetch-mpv, or download the mpv-dev
|
no libmpv development files. Either pass --fetch-mpv, or download an
|
||||||
archive from
|
mpv-dev-x86_64-*.7z from
|
||||||
https://sourceforge.net/projects/mpv-player-windows/files/libmpv/
|
https://github.com/shinchiro/mpv-winbuild-cmake/releases/latest
|
||||||
unpack it, and pass --mpv-dev <dir> or set MPV_DEV_DIR.
|
unpack it, and pass --mpv-dev <dir> or set MPV_DEV_DIR.
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
@@ -278,10 +290,13 @@ make_msi() {
|
|||||||
mkdir -p "$DIST"
|
mkdir -p "$DIST"
|
||||||
# Only the compile and the staging copy need libmpv; repackaging out of
|
# Only the compile and the staging copy need libmpv; repackaging out of
|
||||||
# dist/windows does not, so `--skip-build msi` works with no mpv-dev at hand.
|
# dist/windows does not, so `--skip-build msi` works with no mpv-dev at hand.
|
||||||
[[ " ${TARGETS[*]} " == *" binaries "* ]] && resolve_mpv
|
if [[ " ${TARGETS[*]} " == *" binaries "* || " ${TARGETS[*]} " == *" mpv "* ]]; then
|
||||||
|
resolve_mpv
|
||||||
|
fi
|
||||||
|
|
||||||
for t in "${TARGETS[@]}"; do
|
for t in "${TARGETS[@]}"; do
|
||||||
case "$t" in
|
case "$t" in
|
||||||
|
mpv) log "libmpv at $MPV_DIR" ;; # resolve_mpv above did the work
|
||||||
binaries) build; stage ;;
|
binaries) build; stage ;;
|
||||||
zip) [[ -d "$OUTDIR" ]] || die 'nothing staged — run the binaries artifact first'; make_zip ;;
|
zip) [[ -d "$OUTDIR" ]] || die 'nothing staged — run the binaries artifact first'; make_zip ;;
|
||||||
msi) [[ -d "$OUTDIR" ]] || die 'nothing staged — run the binaries artifact first'; make_msi ;;
|
msi) [[ -d "$OUTDIR" ]] || die 'nothing staged — run the binaries artifact first'; make_msi ;;
|
||||||
|
|||||||
Reference in new issue
Block a user