From f96356483d489cc2dc14d6212d102e3e5cb3d0fb Mon Sep 17 00:00:00 2001 From: 0tkl <118708188+0tkl@users.noreply.github.com> Date: Fri, 5 Apr 2024 17:19:01 +0800 Subject: [PATCH] Add CI for popular Linux distros Archlinux; Debian 11/12/Testing/Sid; Ubuntu 20.04/22.04/24.04; Fedora Latest/Rawhide; OpenSUSE Leap Stable/Next; OpenSUSE Tumbleweed Fix git for Ubuntu 20.04; openSUSE Leap still problematic --- .github/workflows/ci.yml | 4 + .github/workflows/distro.yml | 353 +++++++++++++++++++++++++++++++++++ 2 files changed, 357 insertions(+) create mode 100644 .github/workflows/distro.yml 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..baf40697d4 --- /dev/null +++ b/.github/workflows/distro.yml @@ -0,0 +1,353 @@ +name: Meson CI for Linux Distros + +on: + push: + branches: + - master + - feature + - cibuilds + paths-ignore: + - ".github/workflows/ci.yml" + - 'tools/osx-**' + - 'tools/win-installer-**' + pull_request: + branches: + - master + - feature + paths-ignore: + - ".github/workflows/ci.yml" + - '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:latest" + - "opensuse/leap:15.6" + - "opensuse/tumbleweed:latest" + buildtype: [release, debug] + include: + - cpp-std: "c++14" + - avisynthplus: false + - lua52compat: false + - age: 2 +# ffms2 ≥ 5.0 requires age ≤ 0; age ≥ 1 infers ffms2 < 5.0 +# libass ≥ 0.17.2 requires age ≤ 1; age ≥ 2 infers libass < 0.17.2 +# 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 + - 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 + - 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 + age: 3 + - group: rh + name: Fedora Rawhide + container: fedora:rawhide + lua52compat: true + - group: suse + name: openSUSE Leap 15.5 + container: opensuse/leap:15.5 + version: "15.5" + - group: suse + name: openSUSE Leap 15.6 + container: opensuse/leap:15.6 + version: "15.6" + - 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 for 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: Prerequisites (Fedora) + if: matrix.group == 'rh' + run: | + dnf -y 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 + + - name: Prerequisites (openSUSE) + if: matrix.group == 'suse' + run: | + zypper clean --all + zypper --gpg-auto-import-keys refresh + zypper update --no-confirm + zypper install -y --type pattern devel_C_C++ + zypper install -y gcc13 gcc13-c++ + zypper install -y cmake git curl sudo libtool gettext-runtime gettext-tools + + - 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: R4 + path: subprojects/bestsource + submodules: recursive + + - name: Checkout FFMS2 repo + uses: actions/checkout@v4 + with: + repository: FFMS/ffms2 + ref: 5.0-RC4 + 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 from pip (Old) + if: ${{ matrix.group == 'deb' && matrix.age >= 4 }} + run: | + apt-get install -y python3 python3-pip + pip install meson + + - name: Install meson from apt (New) + if: ${{ matrix.group == 'deb' && matrix.age <= 3 }} + run: apt-get install --no-install-recommends -y meson + + - 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 wxWidgets 3.0 (Old) + if: ${{ matrix.group == 'deb' && matrix.age >= 5 }} + run: apt-get install -y libwxgtk3.0-gtk3-dev wx3.0-i18n + + - name: Install wxWidgets 3.2 (New) + if: ${{ matrix.group == 'deb' && matrix.age <= 4 }} + run: apt-get install -y libwxgtk3.2-dev wx3.2-i18n + + - name: Install xxHash (Very Old Debian/Ubuntu) + if: ${{ matrix.group == 'deb' && matrix.age <= 5 }} + run: apt-get install -y libxxhash-dev + + - name: Install dependencies (Fedora) + if: matrix.group == 'rh' + run: | + dnf -y install pkgconf-pkg-config + dnf -y install --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 dependencies (openSUSE) + if: matrix.group == 'suse' + run: | + zypper install -y libboost_chrono-devel \ + libboost_headers-devel libboost_filesystem-devel \ + libboost_locale-devel libboost_regex-devel \ + libboost_program_options-devel + 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 \ + wxGTK3-3_2-devel vapoursynth-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: | + cd subprojects + mkdir packagecache + cd 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 and FFMS2 + run: | + cd subprojects/bestsource + git reset --hard 9d7e218 + cd .. + patch --directory=./bestsource --forward --strip=1 < ./packagefiles/bestsource/0001.patch + cd .. + meson subprojects packagefiles --apply bestsource + meson subprojects packagefiles --apply ffms2 + + - name: Download FFmpeg + if: matrix.age > 1 + run: | + cd subprojects + sudo -u user1 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 .. + sudo -u user1 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.cpp-std }} -Dbuildtype=${{ matrix.buildtype }} + + - name: Build + run: sudo -u $USERNAME meson compile -C build + + # TODO: Looking for openSUSE Leap users to fix it + - name: Run test + env: + IGNORE_ERROR: ${{ startsWith(matrix.container, 'opensuse/leap') && '|| true' || ''}} + run: | + sudo -u $USERNAME meson test -C build --verbose "gtest main"$IGNORE_ERROR + chown -R root:root /__w/Aegisub/Aegisub + + - name: Generate Package + run: | + mkdir -p pkgdir + meson install -C build --destdir=../pkgdir + tree pkgdir