diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8999ab7e3..fc34aa47c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,10 +6,14 @@ on: - master - feature - cibuilds + paths-ignore: + - ".github/workflows/distro.yml" pull_request: branches: - master - feature + paths-ignore: + - ".github/workflows/distro.yml" workflow_dispatch: jobs: diff --git a/.github/workflows/distro.yml b/.github/workflows/distro.yml new file mode 100644 index 0000000000..0604fed339 --- /dev/null +++ b/.github/workflows/distro.yml @@ -0,0 +1,390 @@ +name: Meson CI for Linux Distros + +on: + push: + branches: + - master + - feature + - cibuilds + paths-ignore: + - ".github/workflows/ci.yml" + - 'packages/osx_**' + - 'packages/win_**' + - 'tools/osx-**' + - 'tools/win-installer-**' + pull_request: + branches: + - master + - feature + paths-ignore: + - ".github/workflows/ci.yml" + - 'packages/osx_**' + - 'packages/win_**' + - '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:focal" + - "ubuntu:jammy" + - "ubuntu:noble" + - "fedora:latest" + - "fedora:rawhide" + - "opensuse/leap:15.5" + - "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 +# xxHash ≥ 0.8 requires age ≤ 5; age ≥ 6 infers xxHash < 0.8 + - age: 2 + - group: arch + name: Archlinux + container: archlinux:base-devel + avisynthplus: true + - group: deb + name: Debian 11 + container: debian:bullseye-backports + 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 + age: 1 + - group: deb + name: Ubuntu 20.04 + container: ubuntu:focal + age: 6 + - group: deb + name: Ubuntu 22.04 + container: ubuntu:jammy + age: 5 + - group: deb + name: Ubuntu 24.04 + container: ubuntu:noble + - group: rh + name: Fedora Latest + container: fedora:latest + lua52compat: true + - group: rh + name: Fedora Rawhide + container: fedora:rawhide + lua52compat: true + age: 1 + - group: suse + name: openSUSE Leap 15.5 + container: opensuse/leap:15.5 + version: "15.5" + localboost: true + - group: suse + name: openSUSE Leap 15.6 + container: opensuse/leap:15.6 + version: "15.6" + localboost: true + - group: suse + name: openSUSE Tumbleweed + container: opensuse/tumbleweed:latest + - 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 + -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.container == 'ubuntu:focal' + 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 + 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 + 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 gcc13 gcc13-c++ git glibc-locale-base 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-13 1 + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 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: R5 + 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: 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 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 -y libwxgtk3.0-gtk3-dev wx3.0-i18n + fi + + - name: Install xxHash (Ubuntu 20.04) + if: matrix.group == 'deb' && matrix.age <= 5 + run: apt-get install -y libxxhash-dev + + - 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 + + - 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 -y meson ninja nasm libnotify-devel libass-devel \ + intltool zlib-devel hunspell-devel libuchardet-devel \ + libpulse-devel fftw3-devel openal-soft-devel xxhash-devel \ + luajit-devel vapoursynth-devel + zypper install -y wxGTK3-3_2-devel + zypper install -y ffmpeg-7-libavcodec-devel ffmpeg-7-libavdevice-devel \ + ffmpeg-7-libavfilter-devel ffmpeg-7-libavformat-devel \ + ffmpeg-7-libavutil-devel ffmpeg-7-libpostproc-devel \ + ffmpeg-7-libswresample-devel ffmpeg-7-libswscale-devel + + - name: Download gtest + run: | + mkdir -p subprojects/packagecache + cd subprojects/packagecache + curl -o gtest-1.14.0.tar.gz -L https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz + curl -o gtest_1.14.0-1_patch.zip -L https://wrapdb.mesonbuild.com/v2/gtest_1.14.0-1/get_patch + + - 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 FFMS2 + if: matrix.age >= 2 + run: meson subprojects packagefiles --apply ffms2 + + - name: Download FFmpeg, add meson.build to FFmpeg + if: matrix.age >= 3 + run: | + cd subprojects + git clone --depth=1 -b meson-6.1 https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git + patch --directory=./ffmpeg --forward --strip=1 < ./packagefiles/ffmpeg/0001.patch + cd .. + meson subprojects packagefiles --apply ffmpeg + + - name: Add meson.build to LuaJIT + if: ${{ ! matrix.lua52compat }} + run: meson subprojects packagefiles --apply luajit + + - 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