mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-03 16:41:26 +01:00
fixed ci, release, docs
This commit is contained in:
1 parent
14c48428a3
commit
4c842402a6
9 files changed
+315
-44
No files matched your search
@@ -0,0 +1,51 @@
|
||||
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
|
||||
@@ -34,6 +34,12 @@ jobs:
|
||||
sudo apt-get update
|
||||
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 clippy --workspace --all-targets -- -D warnings
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
name: Release
|
||||
|
||||
# A release is a `v<version>` tag on main. The tag is the trigger and the
|
||||
# version of record: nothing here reads the branch, so the first job checks that
|
||||
# the commit really is on main and that the tag, `Cargo.toml` and the PKGBUILD
|
||||
# all say the same version — a tag that disagrees would otherwise publish
|
||||
# artifacts named after the manifest, not after the tag.
|
||||
#
|
||||
# `workflow_dispatch` builds everything and publishes nothing, which is how to
|
||||
# rehearse a release without burning a tag.
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
name: Tag and versions
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: The tag is on main
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main
|
||||
git merge-base --is-ancestor "$GITHUB_SHA" origin/main ||
|
||||
{ echo "::error::$GITHUB_REF_NAME points at a commit that is not on main"; exit 1; }
|
||||
|
||||
- name: The tag, Cargo.toml and the PKGBUILD agree
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
tag="${GITHUB_REF_NAME#v}"
|
||||
manifest="$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n1)"
|
||||
pkgbuild="$(sed -n 's/^pkgver=//p' packaging/PKGBUILD | head -n1)"
|
||||
echo "tag=$tag manifest=$manifest pkgbuild=$pkgbuild"
|
||||
[ "$tag" = "$manifest" ] ||
|
||||
{ echo "::error::tag $tag != Cargo.toml $manifest"; exit 1; }
|
||||
[ "$tag" = "$pkgbuild" ] ||
|
||||
{ echo "::error::tag $tag != PKGBUILD $pkgbuild"; exit 1; }
|
||||
|
||||
# A release must resolve the SDK from crates.io. The build scripts refuse
|
||||
# to run with a patch pointing at a missing sibling checkout, but here the
|
||||
# patch is wrong even when the path exists.
|
||||
- name: No path patch on the SDK
|
||||
run: |
|
||||
! grep -q '^\[patch\.crates-io\]' Cargo.toml ||
|
||||
{ echo "::error::Cargo.toml carries [patch.crates-io]; releases build against the registry"; exit 1; }
|
||||
|
||||
linux:
|
||||
name: Linux artifacts
|
||||
needs: verify
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
# Pinned: the MSRV the workspace declares.
|
||||
toolchain: "1.96"
|
||||
components: rustfmt, clippy
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# rpm for rpmbuild; the .deb goes through dpkg-deb, which is preinstalled.
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libmpv-dev rpm
|
||||
|
||||
- name: Gate
|
||||
run: |
|
||||
cargo fmt --all -- --check
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
cargo test --workspace --locked
|
||||
|
||||
- name: Build tarball, .deb and .rpm
|
||||
run: scripts/build.sh tarball deb rpm
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux
|
||||
path: |
|
||||
dist/*.tar.gz
|
||||
dist/*.deb
|
||||
dist/*.rpm
|
||||
if-no-files-found: error
|
||||
|
||||
windows:
|
||||
name: Windows artifacts
|
||||
needs: verify
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: "1.96"
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Sets MPV_DEV_DIR, which is what build.ps1 reads when -MpvDev is absent.
|
||||
- name: Install libmpv
|
||||
uses: ./.github/actions/libmpv-windows
|
||||
|
||||
# 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
|
||||
shell: pwsh
|
||||
run: scripts\build.ps1 -Artifacts zip,msi
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows
|
||||
path: |
|
||||
dist/*.zip
|
||||
dist/*.msi
|
||||
if-no-files-found: error
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
needs: [linux, windows]
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Checksums
|
||||
run: |
|
||||
cd artifacts
|
||||
sha256sum * > SHA256SUMS
|
||||
cat SHA256SUMS
|
||||
|
||||
- uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: artifacts/*
|
||||
generate_release_notes: true
|
||||
fail_on_unmatched_files: true
|
||||
Reference in new issue
Block a user