ci: Add more compilers to Ubuntu

May help us figure out unexpected incompatibilities in the future. While we still require C++14 or later, and may even upgrade to C++17 eventually, this should address some concerns about compatibility.

Plus it makes it easier to support things like Flatpak
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2023-05-14 01:14:50 +02:00 committed by Xaymar
parent a5f07e8228
commit b6391f13f8

View file

@ -320,50 +320,25 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
runner: [ "ubuntu-22.04", "ubuntu-20.04" ] runner: [ "ubuntu-22.04", "ubuntu-20.04" ]
compiler: [ "GCC", "Clang" ] compiler: [ "GCC-12", "GCC-11", "GCC-10", "Clang-16", "Clang-15", "Clang-14" ]
qt: [ 5, 6 ] qt: [ 5, 6 ]
CMAKE_GENERATOR: [ "Ninja Multi-Config" ]
exclude: exclude:
- runner: "ubuntu-22.04" - runner: "ubuntu-22.04"
qt: 5 qt: 5
- runner: "ubuntu-22.04"
compiler: "gcc-10"
- runner: "ubuntu-20.04" - runner: "ubuntu-20.04"
qt: 6 qt: 6
- runner: "ubuntu-20.04"
compiler: "gcc-12"
include: include:
- runner: "ubuntu-22.04" - runner: "ubuntu-22.04"
compiler: "GCC"
qt: 6
name: "Ubuntu 22.04" name: "Ubuntu 22.04"
package_name: "ubuntu22.04-qt6" package_name: "ubuntu22.04-qt6"
CMAKE_GENERATOR: "Ninja"
CMAKE_C_COMPILER: "gcc-12"
CMAKE_CXX_COMPILER: "g++-12"
CMAKE_LINKER_COMPILER: "ld"
- runner: "ubuntu-22.04"
compiler: "Clang"
qt: 6
name: "Ubuntu 22.04"
package_name: "ubuntu22.04-qt6-clang"
CMAKE_GENERATOR: "Ninja"
CMAKE_C_COMPILER: "clang-16"
CMAKE_CXX_COMPILER: "clang++16"
CMAKE_LINKER_COMPILER: "lld"
- runner: "ubuntu-20.04" - runner: "ubuntu-20.04"
compiler: "GCC"
qt: 5
name: "Ubuntu 20.04" name: "Ubuntu 20.04"
package_name: "ubuntu20.04-qt5" package_name: "ubuntu20.04-qt5"
CMAKE_GENERATOR: "Ninja"
CMAKE_C_COMPILER: "gcc-11"
CMAKE_CXX_COMPILER: "g++-11"
CMAKE_LINKER_COMPILER: "ld"
- runner: "ubuntu-20.04"
compiler: "Clang"
qt: 5
name: "Ubuntu 20.04"
package_name: "ubuntu20.04-qt5-clang"
CMAKE_GENERATOR: "Ninja"
CMAKE_C_COMPILER: "clang-16"
CMAKE_CXX_COMPILER: "clang++16"
CMAKE_LINKER_COMPILER: "lld"
runs-on: "${{ matrix.runner }}" runs-on: "${{ matrix.runner }}"
name: "${{ matrix.name }} (${{ matrix.compiler }}, Qt${{ matrix.qt }})" name: "${{ matrix.name }} (${{ matrix.compiler }}, Qt${{ matrix.qt }})"
env: env:
@ -371,9 +346,7 @@ jobs:
CMAKE_GENERATOR_PLATFORM: "${{ matrix.CMAKE_GENERATOR_PLATFORM }}" CMAKE_GENERATOR_PLATFORM: "${{ matrix.CMAKE_GENERATOR_PLATFORM }}"
CMAKE_GENERATOR_TOOLSET: "${{ matrix.CMAKE_GENERATOR_TOOLSET }}" CMAKE_GENERATOR_TOOLSET: "${{ matrix.CMAKE_GENERATOR_TOOLSET }}"
CMAKE_SYSTEM_VERSION: "${{ matrix.CMAKE_SYSTEM_VERSION }}" CMAKE_SYSTEM_VERSION: "${{ matrix.CMAKE_SYSTEM_VERSION }}"
CMAKE_C_COMPILER: "${{ matrix.CMAKE_C_COMPILER }}" PACKAGE_NAME: "streamfx-${{ matrix.package_name }}"
CMAKE_CXX_COMPILER: "${{ matrix.CMAKE_CXX_COMPILER }}"
CMAKE_LINKER_COMPILER: "${{ matrix.CMAKE_LINKER_COMPILER }}"
steps: steps:
- name: "Clone" - name: "Clone"
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -392,28 +365,37 @@ jobs:
cmake \ cmake \
ninja-build \ ninja-build \
git git
if [[ "${{ matrix.compiler }}" = GCC ]]; then IFS=$'-' compiler=(${{ matrix.compiler }})
if [[ "${{ matrix.runner }}" = ubuntu-20* ]]; then if [[ "${compiler[0]}" == "GCC" ]]; then
sudo apt-get install \ sudo apt-get install \
binutils gcc-11 g++11 binutils gcc-${compiler[1]} g++${compiler[1]}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 800 --slave /usr/bin/g++ g++ /usr/bin/g++-11 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${compiler[1]} 800 --slave /usr/bin/g++ g++ /usr/bin/g++-${compiler[1]}
else echo "CMAKE_C_COMPILER=gcc-${compiler[1]}" >> $GITHUB_ENV
sudo apt-get install \ echo "CMAKE_CXX_COMPILER=g++-${compiler[1]}" >> $GITHUB_ENV
binutils gcc-12 g++12 echo "CMAKE_C_FLAGS=-fuse-ld=ld" >> $GITHUB_ENV
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 800 --slave /usr/bin/g++ g++ /usr/bin/g++-12 echo "CMAKE_CXX_FLAGS=-fuse-ld=ld" >> $GITHUB_ENV
fi elif [[ "${compiler[0]}" == "Clang" ]]; then
else
curl -jLo /tmp/llvm.sh "https://apt.llvm.org/llvm.sh" curl -jLo /tmp/llvm.sh "https://apt.llvm.org/llvm.sh"
chmod +x /tmp/llvm.sh chmod +x /tmp/llvm.sh
sudo /tmp/llvm.sh 16 all sudo /tmp/llvm.sh ${compiler[1]} all
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 800 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 800 sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 800 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-16 800 sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-16 800 sudo update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-16 800 sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-16 800 sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${compiler[1]} 800
echo "CMAKE_C_COMPILER=clang-${compiler[1]}" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER=clang++-${compiler[1]}" >> $GITHUB_ENV
echo "CMAKE_C_FLAGS=-fuse-ld=ld.lld" >> $GITHUB_ENV
echo "CMAKE_CXX_FLAGS=-fuse-ld=ld.lld" >> $GITHUB_ENV
else
echo "Unknown Compiler"
exit 1
fi fi
# Adjust package name
echo "PACKAGE_NAME=${{ env.PACKAGE_NAME }}-${compiler[0]}${compiler[1]}" >> $GITHUB_ENV
- name: "Dependency: Qt" - name: "Dependency: Qt"
id: qt id: qt
shell: bash shell: bash
@ -437,7 +419,7 @@ jobs:
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: "${{ github.workspace }}/build/obs" path: "${{ github.workspace }}/build/obs"
key: "obs${{ env.obs_version }}-${{ matrix.runner }}-${{ env.CACHE_VERSION }}" key: "obs${{ env.obs_version }}-${{ matrix.runner }}-${{ matrix.compiler }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: OBS Libraries" - name: "Dependency: OBS Libraries"
id: obs id: obs
if: ${{ steps.obs-cache.outputs.cache-hit != 'true' }} if: ${{ steps.obs-cache.outputs.cache-hit != 'true' }}
@ -455,6 +437,8 @@ jobs:
cmake \ cmake \
-S "${{ github.workspace }}/third-party/obs-studio" \ -S "${{ github.workspace }}/third-party/obs-studio" \
-B "${{ github.workspace }}/build/obs" \ -B "${{ github.workspace }}/build/obs" \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/obs/install" \ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/obs/install" \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/build/obsdeps;${{ github.workspace }}/build/qt" \ -DCMAKE_PREFIX_PATH="${{ github.workspace }}/build/obsdeps;${{ github.workspace }}/build/qt" \
-DENABLE_PLUGINS=OFF \ -DENABLE_PLUGINS=OFF \
@ -462,11 +446,11 @@ jobs:
-DENABLE_SCRIPTING=OFF -DENABLE_SCRIPTING=OFF
cmake \ cmake \
--build "${{ github.workspace }}/build/obs" \ --build "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \ --config Release \
--target obs-frontend-api --target obs-frontend-api
cmake \ cmake \
--install "${{ github.workspace }}/build/obs" \ --install "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \ --config Release \
--component obs_libraries --component obs_libraries
- name: "Configure" - name: "Configure"
continue-on-error: true continue-on-error: true
@ -476,7 +460,7 @@ jobs:
-S "${{ github.workspace }}" \ -S "${{ github.workspace }}" \
-B "${{ github.workspace }}/build/ci" \ -B "${{ github.workspace }}/build/ci" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/ci/install" \ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/ci/install" \
-DPACKAGE_NAME="streamfx-${{ matrix.package_name }}" \ -DPACKAGE_NAME="streamfx-${{ env.PACKAGE_NAME }}" \
-DPACKAGE_PREFIX="${{ github.workspace }}/build/package" \ -DPACKAGE_PREFIX="${{ github.workspace }}/build/package" \
-Dlibobs_DIR="${{ github.workspace }}/build/obs/install" -Dlibobs_DIR="${{ github.workspace }}/build/obs/install"
- name: "Build: Debug" - name: "Build: Debug"