name: CMake on: push: paths: - '.github/workflows/cmake.yml' - 'src/**' - 'CMakeModules/**' - CMakeLists.txt - 'protocols/**' branches: [ main ] tags: [ 'v*' ] pull_request: paths: - '.github/workflows/cmake.yml' - 'src/**' - 'CMakeModules/**' - CMakeLists.txt - 'protocols/**' branches: [ main ] workflow_dispatch: jobs: formatting: name: Formatting check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Run clang-format style check for C/C++ programs. uses: jidicula/clang-format-action@v4.18.0 with: check-path: "src" exclude-regex: "(src/External)" - run: echo "Formatted with clang-format version ${{ steps.clang-format.outputs.clang-format-version }}" tests: #needs: formatting env: BUILD_TYPE: Release strategy: matrix: os: [ubuntu-24.04] # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. # You can convert this to a matrix build if you need cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 with: submodules: true # cache some build information - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: key: ${{ github.job }}-${{ matrix.os }} - name: Install dependencies run: sudo apt-get update && sudo apt-get -y install libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv2 libfftw3-dev libfreetype-dev libdbus-1-dev - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=1 -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache - name: Build # Build your program with the given configuration run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target tests --verbose - name: Run tests # Run the unit tests available run: ${{github.workspace}}/build/output/tests build: needs: tests permissions: actions: read contents: read security-events: write strategy: matrix: include: - build_type: Release variant: kde disable_kde: 'OFF' - build_type: Release variant: generic disable_kde: 'ON' - build_type: Debug variant: kde disable_kde: 'OFF' runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 with: submodules: true - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: key: ${{ github.job }}-ubuntu-24.04-${{ matrix.build_type }}-${{ matrix.variant }} - name: Initialize CodeQL # Initializes the CodeQL tools for scanning. uses: github/codeql-action/init@v3 if: ${{ matrix.build_type == 'Debug' }} with: languages: 'cpp' - name: Install dependencies run: sudo apt-get update && sudo apt-get -y install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxxf86vm-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv2 libpulse-dev libpulse0 libfftw3-dev libfreetype-dev libdbus-1-dev wayland-scanner++ wayland-protocols libwayland-dev - name: Configure CMake run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DDISABLE_KDE_FEATURES=${{matrix.disable_kde}} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache - name: Build run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} --parallel --verbose - name: Perform CodeQL Analysis if: ${{ matrix.build_type == 'Debug' }} uses: github/codeql-action/analyze@v3 - name: Package if: ${{ matrix.build_type == 'Release' }} run: tools/package_release.sh build linux-wallpaperengine-${{ matrix.variant }}-ubuntu-24.04-x86_64 "$RUNNER_TEMP" - uses: actions/upload-artifact@v4 if: ${{ matrix.build_type == 'Release' }} with: name: linux-wallpaperengine-${{ matrix.variant }} path: ${{ runner.temp }}/linux-wallpaperengine-${{ matrix.variant }}-ubuntu-24.04-x86_64.tar.gz if-no-files-found: error distro-build: needs: tests strategy: fail-fast: false matrix: distro: [fedora-44, arch] variant: [kde, generic] include: - distro: fedora-44 image: fedora:44 install: >- dnf -y install git gcc gcc-c++ make cmake pkgconf-pkg-config binutils tar gzip libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel libXxf86vm-devel mesa-libGL-devel mesa-libEGL-devel glew-devel freeglut-devel sdl2-compat-devel lz4-devel zlib-ng-compat-devel ffmpeg-free-devel glm-devel glfw-devel mpv-devel pulseaudio-libs-devel freetype-devel harfbuzz-devel dbus-devel wayland-devel wayland-protocols-devel fftw-devel gmp-devel - distro: arch image: archlinux:latest install: >- pacman -Syu --noconfirm --needed git base-devel cmake glew freeglut sdl2-compat lz4 zlib ffmpeg glm glfw mpv libpulse freetype2 harfbuzz dbus wayland wayland-protocols mesa libxrandr libxinerama libxcursor libxi libxxf86vm fftw gmp runs-on: ubuntu-24.04 container: ${{ matrix.image }} steps: # git has to be there before checkout, otherwise it falls back to a tarball without submodules - name: Install dependencies run: ${{ matrix.install }} - uses: actions/checkout@v4 with: submodules: true - name: Configure CMake run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DDISABLE_KDE_FEATURES=${{ matrix.variant == 'generic' && 'ON' || 'OFF' }} - name: Build run: cmake --build build --parallel - name: Package run: tools/package_release.sh build linux-wallpaperengine-${{ matrix.variant }}-${{ matrix.distro }}-x86_64 "$RUNNER_TEMP" - uses: actions/upload-artifact@v4 with: name: linux-wallpaperengine-${{ matrix.variant }}-${{ matrix.distro }} path: ${{ runner.temp }}/linux-wallpaperengine-${{ matrix.variant }}-${{ matrix.distro }}-x86_64.tar.gz if-no-files-found: error release: needs: [build, distro-build] if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: path: release merge-multiple: true - name: Create release env: GH_TOKEN: ${{ github.token }} run: gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes release/*.tar.gz clang-build: needs: tests permissions: actions: read contents: read security-events: write strategy: matrix: build_type: [Debug, Release] # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. # You can convert this to a matrix build if you need cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 with: submodules: true - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: key: ${{ github.job }}-ubuntu-24.04-${{ matrix.build_type }} - name: Install dependencies run: sudo apt-get update && sudo apt-get -y install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxxf86vm-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv2 libpulse-dev libpulse0 libfftw3-dev libfreetype-dev libdbus-1-dev wayland-scanner++ wayland-protocols libwayland-dev - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ - name: Build # Build your program with the given configuration run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} --verbose