Moving windows around doesn't retrigger a full dmon reload, only appl… #680
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) 2026 LNXSeus. All Rights Reserved. | |
| # | |
| # This project is proprietary software. You are granted a license to use the software as-is. | |
| # You may not copy, distribute, modify, reverse-engineer, maintain a fork, or use this software | |
| # or its source code in any way without the express written permission of the copyright holder. | |
| # | |
| # Created by Linus on 14.09.2025. | |
| # | |
| name: Build and Package | |
| # This workflow runs on pushes and pull requests to the main branches. | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| # Job 1: Build, Test, and Package the Linux version | |
| build_linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # --- Auto-Update Files (PKGBUILD & metainfo.xml) with Version from main.h --- | |
| - name: Update Linux Packaging Files | |
| run: | | |
| # 1. Extract Version from main.h | |
| VERSION=$(grep '#define ADVANCELY_VERSION' source/main.h | sed -E 's/.*"v([0-9]+\.[0-9]+\.[0-9]+)".*/\1/') | |
| echo "Detected Version: $VERSION" | |
| # 2. Update PKGBUILD (packaging/linux/PKGBUILD) - Should only be done for Releases | |
| # sed -i "s/^pkgver=.*/pkgver=$VERSION/" packaging/linux/PKGBUILD | |
| # sed -i "s/^pkgrel=.*/pkgrel=1/" packaging/linux/PKGBUILD | |
| # 3. Update Metainfo (packaging/linux/dev.LNXSeus.Advancely.metainfo.xml) | |
| METAINFO="packaging/linux/dev.LNXSeus.Advancely.metainfo.xml" | |
| DATE=$(date +%Y-%m-%d) | |
| # Inject new release block if it doesn't exist | |
| if ! grep -q "version=\"$VERSION\"" "$METAINFO"; then | |
| echo "Injecting release note for $VERSION..." | |
| sed -i "/<releases>/a \\ | |
| <release version=\"$VERSION\" date=\"$DATE\">\\ | |
| <description>\\ | |
| <ul>\\ | |
| <li>Update to version $VERSION</li>\\ | |
| </ul>\\ | |
| </description>\\ | |
| </release>" "$METAINFO" | |
| fi | |
| # Verify file contents | |
| head -n 20 "$METAINFO" | |
| - name: Install dependencies (Linux) | |
| run: | | |
| sudo apt-get update | |
| # Added 'rpm' here so CPack can generate Fedora packages | |
| sudo apt-get install -y build-essential cmake git libcurl4-openssl-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev libdecor-0-dev libxkbcommon-dev libfreetype6-dev libharfbuzz-dev libasound2-dev libxtst-dev rpm | |
| git clone https://github.com/libsdl-org/SDL.git -b main && cd SDL && cmake -B build && cmake --build build && sudo cmake --install build && cd .. | |
| git clone https://github.com/libsdl-org/SDL_image.git -b main && cd SDL_image && cmake -B build && cmake --build build && sudo cmake --install build && cd .. | |
| git clone https://github.com/libsdl-org/SDL_ttf.git -b main && cd SDL_ttf && cmake -B build && cmake --build build && sudo cmake --install build && cd .. | |
| - name: Configure CMake (Linux) | |
| run: cmake -B build -DCMAKE_BUILD_TYPE=Release | |
| - name: Build Project | |
| run: cmake --build build --config Release | |
| - name: Run Executable Test (Linux) | |
| run: | | |
| echo "Running executable for 5 seconds..." | |
| timeout 5s ./build/Advancely --test-mode > output.txt 2>&1 || true | |
| echo "Executable run finished. Contents of output.txt:" | |
| cat output.txt | |
| - name: Upload Test Output (Linux) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-output-v${{ env.PROJECT_VERSION }}-Linux | |
| path: output.txt | |
| # --- Generate System Packages (.deb / .rpm) --- | |
| - name: Package System Installers (CPack) | |
| run: | | |
| cd build | |
| cpack -G "DEB;RPM" | |
| ls -l *.deb *.rpm # List files to verify generation | |
| # --- Upload Packages Separately --- | |
| # Upload the Debian (.deb) package | |
| - name: Upload Linux Debian Package (.deb) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Advancely-v${{ env.PROJECT_VERSION }}-Linux-DEB | |
| path: build/*.deb | |
| # Upload the RPM (.rpm) package | |
| - name: Upload Linux RPM Package (.rpm) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Advancely-v${{ env.PROJECT_VERSION }}-Linux-RPM | |
| path: build/*.rpm | |
| # --- Create Portable Zip (Legacy Support) --- | |
| - name: Create Portable Zip | |
| shell: bash | |
| run: | | |
| mkdir release | |
| mkdir release/lib | |
| cp build/Advancely release/ | |
| cp -r resources release/ | |
| cp _PLEASE_READ_ME.txt LICENSES.txt README.md release/ | |
| # Copy dependencies for portable use into the lib directory | |
| # precisely matching the $ORIGIN/lib RPATH set in CMake | |
| cp /usr/local/lib/libSDL3.so.0 release/lib/ | |
| cp /usr/local/lib/libSDL3_image.so.0 release/lib/ | |
| cp /usr/local/lib/libSDL3_ttf.so.0 release/lib/ | |
| # --- Upload Legacy Artifact --- | |
| # This preserves the exact name 'Advancely-v...-Linux' | |
| # GitHub Actions will zip the 'release' folder contents into it. | |
| # auto-updater will find this exactly as before. | |
| - name: Upload Linux Release Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Advancely-v${{ env.PROJECT_VERSION }}-Linux | |
| path: release/ | |
| # Job 2: Build, Test, and Bundle the macOS Intel (X64) version | |
| build_macos_intel: | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies (macOS) | |
| # 1. Manually install the x86_64 version of Homebrew into /usr/local | |
| # This is required for cross-compiling on an ARM64 runner. | |
| # 2. Use that Homebrew to install the x86_64 dependencies. | |
| run: | | |
| arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| /usr/local/bin/brew install sdl3 sdl3_image sdl3_ttf curl jpeg-xl webp | |
| - name: Configure CMake (macOS) | |
| run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/usr/local" -DCMAKE_OSX_DEPLOYMENT_TARGET="13.0" -DCMAKE_OSX_ARCHITECTURES="x86_64" | |
| - name: Build Project | |
| run: cmake --build build --config Release | |
| - name: Install gtimeout (GNU Coreutils) | |
| run: brew install coreutils | |
| - name: Bundle macOS Dependencies | |
| shell: bash | |
| run: | | |
| BUNDLE_PATH="build/Advancely.app" | |
| EXE_PATH="$BUNDLE_PATH/Contents/MacOS/Advancely" | |
| LIBS_DEST_DIR="$BUNDLE_PATH/Contents/MacOS" | |
| BREW_PREFIX="/usr/local" # Hardcode the Intel (x86_64) Homebrew prefix | |
| LIBS_TO_PROCESS=($(otool -L "$EXE_PATH" | grep "$BREW_PREFIX" | awk '{gsub(/:$/, ""); print $1}')) | |
| TEMP_DEPS_LIST=() | |
| i=0 | |
| while [ $i -lt ${#LIBS_TO_PROCESS[@]} ]; do | |
| original_lib_path=${LIBS_TO_PROCESS[$i]} | |
| i=$((i+1)) | |
| if [[ " ${TEMP_DEPS_LIST[*]} " =~ " ${original_lib_path} " ]]; then continue; fi | |
| TEMP_DEPS_LIST+=("$original_lib_path") | |
| lib_name=$(basename "$original_lib_path") | |
| actual_lib_path="$BREW_PREFIX/lib/$lib_name" | |
| if [ ! -f "$actual_lib_path" ]; then echo "::error::Cannot find '$lib_name'"; exit 1; fi | |
| TRANSITIVE_DEPS=($(otool -L "$actual_lib_path" | grep -E "$BREW_PREFIX|@rpath" | awk '{gsub(/:$/, ""); print $1}')) | |
| for dep in "${TRANSITIVE_DEPS[@]}"; do LIBS_TO_PROCESS+=("$dep"); done | |
| done | |
| UNIQUE_ORIGINAL_PATHS=($(echo "${LIBS_TO_PROCESS[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) | |
| UNIQUE_BASENAMES=($(for path in "${UNIQUE_ORIGINAL_PATHS[@]}"; do basename "$path"; done | sort -u)) | |
| for lib_name in "${UNIQUE_BASENAMES[@]}"; do | |
| cp "$BREW_PREFIX/lib/$lib_name" "$LIBS_DEST_DIR/" | |
| done | |
| for original_lib_path in "${UNIQUE_ORIGINAL_PATHS[@]}"; do | |
| lib_name=$(basename "$original_lib_path") | |
| install_name_tool -change "$original_lib_path" "@executable_path/$lib_name" "$EXE_PATH" | |
| done | |
| for copied_lib_path in "$LIBS_DEST_DIR"/lib*.dylib; do | |
| copied_lib_name=$(basename "$copied_lib_path") | |
| install_name_tool -id "@executable_path/$copied_lib_name" "$copied_lib_path" | |
| for original_lib_path in "${UNIQUE_ORIGINAL_PATHS[@]}"; do | |
| original_lib_name=$(basename "$original_lib_path") | |
| install_name_tool -change "$original_lib_path" "@executable_path/$original_lib_name" "$copied_lib_path" | |
| done | |
| done | |
| codesign --force --sign - "$LIBS_DEST_DIR"/lib*.dylib | |
| codesign --force --deep --sign - "$BUNDLE_PATH" | |
| # Testing | |
| - name: Run Executable Test (macOS Intel) | |
| run: | | |
| echo "Running executable for 5 seconds..." | |
| gtimeout 10s ./build/Advancely.app/Contents/MacOS/Advancely --test-mode > output.txt 2>&1 || true | |
| echo "Executable run finished. Contents of output.txt:" | |
| cat output.txt | |
| - name: Upload Test Output (macOS Intel) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-output-v${{ env.PROJECT_VERSION }}-macOS-X64 | |
| path: output.txt | |
| - name: Upload Intel App Bundle | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Advancely-v${{ env.PROJECT_VERSION }}-macOS-X64-app | |
| path: build/Advancely.app | |
| # Job 3: Build, Test, and Bundle the macOS Apple Silicon (ARM64) version | |
| build_macos_arm: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies (macOS) | |
| run: brew install sdl3 sdl3_image sdl3_ttf curl jpeg-xl webp | |
| - name: Configure CMake (macOS) | |
| run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$(brew --prefix) -DCMAKE_OSX_DEPLOYMENT_TARGET="13.0" | |
| - name: Build Project | |
| run: cmake --build build --config Release | |
| - name: Install gtimeout (GNU Coreutils) | |
| run: brew install coreutils | |
| - name: Run Executable Test (macOS ARM) | |
| run: | | |
| echo "Running executable for 5 seconds..." | |
| gtimeout 5s ./build/Advancely.app/Contents/MacOS/Advancely --test-mode > output.txt 2>&1 || true | |
| echo "Executable run finished. Contents of output.txt:" | |
| cat output.txt | |
| - name: Upload Test Output (macOS ARM) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-output-v${{ env.PROJECT_VERSION }}-macOS-ARM64 | |
| path: output.txt | |
| - name: Bundle macOS Dependencies | |
| shell: bash | |
| run: | | |
| BUNDLE_PATH="build/Advancely.app" | |
| EXE_PATH="$BUNDLE_PATH/Contents/MacOS/Advancely" | |
| LIBS_DEST_DIR="$BUNDLE_PATH/Contents/MacOS" | |
| BREW_PREFIX=$(brew --prefix) | |
| LIBS_TO_PROCESS=($(otool -L "$EXE_PATH" | grep "$BREW_PREFIX" | awk '{gsub(/:$/, ""); print $1}')) | |
| TEMP_DEPS_LIST=() | |
| i=0 | |
| while [ $i -lt ${#LIBS_TO_PROCESS[@]} ]; do | |
| original_lib_path=${LIBS_TO_PROCESS[$i]} | |
| i=$((i+1)) | |
| if [[ " ${TEMP_DEPS_LIST[*]} " =~ " ${original_lib_path} " ]]; then continue; fi | |
| TEMP_DEPS_LIST+=("$original_lib_path") | |
| lib_name=$(basename "$original_lib_path") | |
| actual_lib_path="$BREW_PREFIX/lib/$lib_name" | |
| if [ ! -f "$actual_lib_path" ]; then echo "::error::Cannot find '$lib_name'"; exit 1; fi | |
| TRANSITIVE_DEPS=($(otool -L "$actual_lib_path" | grep -E "$BREW_PREFIX|@rpath" | awk '{gsub(/:$/, ""); print $1}')) | |
| for dep in "${TRANSITIVE_DEPS[@]}"; do LIBS_TO_PROCESS+=("$dep"); done | |
| done | |
| UNIQUE_ORIGINAL_PATHS=($(echo "${LIBS_TO_PROCESS[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) | |
| UNIQUE_BASENAMES=($(for path in "${UNIQUE_ORIGINAL_PATHS[@]}"; do basename "$path"; done | sort -u)) | |
| for lib_name in "${UNIQUE_BASENAMES[@]}"; do | |
| cp "$BREW_PREFIX/lib/$lib_name" "$LIBS_DEST_DIR/" | |
| done | |
| for original_lib_path in "${UNIQUE_ORIGINAL_PATHS[@]}"; do | |
| lib_name=$(basename "$original_lib_path") | |
| install_name_tool -change "$original_lib_path" "@executable_path/$lib_name" "$EXE_PATH" | |
| done | |
| for copied_lib_path in "$LIBS_DEST_DIR"/lib*.dylib; do | |
| copied_lib_name=$(basename "$copied_lib_path") | |
| install_name_tool -id "@executable_path/$copied_lib_name" "$copied_lib_path" | |
| for original_lib_path in "${UNIQUE_ORIGINAL_PATHS[@]}"; do | |
| original_lib_name=$(basename "$original_lib_path") | |
| install_name_tool -change "$original_lib_path" "@executable_path/$original_lib_name" "$copied_lib_path" | |
| done | |
| done | |
| codesign --force --sign - "$LIBS_DEST_DIR"/lib*.dylib | |
| codesign --force --deep --sign - "$BUNDLE_PATH" | |
| - name: Upload ARM App Bundle | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Advancely-v${{ env.PROJECT_VERSION }}-macOS-ARM64-app | |
| path: build/Advancely.app | |
| # Job 4: Combine macOS builds into a universal package | |
| package_universal_macos: | |
| runs-on: macos-latest | |
| needs: [ build_macos_intel, build_macos_arm ] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies (macOS) | |
| run: brew install sdl3 sdl3_image sdl3_ttf curl jpeg-xl webp | |
| - name: Configure CMake to get version | |
| run: cmake -B build -DCMAKE_PREFIX_PATH=$(brew --prefix) | |
| - name: Download Intel build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: Advancely-v${{ env.PROJECT_VERSION }}-macOS-X64-app | |
| path: build-x64/Advancely.app | |
| - name: Download ARM build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: Advancely-v${{ env.PROJECT_VERSION }}-macOS-ARM64-app | |
| path: build-arm64/Advancely.app | |
| - name: Create Universal App from Bundled Artifacts | |
| shell: bash | |
| run: | | |
| INTEL_APP_PATH="build-x64/Advancely.app" | |
| ARM_APP_PATH="build-arm64/Advancely.app" | |
| UNIVERSAL_APP_PATH="release/Advancely.app" | |
| echo "Setting up universal app structure..." | |
| mkdir -p release/ | |
| cp -R "$ARM_APP_PATH" "$UNIVERSAL_APP_PATH" | |
| echo "Creating universal executable..." | |
| lipo -create -output "$UNIVERSAL_APP_PATH/Contents/MacOS/Advancely" \ | |
| "$INTEL_APP_PATH/Contents/MacOS/Advancely" \ | |
| "$ARM_APP_PATH/Contents/MacOS/Advancely" | |
| echo "Creating universal libraries..." | |
| ARM_LIBS_DIR="$UNIVERSAL_APP_PATH/Contents/MacOS" | |
| INTEL_LIBS_DIR="$INTEL_APP_PATH/Contents/MacOS" | |
| for arm_lib_path in $(find "$ARM_LIBS_DIR" -name "*.dylib"); do | |
| lib_name=$(basename "$arm_lib_path") | |
| intel_lib_path="$INTEL_LIBS_DIR/$lib_name" | |
| if [ -f "$intel_lib_path" ]; then | |
| echo "Merging $lib_name..." | |
| lipo -create -output "$arm_lib_path" "$arm_lib_path" "$intel_lib_path" | |
| else | |
| echo "Warning: Could not find matching Intel library for $lib_name." | |
| fi | |
| done | |
| echo "Codesigning final application..." | |
| codesign --force --sign - "$UNIVERSAL_APP_PATH/Contents/MacOS/"*.dylib | |
| codesign --force --deep --sign - "$UNIVERSAL_APP_PATH" | |
| # Set execute permission AFTER codesigning | |
| chmod +x "$UNIVERSAL_APP_PATH/Contents/MacOS/Advancely" | |
| # Debug permissions before uploading | |
| echo "Verifying permissions before upload:" | |
| ls -l "$UNIVERSAL_APP_PATH/Contents/MacOS/Advancely" | |
| - name: Assemble Final Release Package | |
| shell: bash | |
| run: | | |
| cp -r resources release/ | |
| cp _PLEASE_READ_ME.txt LICENSES.txt README.md release/ | |
| # Manually zip it | |
| - name: Create Zip Archive | |
| shell: bash | |
| run: | | |
| cd release | |
| zip -r ../Advancely-Universal.zip . | |
| - name: Upload Universal macOS Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Advancely-v${{ env.PROJECT_VERSION }}-macOS-Universal | |
| path: Advancely-Universal.zip # Taking the zip file | |
| # Job 5: Test the Universal macOS package | |
| test_universal_macos: | |
| runs-on: macos-latest | |
| needs: [ package_universal_macos ] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies (macOS) | |
| run: brew install sdl3 sdl3_image sdl3_ttf curl jpeg-xl webp | |
| - name: Configure CMake to get version | |
| run: cmake -B build -DCMAKE_PREFIX_PATH=$(brew --prefix) | |
| - name: Download Universal macOS Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: Advancely-v${{ env.PROJECT_VERSION }}-macOS-Universal | |
| # path: universal-build/ # Not needed | |
| # Extracting zip | |
| - name: Extract Zip Archive | |
| run: unzip -o Advancely-Universal.zip | |
| - name: Install gtimeout (GNU Coreutils) | |
| run: brew install coreutils | |
| - name: Run Executable Test (macOS Universal) | |
| run: | | |
| # Debug permissions after downloading | |
| echo "Verifying permissions after download:" | |
| ls -l ./Advancely.app/Contents/MacOS/Advancely | |
| echo "Running universal executable for 5 seconds..." | |
| # The path no longer has 'universal-build/' in it | |
| gtimeout 5s ./Advancely.app/Contents/MacOS/Advancely --test-mode > output.txt 2>&1 || true | |
| echo "Executable run finished. Contents of output.txt:" | |
| cat output.txt | |
| - name: Upload Test Output (macOS Universal) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-output-v${{ env.PROJECT_VERSION }}-macOS-Universal | |
| path: output.txt |