Skip to content

Build For Windows & Linux #21

Build For Windows & Linux

Build For Windows & Linux #21

Workflow file for this run

name: Build For Windows & Linux
on:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-windows:
name: 'Build for Windows'
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache gtk3
id: cache-gtk3
uses: actions/cache@v3
env:
cache-name: cache-gtk3
with:
path: |
C:\gtk-build\gtk\
key: gtk3
- if: ${{ steps.cache-gtk3.outputs.cache-hit != 'true' }}
name: Build gtk3
shell: powershell
run: |
pipx install git+https://github.com/g40/gvsbuild@libpng
gvsbuild build gtk3
- name: Set Rust Toolchain
shell: powershell
run: rustup default stable-msvc
- name: Cargo Cache
uses: Swatinem/rust-cache@v2
- name: Build Binary
shell: powershell
run: |
$env:Path = "C:\gtk-build\gtk\x64\release\bin;" + $env:Path
$env:LIB = "C:\gtk-build\gtk\x64\release\lib;" + $env:LIB
$env:INCLUDE = "C:\gtk-build\gtk\x64\release\include;C:\gtk-build\gtk\x64\release\include\cairo;C:\gtk-build\gtk\x64\release\include\glib-2.0;C:\gtk-build\gtk\x64\release\include\gobject-introspection-1.0;C:\gtk-build\gtk\x64\release\lib\glib-2.0\include;" + $env:INCLUDE
cargo build --release
- name: Build Launcher
shell: powershell
run: |
rustc -C opt-level=3 ./scripts/launch-windows.rs -o mpv-subs-popout.exe
- name: Pack
shell: powershell
run: |
$version = cargo pkgid | Select-String -Pattern "\d+.\d+.\d+" | foreach {$_.Matches.Groups[0].Value}
mkdir "mpv-subs-popout_$($version)_win64"
mkdir "mpv-subs-popout_$($version)_win64\gtk3-runtime"
mkdir "mpv-subs-popout_$($version)_win64\gtk3-runtime\bin"
mkdir "mpv-subs-popout_$($version)_win64\bin"
cp "C:\gtk-build\gtk\x64\release\bin\*.dll" ".\mpv-subs-popout_$($version)_win64\gtk3-runtime\bin"
cp -r "C:\gtk-build\gtk\x64\release\share\" ".\mpv-subs-popout_$($version)_win64\gtk3-runtime\"
cp -r "C:\gtk-build\gtk\x64\release\etc\" ".\mpv-subs-popout_$($version)_win64\gtk3-runtime\"
cp ".\target\release\mpv-subs-popout.exe" ".\mpv-subs-popout_$($version)_win64\bin\"
cp ".\mpv-subs-popout.exe" ".\mpv-subs-popout_$($version)_win64"
Compress-Archive "mpv-subs-popout_$($version)_win64" ".\mpv-subs-popout_$($version)_win64.zip"
- uses: actions/upload-artifact@v3
with:
name: windows-artifact
path: .\*.zip
build-linux:
name: 'Build for Linux'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache APT Packages
uses: awalsh128/[email protected]
with:
packages: libgtk-3-dev libcairo-gobject2 libcairo2-dev libc6 libpango1.0-dev libgdk-pixbuf2.0-dev libglib2.0-dev libatk1.0-dev libgdk3.0-cil-dev
version: 1.0
- name: Cargo Cache
uses: Swatinem/rust-cache@v2
- name: Build Binary
run: cargo build --release
- name: Build .deb
run: |
cargo install cargo-deb
cargo deb
- uses: actions/upload-artifact@v3
with:
name: linux-artifact
path: |
./target/release/mpv-subs-popout
./target/debian/*.deb