diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 275fa9b..2a6aef9 100755 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -403,10 +403,105 @@ jobs: name: Citron-Windows-Nightly-MSVC-x64 path: "dist/*.zip" + build-clangtron: + name: "Citron Build (Windows Clangtron - x64)" + needs: [check-version] + if: needs.check-version.outputs.should_build == 'true' + runs-on: ubuntu-latest + timeout-minutes: 240 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Clone Citron Source (Clangtron) + run: | + ATTEMPT=0 + MAX_ATTEMPTS=999 + while true; do + ATTEMPT=$((ATTEMPT + 1)) + echo "Attempt $ATTEMPT of $MAX_ATTEMPTS: Cloning Citron..." + + rm -rf citron + + if git clone --recursive "https://github.com/citron-neo/emulator.git" citron; then + echo "Clone successful on attempt $ATTEMPT." + break + fi + + if [ $ATTEMPT -ge $MAX_ATTEMPTS ]; then + echo "Failed after $MAX_ATTEMPTS attempts." + exit 1 + fi + + echo "Clone failed. Retrying in 15 seconds..." + sleep 15 + done + + - name: Cache llvm-mingw toolchain + uses: actions/cache@v4 + id: cache-llvm-mingw + with: + path: ./citron/build/llvm-mingw + key: clangtron-llvm-mingw-${{ runner.os }}-20260224 + + - name: Cache vcpkg archives (Clangtron) + uses: actions/cache@v4 + with: + path: ~/.vcpkg/archives + key: clangtron-vcpkg-${{ runner.os }}-${{ hashFiles('citron/vcpkg.json') }} + restore-keys: | + clangtron-vcpkg-${{ runner.os }}- + + - name: Get Version (Clangtron) + id: version + working-directory: ./citron + run: | + git fetch --tags + VERSION=$(git rev-parse --short HEAD) + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + + - name: Skip BOLT build (not needed for --pgo none) + run: | + echo '#!/bin/bash' | sudo tee /usr/local/bin/llvm-bolt-21 + echo '#!/bin/bash' | sudo tee /usr/local/bin/merge-fdata-21 + sudo chmod +x /usr/local/bin/llvm-bolt-21 + sudo chmod +x /usr/local/bin/merge-fdata-21 + + - name: Setup Clangtron Build Environment + working-directory: ./citron + run: | + chmod +x build-clangtron-windows.sh + ./build-clangtron-windows.sh setup + + - name: Build Citron (Clangtron LTO) + working-directory: ./citron + run: | + export CITRON_BUILD_TYPE=Release + ./build-clangtron-windows.sh use --pgo none --lto full + + - name: Package Windows Build (Clangtron) + run: | + mkdir -p dist + BIN_DIR="./citron/build/use-nopgo/bin" + if [ ! -d "$BIN_DIR" ]; then + echo "::error::Build output not found at $BIN_DIR" + exit 1 + fi + cd "$BIN_DIR" + zip -r "${GITHUB_WORKSPACE}/dist/Citron-windows-nightly-${{ steps.version.outputs.VERSION }}-x64-clangtron.zip" . + + - name: Upload Windows Build (Clangtron) + uses: actions/upload-artifact@v4 + with: + name: Citron-Windows-Nightly-Clangtron-x64 + path: "dist/*.zip" + release: if: ${{ github.ref_name == 'main' }} name: "Release" - needs: [check-version, build-mingw, build-msvc] + needs: [check-version, build-mingw, build-msvc, build-clangtron] permissions: contents: write runs-on: ubuntu-latest @@ -441,6 +536,7 @@ jobs: files: | release-artifacts/*-x64-mingw.zip release-artifacts/*-x64-msvc.zip + release-artifacts/*-x64-clangtron.zip body: | **Citron Upstream Commit:** [`${{ needs.check-version.outputs.new_hash }}`](https://github.com/citron-neo/emulator/commit/${{ needs.check-version.outputs.new_hash_full }}) @@ -448,7 +544,7 @@ jobs: **Build Details:** - Platform: Windows (x64) - - Toolchains: MinGW-w64 (MSYS2 UCRT64) + MSVC (Visual Studio 2022) + - Toolchains: MinGW-w64 (MSYS2 UCRT64) + MSVC (Visual Studio 2022) + Clangtron (Clang LTO cross-compiled) - Build Type: Release - Date: ${{ env.BUILD_DATE }} - name: Update LATEST_VERSION @@ -474,5 +570,5 @@ jobs: exit 0 fi curl -H "Content-Type: application/json" \ - -d "{\"content\":\"🪟 **New Windows Builds Available!**\n\nšŸ“¦ **Version:** \`${{ env.APP_VERSION }}\`\nšŸ“… **Date:** ${DATE}\nšŸ”§ **Toolchains:** MinGW-w64 (UCRT64) + MSVC\nšŸ”— **Download:** $DOWNLOAD_URL\"}" \ + -d "{\"content\":\"🪟 **New Windows Builds Available!**\n\nšŸ“¦ **Version:** \`${{ env.APP_VERSION }}\`\nšŸ“… **Date:** ${DATE}\nšŸ”§ **Toolchains:** MinGW-w64 (UCRT64) + MSVC + Clangtron (Clang LTO)\nšŸ”— **Download:** $DOWNLOAD_URL\"}" \ "$WEBHOOK_URL" diff --git a/.github/workflows/build_nightly.yml b/.github/workflows/build_nightly.yml index 445588b..e767ae2 100644 --- a/.github/workflows/build_nightly.yml +++ b/.github/workflows/build_nightly.yml @@ -646,10 +646,10 @@ jobs: path: "dist/*.dmg" # =========================================================================== - # WINDOWS: MinGW + MSVC nightly builds and the nightly-windows GitHub Release - # are handled exclusively by .github/workflows/build-windows.yml (same cron). - # A duplicate release job here used to run after that workflow and recreate - # nightly-windows with only the MinGW zip, dropping the MSVC asset. + # WINDOWS: MinGW + MSVC + Clangtron nightly builds and the nightly-windows + # GitHub Release are handled exclusively by .github/workflows/build-windows.yml + # (same cron). A duplicate release job here used to run after that workflow + # and recreate nightly-windows with only the MinGW zip, dropping other assets. # =========================================================================== # =========================================================================== diff --git a/.github/workflows/build_stable.yml b/.github/workflows/build_stable.yml index dd88a97..f3a89cd 100644 --- a/.github/workflows/build_stable.yml +++ b/.github/workflows/build_stable.yml @@ -784,6 +784,104 @@ jobs: name: Citron-Windows-Stable-x64 path: "dist/*.zip" + # =========================================================================== + # WINDOWS (Clangtron - Clang LTO cross-compiled from Ubuntu) + # =========================================================================== + build-clangtron: + name: "Citron Build (Windows Clangtron - x64)" + needs: [check-version] + if: needs.check-version.outputs.should_build == 'true' + runs-on: ubuntu-latest + timeout-minutes: 240 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Clone Citron Source (Clangtron) + run: | + ATTEMPT=0 + MAX_ATTEMPTS=999 + while true; do + ATTEMPT=$((ATTEMPT + 1)) + echo "Attempt $ATTEMPT of $MAX_ATTEMPTS: Cloning Citron..." + + rm -rf citron + + if git clone --recursive "https://github.com/citron-neo/emulator.git" citron; then + echo "Clone successful on attempt $ATTEMPT." + break + fi + + if [ $ATTEMPT -ge $MAX_ATTEMPTS ]; then + echo "Failed after $MAX_ATTEMPTS attempts." + exit 1 + fi + + echo "Clone failed. Retrying in 15 seconds..." + sleep 15 + done + + - name: Cache llvm-mingw toolchain + uses: actions/cache@v4 + id: cache-llvm-mingw + with: + path: ./citron/build/llvm-mingw + key: clangtron-llvm-mingw-${{ runner.os }}-20260224 + + - name: Cache vcpkg archives (Clangtron) + uses: actions/cache@v4 + with: + path: ~/.vcpkg/archives + key: clangtron-vcpkg-stable-${{ runner.os }}-${{ hashFiles('citron/vcpkg.json') }} + restore-keys: | + clangtron-vcpkg-stable-${{ runner.os }}- + + - name: Get Version (Clangtron) + id: version + working-directory: ./citron + run: | + git fetch --tags + VERSION=$(git rev-parse --short HEAD) + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + + - name: Skip BOLT build (not needed for --pgo none) + run: | + echo '#!/bin/bash' | sudo tee /usr/local/bin/llvm-bolt-21 + echo '#!/bin/bash' | sudo tee /usr/local/bin/merge-fdata-21 + sudo chmod +x /usr/local/bin/llvm-bolt-21 + sudo chmod +x /usr/local/bin/merge-fdata-21 + + - name: Setup Clangtron Build Environment + working-directory: ./citron + run: | + chmod +x build-clangtron-windows.sh + ./build-clangtron-windows.sh setup + + - name: Build Citron (Clangtron LTO) + working-directory: ./citron + run: | + export CITRON_BUILD_TYPE=Stable + ./build-clangtron-windows.sh use --pgo none --lto full + + - name: Package Windows Build (Clangtron) + run: | + mkdir -p dist + BIN_DIR="./citron/build/use-nopgo/bin" + if [ ! -d "$BIN_DIR" ]; then + echo "::error::Build output not found at $BIN_DIR" + exit 1 + fi + cd "$BIN_DIR" + zip -r "${GITHUB_WORKSPACE}/dist/Citron-windows-stable-${{ steps.version.outputs.VERSION }}-x64-clangtron.zip" . + + - name: Upload Windows Build (Clangtron) + uses: actions/upload-artifact@v4 + with: + name: Citron-Windows-Stable-Clangtron-x64 + path: "dist/*.zip" + # =========================================================================== # RELEASE - Android # =========================================================================== @@ -1023,7 +1121,7 @@ jobs: release-windows: if: ${{ github.ref_name == 'main' }} name: "Release Windows Stable" - needs: [check-version, build-windows] + needs: [check-version, build-windows, build-clangtron] permissions: contents: write runs-on: ubuntu-latest @@ -1033,7 +1131,8 @@ jobs: uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - name: Citron-Windows-Stable-x64 + pattern: Citron-Windows-Stable-* + merge-multiple: true path: . - name: Get Version from Filename shell: bash @@ -1062,7 +1161,7 @@ jobs: **Build Details:** - Platform: Windows (x64) - - Toolchain: MinGW-w64 (MSYS2 UCRT64) + - Toolchains: MinGW-w64 (MSYS2 UCRT64) + Clangtron (Clang LTO cross-compiled) - Build Type: Stable - Date: ${{ env.BUILD_DATE }} - name: Update LATEST_VERSION @@ -1084,5 +1183,5 @@ jobs: WEBHOOK_URL="${{ secrets.DISCORD_WEBHOOK }}" if [ -z "$WEBHOOK_URL" ]; then echo "DISCORD_WEBHOOK is not set; skipping."; exit 0; fi curl -H "Content-Type: application/json" \ - -d "{\"content\":\"🪟 **New Windows Stable Release!**\n\nšŸ“¦ **Version:** \`${{ env.APP_VERSION }}\`\nšŸ“… **Date:** ${DATE}\nšŸ”§ **Toolchain:** MinGW-w64 (UCRT64)\nšŸ”— **Download:** $DOWNLOAD_URL\"}" \ + -d "{\"content\":\"🪟 **New Windows Stable Release!**\n\nšŸ“¦ **Version:** \`${{ env.APP_VERSION }}\`\nšŸ“… **Date:** ${DATE}\nšŸ”§ **Toolchains:** MinGW-w64 (UCRT64) + Clangtron (Clang LTO)\nšŸ”— **Download:** $DOWNLOAD_URL\"}" \ "$WEBHOOK_URL"