name: CMake on: release: types: [ published ] workflow_dispatch: permissions: contents: read jobs: formatting: name: Formatting check runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Run clang-format style check for C/C++ programs. uses: jidicula/clang-format-action@654a770daa28443dd111d133e4083e21c1075674 # 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: submodules: true # cache some build information - name: ccache uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 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 libnode-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 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: submodules: true - name: ccache uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 with: key: ${{ github.job }}-ubuntu-24.04-${{ matrix.build_type }}-${{ matrix.variant }} - name: Install dependencies run: sudo apt-get update && sudo apt-get -y install libxrandr-dev libxinerama-dev libxcomposite-dev libxdamage-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 libnode-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 $(nproc) --verbose - 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@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 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 # Arch has V8's shared library only in the AUR (libnode, Node.js built with --shared). The package is kept as an # asset of the "libnode-arch" release, so the hour-long build only happens when the AUR bumps the version. A new # version starts from the previous one's ccache. LTO is off, makepkg's own -flto without node's --enable-lto # handling loses V8's assembly stack scanner at link time; debug is off since -g makes V8 much slower to compile libnode-arch: runs-on: ubuntu-24.04 container: archlinux:latest permissions: contents: write env: GH_TOKEN: ${{ github.token }} steps: - name: Install dependencies run: >- pacman -Syu --noconfirm --needed base-devel curl jq ccache ada brotli c-ares icu libffi libnghttp2 libnghttp3 libngtcp2 libuv openssl simdjson zlib zstd ninja procps-ng python - name: Fetch libnode PKGBUILD id: libnode run: | mkdir -p /tmp/libnode /tmp/libnode-pkg curl -fsSL "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=libnode" -o /tmp/libnode/PKGBUILD sed -i -e '/--enable-lto/d' -e "/^makedepends=/i options=('!lto' '!debug')" /tmp/libnode/PKGBUILD # parsed, not sourced (that would run AUR code as root) pkgver="$(sed -n 's/^pkgver=//p' /tmp/libnode/PKGBUILD | tr -d "'\"")" pkgrel="$(sed -n 's/^pkgrel=//p' /tmp/libnode/PKGBUILD | tr -d "'\"")" [ -n "$pkgver" ] && [ -n "$pkgrel" ] || { echo "no pkgver/pkgrel in the libnode PKGBUILD" >&2; exit 1; } echo "version=$pkgver-$pkgrel" >> "$GITHUB_OUTPUT" echo "asset=libnode-$pkgver-$pkgrel-x86_64.pkg.tar.zst" >> "$GITHUB_OUTPUT" - name: Download libnode from the release id: prebuilt run: | asset="${{ steps.libnode.outputs.asset }}" if curl -fsSL "https://github.com/$GITHUB_REPOSITORY/releases/download/libnode-arch/$asset" -o "/tmp/libnode-pkg/$asset"; then echo "hit=true" >> "$GITHUB_OUTPUT" else rm -f "/tmp/libnode-pkg/$asset" echo "hit=false" >> "$GITHUB_OUTPUT" fi - name: Restore ccache if: steps.prebuilt.outputs.hit != 'true' uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6 with: path: /tmp/libnode-ccache key: libnode-ccache-${{ steps.libnode.outputs.version }} restore-keys: libnode-ccache- - name: Build libnode if: steps.prebuilt.outputs.hit != 'true' run: | useradd -m builder mkdir -p /tmp/libnode-ccache chown -R builder /tmp/libnode /tmp/libnode-ccache su builder -c 'export CCACHE_DIR=/tmp/libnode-ccache CCACHE_MAXSIZE=2G CCACHE_COMPILERCHECK=content PATH=/usr/lib/ccache/bin:$PATH; ccache -z; cd /tmp/libnode && makepkg --noconfirm --nodeps; ccache -s' cp /tmp/libnode/libnode-[0-9]*.pkg.tar.zst "/tmp/libnode-pkg/${{ steps.libnode.outputs.asset }}" # saved right away, a later failure in this run must not throw the build away - name: Save ccache if: steps.prebuilt.outputs.hit != 'true' uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6 with: path: /tmp/libnode-ccache key: libnode-ccache-${{ steps.libnode.outputs.version }} - name: Publish libnode to the release if: steps.prebuilt.outputs.hit != 'true' run: | asset="${{ steps.libnode.outputs.asset }}" api="https://api.github.com/repos/$GITHUB_REPOSITORY" auth="Authorization: Bearer $GH_TOKEN" rel="$(curl -sS -H "$auth" "$api/releases/tags/libnode-arch")" id="$(echo "$rel" | jq -r '.id // empty')" if [ -z "$id" ]; then id="$(curl -fsS -H "$auth" -X POST "$api/releases" \ -d '{"tag_name":"libnode-arch","name":"libnode (Arch)","body":"Prebuilt AUR libnode packages for the CI, not an application release.","prerelease":true}' | jq -r .id)" fi old="$(curl -fsS -H "$auth" "$api/releases/$id/assets?per_page=100" | jq -r --arg n "$asset" '.[] | select(.name == $n) | .id')" for a in $old; do curl -fsS -H "$auth" -X DELETE "$api/releases/assets/$a"; done curl -fsS -H "$auth" -H "Content-Type: application/octet-stream" --data-binary "@/tmp/libnode-pkg/$asset" \ "https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$id/assets?name=$asset" > /dev/null # for the Arch distribution builds and the smoke test's fresh Arch container - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: name: libnode-arch path: /tmp/libnode-pkg/libnode-[0-9]*.pkg.tar.zst if-no-files-found: error distro-build: needs: [tests, libnode-arch] strategy: fail-fast: false matrix: distro: [fedora-44, arch] variant: [kde, generic] include: - distro: arch image: archlinux:latest # libnode comes from the libnode-arch job, these are its dependencies plus CEF's install: >- pacman -Syu --noconfirm --needed git base-devel curl 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 nss at-spi2-core libcups libxcomposite libxdamage libxkbcommon pango cairo alsa-lib libdrm libxshmfence ada brotli c-ares icu libffi libnghttp2 libnghttp3 libngtcp2 libuv openssl simdjson zstd - 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 libXcomposite-devel libXdamage-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 nodejs24-devel 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/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 if: matrix.distro == 'arch' with: name: libnode-arch path: /tmp/libnode-pkg - name: Install libnode if: matrix.distro == 'arch' run: pacman -U --noconfirm /tmp/libnode-pkg/libnode-[0-9]*.pkg.tar.zst - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 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 $(nproc) - name: Package run: tools/package_release.sh build linux-wallpaperengine-${{ matrix.variant }}-${{ matrix.distro }}-x86_64 "$RUNNER_TEMP" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 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 # one tarball for every distribution: built on Debian 12 (glibc 2.36, the oldest base with FFmpeg 5.1 and a # V8 >= 10.2 libnode), every library that isn't the system's bundled, glibc floor 2.35 (Ubuntu 22.04), see # tools/package_release.sh portable: needs: tests strategy: matrix: variant: [kde, generic] runs-on: ubuntu-24.04 container: debian:12 steps: - name: Install dependencies env: DEBIAN_FRONTEND: noninteractive run: >- apt-get update && apt-get -y install --no-install-recommends git ca-certificates curl build-essential cmake pkg-config patchelf python3 binutils libxrandr-dev libxinerama-dev libxcomposite-dev libxdamage-dev libxcursor-dev libxi-dev libgl-dev libegl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libxxf86vm-dev libglm-dev libglfw3-dev libmpv-dev libpulse-dev libfftw3-dev libfreetype-dev libharfbuzz-dev libdbus-1-dev libnode-dev libwayland-dev wayland-protocols libgmp-dev libnss3 libnspr4 libcups2 libatk1.0-0 libatk-bridge2.0-0 libxcomposite1 libxdamage1 libgbm1 libxkbcommon0 libasound2 libpango-1.0-0 libcairo2 libdrm2 libxshmfence1 libatspi2.0-0 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 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 $(nproc) - name: Package run: tools/package_release.sh --portable build linux-wallpaperengine-${{ matrix.variant }}-portable-x86_64 "$RUNNER_TEMP" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: name: linux-wallpaperengine-${{ matrix.variant }}-portable path: ${{ runner.temp }}/linux-wallpaperengine-${{ matrix.variant }}-portable-x86_64.tar.gz if-no-files-found: error # every release tarball unpacked in a bare container of the distributions it is meant for: libraries resolve # (portable: with only what a desktop has; distribution builds: plus their packages, found by soname) and # --help runs smoke: needs: [build, distro-build, portable] strategy: fail-fast: false matrix: include: - { image: 'ubuntu:22.04', tarball: kde-portable } - { image: 'ubuntu:22.04', tarball: generic-portable } - { image: 'ubuntu:24.04', tarball: kde-portable } - { image: 'ubuntu:26.04', tarball: kde-portable } - { image: 'debian:12', tarball: kde-portable } - { image: 'debian:13', tarball: kde-portable } - { image: 'fedora:43', tarball: kde-portable } - { image: 'fedora:44', tarball: kde-portable } - { image: 'fedora:45', tarball: kde-portable } - { image: 'opensuse/leap:16.0', tarball: kde-portable } - { image: 'opensuse/tumbleweed', tarball: kde-portable } - { image: 'archlinux:latest', tarball: kde-portable } - { image: 'ubuntu:24.04', tarball: kde-ubuntu-24.04 } - { image: 'fedora:44', tarball: kde-fedora-44 } - { image: 'archlinux:latest', tarball: kde-arch } runs-on: ubuntu-24.04 container: ${{ matrix.image }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 with: # the Ubuntu build's artifact has no distribution in its name name: linux-wallpaperengine-${{ matrix.tarball == 'kde-ubuntu-24.04' && 'kde' || matrix.tarball }} path: tarball - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 if: matrix.tarball == 'kde-arch' with: name: libnode-arch path: libnode - name: Smoke test run: | libnode=(libnode/libnode-[0-9]*.pkg.tar.zst) [ -e "${libnode[0]}" ] && export LIBNODE_PKG="$PWD/${libnode[0]}" tools/smoke_test_release.sh --install-deps tarball/*.tar.gz shell: bash release: needs: [build, distro-build, portable, smoke] if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 with: path: release merge-multiple: true - name: Upload to the release env: GH_TOKEN: ${{ github.token }} run: | # a release made on GitHub already exists, a manual run on a bare tag has none yet if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then gh release upload "$GITHUB_REF_NAME" --clobber release/*.tar.gz else gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes release/*.tar.gz fi # the -bin package points at the release's portable tarball, so it is updated after the upload aur: needs: release # pre-release tags are no valid pkgver if: ${{ !github.event.release.prerelease }} runs-on: ubuntu-latest env: HAS_AUR_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY != '' }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Set the version run: sed -i -e "s/^pkgver=.*/pkgver=${GITHUB_REF_NAME#v}/" -e "s/^pkgrel=.*/pkgrel=1/" packaging/aur/linux-wallpaperengine-kde-bin/PKGBUILD - name: Publish linux-wallpaperengine-kde-bin to the AUR if: env.HAS_AUR_KEY == 'true' uses: KSXGitHub/github-actions-deploy-aur@084b0d9b15415bf9cdb65d44dad1efe37a354050 # v4.2.0 with: pkgname: linux-wallpaperengine-kde-bin pkgbuild: ./packaging/aur/linux-wallpaperengine-kde-bin/PKGBUILD updpkgsums: true commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: Update to ${{ github.ref_name }} clang-build: needs: tests 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: submodules: true - name: ccache uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 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 libxcomposite-dev libxdamage-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 libnode-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