Build #6
Workflow file for this run
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
| name: Build | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| linux_runner: | |
| description: Linux runner label | |
| type: string | |
| default: ubuntu-22.04 | |
| windows_runner: | |
| description: Windows runner label | |
| type: string | |
| default: windows-latest | |
| macos_arm_runner: | |
| description: macOS arm64 runner label | |
| type: string | |
| default: macos-15 | |
| macos_intel_runner: | |
| description: macOS x86_64 runner label | |
| type: string | |
| default: macos-15-intel | |
| workflow_call: | |
| inputs: | |
| linux_runner: | |
| type: string | |
| default: ubuntu-22.04 | |
| windows_runner: | |
| type: string | |
| default: windows-latest | |
| macos_arm_runner: | |
| type: string | |
| default: macos-15 | |
| macos_intel_runner: | |
| type: string | |
| default: macos-15-intel | |
| env: | |
| QT_VERSION_LINUX: "6.11.0" | |
| CMAKE_C_COMPILER_LAUNCHER: ccache | |
| CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_MAXSIZE: 800M | |
| jobs: | |
| windows: | |
| runs-on: ${{ inputs.windows_runner || 'windows-latest' }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Set up MSYS2 | |
| if: startsWith(inputs.windows_runner || 'windows-latest', 'windows-') | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| location: C:\ci-msys2 | |
| install: >- | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-cmake | |
| mingw-w64-x86_64-ninja | |
| mingw-w64-x86_64-ccache | |
| mingw-w64-x86_64-python | |
| mingw-w64-x86_64-qt6-base | |
| mingw-w64-x86_64-qt6-tools | |
| mingw-w64-x86_64-qt6-translations | |
| mingw-w64-x86_64-qt6-imageformats | |
| mingw-w64-x86_64-freetype | |
| mingw-w64-x86_64-harfbuzz | |
| mingw-w64-x86_64-libpng | |
| mingw-w64-x86_64-libjpeg-turbo | |
| mingw-w64-x86_64-libwebp | |
| mingw-w64-x86_64-fribidi | |
| mingw-w64-x86_64-zstd | |
| mingw-w64-x86_64-libutf8proc | |
| mingw-w64-x86_64-libunibreak | |
| mingw-w64-x86_64-libjxl | |
| mingw-w64-x86_64-fontconfig | |
| mingw-w64-x86_64-zlib | |
| - name: Cache ccache | |
| if: startsWith(inputs.windows_runner || 'windows-latest', 'windows-') | |
| uses: actions/cache@v6 | |
| with: | |
| path: .ccache | |
| key: ccache-windows-${{ github.sha }} | |
| restore-keys: ccache-windows- | |
| - name: Build and package | |
| shell: pwsh | |
| run: | | |
| $msysRoot = if (Test-Path 'C:\ci-msys2\msys64') { 'C:\ci-msys2\msys64' } else { 'C:\tools\msys64' } | |
| $src = Join-Path $env:RUNNER_TEMP 'cr-conv' | |
| New-Item -ItemType Directory -Force $src | Out-Null | |
| .\scripts\build-dist-windows.ps1 -Build -Msys2Root $msysRoot -SourceDir $src | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: windows-portable | |
| path: | | |
| dist/*.zip | |
| dist/*.7z | |
| if-no-files-found: error | |
| linux: | |
| runs-on: ${{ inputs.linux_runner || 'ubuntu-22.04' }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Install build dependencies | |
| if: startsWith(inputs.linux_runner || 'ubuntu-22.04', 'ubuntu-') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential cmake ccache python3-pip wget file \ | |
| libfreetype-dev libharfbuzz-dev libpng-dev libjpeg-turbo8-dev \ | |
| libwebp-dev libfribidi-dev libzstd-dev libutf8proc-dev libunibreak-dev \ | |
| libfontconfig1-dev zlib1g-dev libgl1-mesa-dev libxkbcommon-dev \ | |
| libfuse2 libxkbcommon-x11-0 libxcb-cursor0 libxcb-icccm4 \ | |
| libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \ | |
| libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 \ | |
| libxcb-xkb1 libxcb-glx0 libxcb-util1 | |
| - name: Cache Qt | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{ runner.temp }}/appimage-root/Qt | |
| key: qt-linux-${{ env.QT_VERSION_LINUX }} | |
| - name: Cache ccache | |
| if: startsWith(inputs.linux_runner || 'ubuntu-22.04', 'ubuntu-') | |
| uses: actions/cache@v6 | |
| with: | |
| path: .ccache | |
| key: ccache-linux-${{ github.sha }} | |
| restore-keys: ccache-linux- | |
| - name: Build AppImage | |
| run: | | |
| mkdir -p "$RUNNER_TEMP/appimage-root" | |
| cd "$RUNNER_TEMP/appimage-root" | |
| export APPIMAGE_EXTRACT_AND_RUN=1 | |
| export QT_VERSION="$QT_VERSION_LINUX" | |
| "$GITHUB_WORKSPACE/scripts/create-appimage.sh" --src "$GITHUB_WORKSPACE" -j "$(nproc)" | |
| mkdir -p "$GITHUB_WORKSPACE/dist" | |
| cp cr2xt-*.AppImage "$GITHUB_WORKSPACE/dist/" | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: linux-appimage | |
| path: dist/*.AppImage | |
| if-no-files-found: error | |
| macos: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: arm64 | |
| runner: ${{ inputs.macos_arm_runner || 'macos-15' }} | |
| - arch: x86_64 | |
| runner: ${{ inputs.macos_intel_runner || 'macos-15-intel' }} | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Add Homebrew and local bins to PATH (self-hosted runners have a minimal PATH) | |
| run: | | |
| echo "/opt/homebrew/bin" >> "$GITHUB_PATH" | |
| echo "/usr/local/bin" >> "$GITHUB_PATH" | |
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| - name: Install dependencies (Homebrew) | |
| if: startsWith(matrix.runner, 'macos-') | |
| run: >- | |
| brew install ninja ccache qt@6 freetype harfbuzz libpng jpeg-turbo webp | |
| fribidi zstd utf8proc libunibreak jpeg-xl fontconfig dbus | |
| - name: Cache ccache | |
| if: startsWith(matrix.runner, 'macos-') | |
| uses: actions/cache@v6 | |
| with: | |
| path: .ccache | |
| key: ccache-macos-${{ matrix.arch }}-${{ github.sha }} | |
| restore-keys: ccache-macos-${{ matrix.arch }}- | |
| - name: Build ${{ matrix.arch }} | |
| run: ./scripts/build-dist-macos.sh -a ${{ matrix.arch }} -m 15.0 --skip-dmg -j "$(sysctl -n hw.ncpu)" | |
| - name: Tar app bundle (preserve symlinks) | |
| run: tar -C "dist/macos-${{ matrix.arch }}" -czf "cr2xt-app-${{ matrix.arch }}.tar.gz" cr2xt.app | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: macos-app-${{ matrix.arch }} | |
| path: cr2xt-app-${{ matrix.arch }}.tar.gz | |
| if-no-files-found: error | |
| macos-universal: | |
| needs: macos | |
| runs-on: ${{ inputs.macos_arm_runner || 'macos-15' }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Add Homebrew and local bins to PATH (self-hosted runners have a minimal PATH) | |
| run: | | |
| echo "/opt/homebrew/bin" >> "$GITHUB_PATH" | |
| echo "/usr/local/bin" >> "$GITHUB_PATH" | |
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| - name: Install dmgbuild | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| command -v dmgbuild >/dev/null 2>&1 || pipx install dmgbuild | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: macos-app-* | |
| path: apptars | |
| merge-multiple: true | |
| - name: Unpack per-arch bundles | |
| run: | | |
| mkdir -p dist/macos-arm64 dist/macos-x86_64 | |
| tar -C dist/macos-arm64 -xzf apptars/cr2xt-app-arm64.tar.gz | |
| tar -C dist/macos-x86_64 -xzf apptars/cr2xt-app-x86_64.tar.gz | |
| - name: Merge to universal and create DMGs | |
| run: ./scripts/build-dist-macos.sh --merge-only -H | |
| - name: Verify universal binary | |
| run: | | |
| archs=$(lipo -archs dist/macos-universal/cr2xt.app/Contents/MacOS/crqt) | |
| echo "Architectures: $archs" | |
| [[ "$archs" == *arm64* && "$archs" == *x86_64* ]] | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: macos-dmgs | |
| path: dist/*.dmg | |
| if-no-files-found: error |