From 7ae32e83a6880badb0861d43f9d68b6328f232ed 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 --- .github/workflows/ci.yml | 4 + .github/workflows/distro.yml | 327 +++++++++++++++++++++++++++++++++++ 2 files changed, 331 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..ae7889be82 --- /dev/null +++ b/.github/workflows/distro.yml @@ -0,0 +1,327 @@ +name: Meson CI for Linux Distros + +on: + push: + branches: + - master + - feature + - cibuilds + paths-ignore: + - ".github/workflows/ci.yml" + pull_request: + branches: + - master + - feature + paths-ignore: + - ".github/workflows/ci.yml" + 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: + - avisynthplus: false + - lua52compat: false + - age: 2 +# libass ≥ ? +# 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 + - 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:latest + - group: suse + name: openSUSE Leap 15.6 + container: opensuse/leap: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 + -Dvapoursynth=enabled + + steps: + - name: Prerequisites (Arch Linux) + if: contains(matrix.container, 'archlinux') + run: pacman --noconfirm -Syu cmake git + + - 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 groupinstall --skip-broken \ + "C Development Tools and Libraries" + dnf -y install cmake git curl sudo libtool gettext + + - name: Add Repos (openSUSE Leap 15.5) + if: matrix.container == 'opensuse/leap:latest' + run: | + zypper addrepo -f https://download.opensuse.org/repositories/devel:/libraries:/c_c++/15.5/devel:libraries:c_c++.repo + zypper addrepo -f https://download.opensuse.org/repositories/devel:/tools:/building/15.5/devel:tools:building.repo + zypper addrepo -f https://download.opensuse.org/repositories/multimedia:/libs/15.5/multimedia:libs.repo + + - name: Add Repos (openSUSE Leap 15.6) + if: matrix.container == 'opensuse/leap:15.6' + run: | + zypper addrepo -f https://download.opensuse.org/repositories/devel:/libraries:/c_c++/15.6/devel:libraries:c_c++.repo + zypper addrepo -f https://download.opensuse.org/repositories/devel:/tools:/building/15.6/devel:tools:building.repo + zypper addrepo -f https://download.opensuse.org/repositories/multimedia:/libs/15.6/multimedia:libs.repo + + - name: Prerequisites (openSUSE) + if: matrix.group == 'suse' + run: | + zypper clean --all + zypper lr -d + zypper --gpg-auto-import-keys refresh + zypper update -y + zypper install -y -t pattern devel_C_C++ + zypper install -y gcc13 gcc13-c++ + zypper install -y cmake git curl sudo libtool gettext-runtime + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Git config add safe directory + run: git config --global --add safe.directory '/__w/Aegisub/Aegisub' + + - 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 (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 + 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_chrono1_84_0-devel \ + libboost_headers1_84_0-devel \ + libboost_filesystem1_84_0-devel \ + libboost_locale1_84_0-devel \ + libboost_regex1_84_0-devel \ + libboost_program_options1_84_0-devel + zypper install -y meson ninja libX11-6 libfreetype6 nasm \ + libfontconfig1 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-6-libavcodec-devel ffmpeg-6-libavdevice-devel \ + ffmpeg-6-libavfilter-devel ffmpeg-6-libavformat-devel \ + ffmpeg-6-libavutil-devel ffmpeg-6-libpostproc-devel \ + ffmpeg-6-libswresample-devel ffmpeg-6-libswscale-devel + + - name: Add non-root user + run: | + cat /etc/passwd + USERNAME=user1 + USER_UID=1001 + USER_GID=$USER_UID + 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 + chown -R $USERNAME:$USER_GID /__w/Aegisub/Aegisub + + - name: Download gtest + run: | + cd subprojects + sudo -u user1 mkdir packagecache + cd packagecache + sudo -u user1 curl -o gtest-1.14.0.tar.gz -L https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz + sudo -u user1 curl -o gtest_1.14.0-1_patch.zip -L https://wrapdb.mesonbuild.com/v2/gtest_1.14.0-1/get_patch + + - name: Download AviSynth+ + if: ${{ ! matrix.avisynthplus }} + run: | + cd subprojects + sudo -u user1 git clone --depth=1 -b 3.7 https://github.com/AviSynth/AviSynthPlus.git + mv AviSynthPlus avisynth + cd .. + sudo -u user1 meson subprojects packagefiles --apply avisynth + + - name: Download BestSource and FFMS2 + run: | + cd subprojects + sudo -u user1 git clone --recursive -b R2-RC1 https://github.com/vapoursynth/bestsource.git + cd bestsource + sudo -u user1 git reset --hard 9d7e218 + cd .. + patch --directory=./bestsource --forward --strip=1 < ./packagefiles/bestsource/0001.patch + sudo -u user1 git clone --depth=1 -b 5.0-RC3 https://github.com/FFMS/ffms2.git + cd .. + sudo -u user1 meson subprojects packagefiles --apply bestsource + sudo -u user1 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: Download LuaJIT + if: ${{ ! matrix.lua52compat }} + run: | + cd subprojects + sudo -u user1 git clone --depth=1 https://github.com/LuaJIT/LuaJIT.git + mv LuaJIT luajit + cd .. + sudo -u user1 meson subprojects packagefiles --apply luajit + + - name: Configure + if: ${{ ! startsWith(matrix.container, 'opensuse/leap') }} + run: | + C_FLAGS="-Wall -Wextra -Wpedantic" + CXX_FLAGS="-Wall -Wextra -Wpedantic" + sudo -u user1 meson setup build ${{ matrix.args }} -Dcpp_std=c++14 -Dbuildtype=${{ matrix.buildtype }} + + - name: Configure (openSUSE Leap) + if: startsWith(matrix.container, 'opensuse/leap') + run: | + C_FLAGS="-Wall -Wextra -Wpedantic" + CXX_FLAGS="-Wall -Wextra -Wpedantic" + sudo -u user1 CC=/usr/bin/gcc-13 CXX=/usr/bin/g++-13 meson setup build ${{ matrix.args }} -Dcpp_std=c++14 -Dbuildtype=${{ matrix.buildtype }} + + - name: Build + run: sudo -u user1 meson compile -C build + + - name: Run test + run: sudo -u user1 meson test -C build --verbose "gtest main" + + - name: Generate Package + run: | + mkdir -p pkgdir + meson install -C build --destdir=../pkgdir + ls -Ral pkgdir