gha/ci: clean up linux.yml #170
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux Build | |
on: | |
push: | |
branches: | |
- master | |
- feature | |
- cibuilds | |
paths: | |
- '**' | |
- '!.github/workflows/**' | |
- '.github/workflows/linux.yml' | |
- '!docs/**' | |
- '!packages/**' | |
- 'packages/meson.build' | |
- 'packages/desktop/**' | |
- '!src/osx/**' | |
- '!tools/osx-**' | |
- '!tools/win-installer-**' | |
pull_request: | |
branches: | |
- master | |
- feature | |
paths: | |
- '**' | |
- '!.github/workflows/**' | |
- '.github/workflows/linux.yml' | |
- '!docs/**' | |
- '!packages/**' | |
- 'packages/meson.build' | |
- 'packages/desktop/**' | |
- '!src/osx/**' | |
- '!tools/osx-**' | |
- '!tools/win-installer-**' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: ${{ matrix.name }}, ${{ matrix.buildtype }} | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ matrix.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
container: | |
- "archlinux:base-devel" | |
- "debian:bullseye-backports" | |
- "debian:bookworm-slim" | |
- "debian:trixie-slim" | |
- "debian:unstable-slim" | |
- "ubuntu:jammy" | |
- "ubuntu:noble" | |
- "ubuntu:rolling" | |
- "fedora:latest" | |
- "fedora:rawhide" | |
- "opensuse/leap:15.6" | |
- "opensuse/tumbleweed:latest" | |
buildtype: [release, debug, debugoptimized] | |
include: | |
- cppstd: c++17 | |
- avisynthplus: false | |
- lua52compat: false | |
- localboost: false | |
# I assumed that the above distros do not often freeze specific packages at | |
# older versions, and packages in younger distros will never older than those | |
# in older distros. So we can get rid of setting version switches for each | |
# necessary packages. I use an abstract "age" instead. | |
# ffms2 ≥ 5.0 requires age ≤ 1; age ≥ 2 infers ffms2 < 5.0 | |
# ffmpeg ≥ 6.1 requires age ≤ 2; age ≥ 3 infers ffmpeg < 6.1 | |
# meson ≥ 1.0 requires age ≤ 3; age ≥ 4 infers meson < 1.0 | |
# wxWidgets ≥ 3.1 requires age ≤ 4; age ≥ 5 infers wxWidgets < 3.1 | |
- age: 1 | |
- group: arch | |
name: Archlinux | |
container: archlinux:base-devel | |
avisynthplus: true | |
- group: deb | |
name: Debian 11 | |
tmpname: debian | |
series: bullseye | |
container: debian:bullseye-backports | |
reponame: libs | |
age: 5 | |
- group: deb | |
name: Debian 12 | |
container: debian:bookworm-slim | |
age: 3 | |
- group: deb | |
name: Debian 13 | |
container: debian:trixie-slim | |
- group: deb | |
name: Debian Unstable | |
container: debian:unstable-slim | |
- group: deb | |
name: Ubuntu 22.04 | |
container: ubuntu:jammy | |
tmpname: ubuntu | |
series: jammy | |
reponame: universe | |
age: 5 | |
- group: deb | |
name: Ubuntu 24.04 | |
container: ubuntu:noble | |
- group: deb | |
name: Ubuntu 24.10 | |
container: ubuntu:rolling | |
age: 2 | |
- group: rh | |
name: Fedora Latest | |
container: fedora:latest | |
lua52compat: true | |
- group: rh | |
name: Fedora Rawhide | |
container: fedora:rawhide | |
lua52compat: true | |
- group: suse | |
name: openSUSE Leap 15.6 | |
container: opensuse/leap:15.6 | |
version: "15.6" | |
localboost: true | |
cppstd: c++20 | |
age: 2 | |
- group: suse | |
name: openSUSE Tumbleweed | |
container: opensuse/tumbleweed:latest | |
localboost: true | |
cppstd: c++20 | |
- args: >- | |
--prefix=/usr | |
-Ddefault_audio_output=PulseAudio | |
-Davisynth=enabled | |
-Dbestsource=enabled | |
-Dffms2=enabled | |
-Dffmpeg:default_library=shared | |
-Dffmpeg:gpl=enabled | |
-Dffmpeg:version3=enabled | |
-Dffmpeg:libdav1d=enabled | |
-Dfftw3=enabled | |
-Dvapoursynth=enabled | |
env: | |
USERNAME: user1 | |
USER_UID: 1001 | |
USER_GID: 1001 | |
steps: | |
- name: Prerequisites (Arch Linux) | |
if: contains(matrix.container, 'archlinux') | |
run: pacman --noconfirm -Syu cmake git | |
- name: Add Git PPA (Ubuntu 20.04) | |
if: matrix.name == 'Ubuntu 20.04' | |
run: | | |
DEBIAN_FRONTEND=noninteractive apt-get update | |
DEBIAN_FRONTEND=noninteractive apt-get install \ | |
--no-install-recommends -y software-properties-common | |
add-apt-repository ppa:git-core/ppa | |
- name: Prerequisites (Debian & Ubuntu) | |
if: matrix.group == 'deb' | |
run: | | |
DEBIAN_FRONTEND=noninteractive apt-get update | |
DEBIAN_FRONTEND=noninteractive apt-get install \ | |
--no-install-recommends -y cmake git curl \ | |
ca-certificates sudo build-essential \ | |
autoconf automake libtool gettext libgettextpo-dev | |
- name: Add RPM Fusion repo (Fedora) | |
if: matrix.container == 'fedora:rawhide' | |
run: | | |
dnf clean all | |
dnf -y update --exclude=dnf | |
dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm | |
- name: Prerequisites (Fedora) | |
if: matrix.group == 'rh' | |
run: | | |
dnf clean all | |
dnf -y update --exclude=dnf | |
dnf -y group install --skip-broken c-development | |
dnf -y install cmake git curl sudo libtool gettext | |
- name: Add repos (openSUSE Leap) | |
if: startsWith(matrix.container, 'opensuse/leap') | |
env: | |
VER: ${{ matrix.version }} | |
run: | | |
zypper addrepo -p 90 -f https://download.opensuse.org/repositories/devel:/libraries:/c_c++/$VER/devel:libraries:c_c++.repo | |
zypper addrepo -p 90 -f https://download.opensuse.org/repositories/devel:/tools:/building/$VER/devel:tools:building.repo | |
zypper addrepo -p 90 -f https://download.opensuse.org/repositories/multimedia:/libs/$VER/multimedia:libs.repo | |
# glibc-locale is installed in tumbleweed image by default, but not in leap | |
- name: Prerequisites (openSUSE) | |
if: matrix.group == 'suse' | |
run: | | |
zypper clean --all | |
zypper --gpg-auto-import-keys refresh | |
zypper update --no-confirm | |
zypper install -y --allow-downgrade --type pattern devel_C_C++ | |
zypper install -y --allow-downgrade cmake curl gcc14 gcc14-c++ git glibc-locale-base gzip sudo | |
- name: Set latest gcc/g++ as default (openSUSE Leap) | |
if: startsWith(matrix.container, 'opensuse/leap') | |
run: | | |
zypper remove -y gcc7 gcc7-c++ | |
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 1 | |
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 1 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout Avisynth+ repo | |
if: ${{ ! matrix.avisynthplus }} | |
uses: actions/checkout@v4 | |
with: | |
repository: AviSynth/AviSynthPlus | |
ref: "3.7" | |
path: subprojects/avisynth | |
- name: Checkout BestSource repo | |
uses: actions/checkout@v4 | |
with: | |
repository: vapoursynth/bestsource | |
ref: R8 | |
path: subprojects/bestsource | |
submodules: recursive | |
- name: Checkout FFMS2 repo | |
if: matrix.age >= 2 | |
uses: actions/checkout@v4 | |
with: | |
repository: FFMS/ffms2 | |
ref: "5.0" | |
path: subprojects/ffms2 | |
submodules: recursive | |
- name: Checkout LuaJIT repo | |
if: ${{ ! matrix.lua52compat }} | |
uses: actions/checkout@v4 | |
with: | |
repository: LuaJIT/LuaJIT | |
path: subprojects/luajit | |
- name: Checkout vapoursynth repo | |
if: matrix.group == 'deb' | |
uses: actions/checkout@v4 | |
with: | |
repository: vapoursynth/vapoursynth | |
ref: R70 | |
path: subprojects/vapoursynth | |
- name: Install dependencies (Arch Linux) | |
if: contains(matrix.container, 'archlinux') | |
run: | | |
pacman --noconfirm -Syu wireplumber | |
pacman --noconfirm -Sy pipewire-jack | |
pacman --noconfirm -Sy avisynthplus boost ffmpeg fftw \ | |
fontconfig hunspell libass libglvnd meson openal portaudio \ | |
python pulseaudio uchardet vapoursynth wxwidgets-gtk3 | |
- name: Install meson (Debian/Ubuntu) | |
if: matrix.group == 'deb' | |
run: | | |
if [ ${{ matrix.age }} -le 3 ] | |
then | |
apt-get install --no-install-recommends -y meson | |
else | |
apt-get install -y python3 python3-pip | |
pip install meson | |
fi | |
- name: Install some dependencies (Debian/Ubuntu) | |
if: matrix.group == 'deb' | |
run: | | |
apt-get install -y pkg-config | |
apt-get install --no-install-recommends -y nasm \ | |
ninja-build libx11-dev libfreetype6-dev libfontconfig1-dev \ | |
libnotify-dev libass-dev libasound2-dev intltool \ | |
libboost-all-dev libhunspell-dev libuchardet-dev \ | |
libpulse-dev libopenal-dev libfftw3-dev libopus-dev | |
- name: Install FFmpeg 6.1+ (Debian 13+, Ubuntu 24.04+) | |
if: matrix.group == 'deb' && matrix.age <= 2 | |
run: | | |
apt-get install -y \ | |
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev \ | |
libavutil-dev libpostproc-dev libswresample-dev libswscale-dev | |
- name: Install dav1d and xxHash (Debian/Ubuntu) | |
if: matrix.group == 'deb' | |
run: apt-get install -y libdav1d-dev libxxhash-dev | |
- name: Install FFMS2 (Debian Unstable) | |
if: matrix.group == 'deb' && matrix.age <= 1 | |
run: apt-get install -y libffms2-dev | |
- name: Install wxWidgets (Debian/Ubuntu) | |
if: matrix.group == 'deb' | |
run: | | |
if [ ${{ matrix.age }} -le 4 ] | |
then | |
apt-get install -y libwxgtk3.2-dev wx3.2-i18n | |
else | |
apt-get install --no-install-recommends -y gnupg software-properties-common | |
apt-get update | |
apt-key adv --fetch-keys https://repos.codelite.org/CodeLite.asc | |
apt-add-repository 'deb https://repos.codelite.org/wx3.2/${{ matrix.tmpname }}/ ${{ matrix.series }} ${{ matrix.reponame }}' | |
apt-get update | |
apt-get install -y libwxgtk3.2unofficial-dev libsdl2-dev wx3.2-i18n libgtk-3-dev | |
fi | |
- name: Install dependencies (Fedora) | |
if: matrix.group == 'rh' | |
run: | | |
dnf install -y pkgconf-pkg-config | |
dnf install -y --skip-broken meson ninja-build libX11 freetype nasm \ | |
fontconfig-devel libnotify-devel libass-devel intltool zlib-devel \ | |
boost-devel hunspell-devel uchardet-devel pulseaudio-libs-devel \ | |
fftw-devel openal-soft xxhash-devel luajit-devel wxGTK-devel \ | |
ffmpeg-free-devel opus-devel vapoursynth-devel | |
- name: Install FFMS2 (Fedora Rawhide) | |
if: matrix.group == 'rh' && matrix.age <= 1 | |
run: dnf install -y ffms2-devel | |
# In Leap, boost in devel_libraries_c_c++ links to very old libstdc++ | |
- name: Install Boost (openSUSE Tumbleweed) | |
if: startsWith(matrix.container, 'opensuse/tumbleweed') | |
run: | | |
zypper install -y libboost_chrono-devel \ | |
libboost_headers-devel libboost_filesystem-devel \ | |
libboost_locale-devel libboost_regex-devel \ | |
libboost_program_options-devel | |
# wxWidgets-3_2-devel on openSUSE links to GTK2 | |
# Info: wxGTK3-3_2 in the main repo of Leap is actually v3.1.5 | |
- name: Install some dependencies (openSUSE) | |
if: matrix.group == 'suse' | |
run: | | |
zypper install --allow-downgrade -y meson ninja nasm \ | |
libnotify-devel libass-devel intltool zlib-ng-compat-devel \ | |
hunspell-devel libuchardet-devel libpulse-devel fftw3-devel \ | |
openal-soft-devel xxhash-devel luajit-devel vapoursynth-devel | |
zypper install --allow-downgrade -y wxGTK3-3_2-devel | |
zypper install --allow-downgrade -y ffmpeg-7-libavcodec-devel \ | |
ffmpeg-7-libavdevice-devel ffmpeg-7-libavfilter-devel \ | |
ffmpeg-7-libavformat-devel ffmpeg-7-libavutil-devel \ | |
ffmpeg-7-libswresample-devel ffmpeg-7-libswscale-devel | |
- name: Download gtest | |
run: | | |
mkdir -p subprojects/packagecache | |
cd subprojects/packagecache | |
curl -o gtest-1.15.2.tar.gz -L https://github.com/google/googletest/archive/refs/tags/v1.15.2.tar.gz | |
curl -o gtest_1.15.2-1_patch.zip -L https://wrapdb.mesonbuild.com/v2/gtest_1.15.2-1/get_patch | |
- name: Download boost | |
if: matrix.localboost | |
working-directory: subprojects/packagecache | |
run: | | |
curl -o boost_1_87_0.tar.gz -L https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz | |
tar -xvzf boost_1_87_0.tar.gz -C .. | |
- name: Add meson.build to AviSynth+ | |
if: ${{ ! matrix.avisynthplus }} | |
run: meson subprojects packagefiles --apply avisynth | |
- name: Add meson.build to BestSource | |
run: meson subprojects packagefiles --apply bestsource | |
- name: Add meson.build to boost | |
if: matrix.localboost | |
run: meson subprojects packagefiles --apply boost | |
- name: Add meson.build to FFMS2 | |
if: matrix.age >= 2 | |
run: meson subprojects packagefiles --apply ffms2 | |
- name: Download FFmpeg, add meson.build to FFmpeg | |
if: matrix.age >= 3 | |
run: | | |
git clone --depth=1 -b meson-7.1 \ | |
https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git subprojects/ffmpeg | |
meson subprojects packagefiles --apply ffmpeg | |
- name: Add meson.build to LuaJIT | |
if: ${{ ! matrix.lua52compat }} | |
run: meson subprojects packagefiles --apply luajit | |
- name: Add meson.build to vapoursynth | |
if: matrix.group == 'deb' | |
run: meson subprojects packagefiles --apply vapoursynth | |
- name: Add non-root user | |
run: | | |
groupadd --gid $USER_GID $USERNAME | |
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME | |
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME | |
chmod 0440 /etc/sudoers.d/$USERNAME | |
- name: Configure | |
run: | | |
chown -R $USERNAME:$USER_GID /__w/Aegisub/Aegisub | |
sudo -u $USERNAME C_FLAGS="-Wall -Wextra -Wpedantic" CXX_FLAGS="-Wall -Wextra -Wpedantic" \ | |
meson setup build ${{ matrix.args }} -Dcpp_std=${{ matrix.cppstd }} -Dbuildtype=${{ matrix.buildtype }} -Dlocal_boost=${{ matrix.localboost }} | |
- name: Build | |
run: sudo -u $USERNAME meson compile -C build | |
- name: Run test | |
run: | | |
sudo -u $USERNAME meson test -C build --verbose "gtest main" | |
chown -R root:root /__w/Aegisub/Aegisub | |
- name: Generate Package | |
run: | | |
mkdir -p pkgdir | |
meson install -C build --destdir=../pkgdir | |
case ${{ matrix.group }} in | |
arch) pacman --noconfirm -Sy tree ;; | |
deb) apt-get install -y tree ;; | |
rh) dnf install -y tree ;; | |
suse) zypper install -y tree ;; | |
esac | |
tree pkgdir |