ci: add rust support

This commit is contained in:
Kacper Michajłow
2025-03-14 04:31:38 +01:00
parent 08d7d049d1
commit bd2118026b
3 changed files with 38 additions and 16 deletions

View File

@@ -36,13 +36,15 @@ jobs:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
TARGET: ${{ matrix.arch }}-w64-mingw32
RUST_TARGET: ${{ matrix.arch }}-pc-windows-gnu
strategy:
fail-fast: false
matrix:
include:
- target: i686-w64-mingw32
- arch: i686
wine: wine32
- target: x86_64-w64-mingw32
- arch: x86_64
wine: wine64
steps:
- uses: actions/checkout@v4
@@ -55,32 +57,31 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ matrix.target }}-
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ env.TARGET }}-
- name: Install dependencies
run: |
rustup target add ${{ env.RUST_TARGET }}
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --no-install-recommends -y ccache g++-mingw-w64 gcc-multilib meson nasm ninja-build pkgconf ${{ matrix.wine }} wine
sudo apt-get install --no-install-recommends -y ccache g++-mingw-w64 gcc-multilib python3-pip nasm ninja-build pkgconf ${{ matrix.wine }} wine
python -m pip install meson
- name: Install Meson Wraps
run: |
mkdir subprojects -p
meson wrap install mujs
meson subprojects download
- name: Build libraries
run: |
./ci/build-mingw64.sh
env:
TARGET: ${{ matrix.target }}
- name: Build with meson
id: build
run: |
./ci/build-mingw64.sh meson pack
env:
TARGET: ${{ matrix.target }}
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
@@ -105,7 +106,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: mpv-${{ matrix.target }}
name: mpv-${{ env.TARGET }}
path: mpv-git-*.zip
- name: Save Cache
@@ -113,7 +114,7 @@ jobs:
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
win32:
runs-on: ${{ matrix.os }}
@@ -131,9 +132,11 @@ jobs:
VS: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise"
CC: "ccache clang"
CXX: "ccache clang++"
CC_LD: "lld"
CXX_LD: "lld"
CC_LD: "lld-link"
CXX_LD: "lld-link"
WINDRES: "llvm-rc"
RUST_LD: "lld-link"
RUSTC: "rustc --target ${{ matrix.target }}"
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: "${{ github.workspace }}\\.ccache"
CCACHE_MAXSIZE: 500M
@@ -163,6 +166,21 @@ jobs:
choco install ccache nasm
./ci/install-cmake.ps1 -arch ${{ matrix.arch }}
- name: Install Rustup
# TODO: Remove after https://github.com/actions/partner-runner-images/issues/77
if: ${{ matrix.os == 'windows-11-arm' }}
run: |
Invoke-WebRequest -Uri "https://win.rustup.rs/aarch64" -OutFile "$env:TEMP\rustup-init.exe"
& "$env:TEMP\rustup-init.exe" --default-toolchain none --profile=minimal -y
"$env:USERPROFILE\.cargo\bin" | Out-File -Append $env:GITHUB_PATH
"CARGO_HOME=$env:USERPROFILE\.cargo" | Out-File -Append $env:GITHUB_ENV
- name: Update Rust toolchain
if: ${{ matrix.os == 'windows-11-arm' }}
run: |
rustup update --no-self-update stable
rustup default stable
- name: Update Meson WrapDB
run: |
meson wrap update-db
@@ -260,7 +278,7 @@ jobs:
run: |
brew update
brew install -q autoconf automake pkgconf libtool python freetype fribidi little-cms2 \
luajit libass ffmpeg meson uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers
luajit libass ffmpeg meson rust uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers
- name: Build with meson
id: build
@@ -392,6 +410,7 @@ jobs:
libxscrnsaver-dev \
meson \
musl-dev \
rust \
samurai
- name: Build with meson
@@ -445,6 +464,7 @@ jobs:
pulseaudio \
python3 \
rubberband \
rust \
sdl2 \
shaderc \
spirv-cross \
@@ -499,6 +519,7 @@ jobs:
pulseaudio \
python3 \
rubberband \
rust \
sekrit-twc-zimg \
sdl2 \
sndio \
@@ -561,6 +582,7 @@ jobs:
python:p
rst2pdf:p
rubberband:p
rust:p
shaderc:p
spirv-cross:p
uchardet:p

View File

@@ -4,7 +4,6 @@ set -e
. ./ci/build-common.sh
# clone exactly the oldest libplacebo we want to support
rm -rf subprojects
mkdir -p subprojects
git clone https://code.videolan.org/videolan/libplacebo.git \
--recurse-submodules --shallow-submodules \

View File

@@ -38,10 +38,11 @@ fam=x86_64
cat >"$prefix_dir/crossfile" <<EOF
[built-in options]
buildtype = 'release'
wrap_mode = 'nofallback'
wrap_mode = 'nodownload'
[binaries]
c = ['ccache', '${CC}']
cpp = ['ccache', '${CXX}']
rust = ['rustc', '--target', '${RUST_TARGET}']
ar = '${AR}'
strip = '${TARGET}-strip'
pkgconfig = 'pkg-config'