From b8ed1713a7c5a72355a6c4b2edd9a24872fd7111 Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Sun, 10 May 2026 12:18:40 +0200 Subject: [PATCH] Update windows-build.yml --- .github/workflows/windows-build.yml | 274 ++++++++++++++++++++++++---- 1 file changed, 237 insertions(+), 37 deletions(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 67d35986f..8b15c53c4 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -72,7 +72,6 @@ jobs: echo "WARNING: Welcome.nsh not found, skipping font patch" else echo "Patching: $WELCOME_NSH" - # Target only the WelcomePage title CreateFont line and force size to 10 sed -i '/WelcomePage\.Title\.Font/s/"[0-9]\+" "700"/"10" "700"/' "$WELCOME_NSH" grep 'WelcomePage.Title.Font' "$WELCOME_NSH" echo " OK font size patched to 10" @@ -103,7 +102,6 @@ jobs: set -euo pipefail cd "$GITHUB_WORKSPACE" mkdir build && cd build - # Detect the number of available CPUs NPROC=$(nproc) echo "Available CPUs: $NPROC" @@ -163,9 +161,8 @@ jobs: --no-compiler-runtime \ ./QElectroTech.exe || true - # 3-pass ldd scan to capture all transitive DLLs echo "=== 3-pass transitive DLL scan ===" - set +e # ldd may return non-zero exit codes on some files + set +e for PASS in 1 2 3; do echo "-- Pass $PASS --" for bin_file in "$BIN"/*.dll "$BIN"/*.exe "$BIN"/sqldrivers/*.dll "$BIN"/platforms/*.dll "$BIN"/imageformats/*.dll; do @@ -182,21 +179,17 @@ jobs: done < <(ldd "$bin_file" 2>/dev/null | grep -i '/ucrt64/bin/') done done - set -e # re-enable + set -e - DLL_SCAN=$(ls -1 "$BIN/"*.dll 2>/dev/null | wc -l) - echo "=== $DLL_SCAN DLLs present after scan ===" - ls -lh "$BIN/QElectroTech.exe" || { echo "ERROR: exe missing from bin/"; exit 1; } DLL_COUNT=$(find "$BIN" -name "*.dll" | wc -l) - echo "DLLs present: $DLL_COUNT" + echo "=== $DLL_COUNT DLLs present after scan ===" + ls -lh "$BIN/QElectroTech.exe" || { echo "ERROR: exe missing from bin/"; exit 1; } [ "$DLL_COUNT" -gt 5 ] || { echo "ERROR: too few DLLs"; exit 1; } cd "$GITHUB_WORKSPACE" cp /ucrt64/bin/libgcc_s_seh-1.dll "$BIN/" cp /ucrt64/bin/libstdc++-6.dll "$BIN/" cp /ucrt64/bin/libwinpthread-1.dll "$BIN/" - # SQLite3 โ€” explicit copy because ldd may not detect it - # (statically linked via Qt or via a different path) SQLITE=$(find /ucrt64/bin -name "libsqlite3*.dll" | head -1) if [ -n "$SQLITE" ]; then cp "$SQLITE" "$BIN/" @@ -205,38 +198,29 @@ jobs: echo "WARNING: libsqlite3 not found in /ucrt64/bin/" fi - # Seed nsis_root/ from the versioned base tree in the repository. - # nsis_base/ contains: images/ and files/ static assets (ico, reg, bat, licenses...). - # and files/ with pre-built static assets (reg, bat, ico, README, licenses...). - # Copy NSIS scripts from build-aux/windows/ then merge the static base tree. - # Copy NSIS scripts and support files from build-aux/windows/ cp "$GITHUB_WORKSPACE/build-aux/windows/QET64.nsi" "$NSIS_ROOT/" cp "$GITHUB_WORKSPACE/build-aux/windows/lang_extra.nsh" "$NSIS_ROOT/" cp "$GITHUB_WORKSPACE/build-aux/windows/lang_extra_fr.nsh" "$NSIS_ROOT/" cp "$GITHUB_WORKSPACE/build-aux/windows/lang_extra_missing.nsh" "$NSIS_ROOT/" - # Copy static base assets (ico, reg, bat, images, Lancer QET.bat, ...) cp -r "$GITHUB_WORKSPACE/build-aux/windows/nsis_base/." "$NSIS_ROOT/" - # Layer build-time assets on top of the static base - # Download Lancer QET.bat from misc/ into files/ (portable version) - curl -fsSL "https://raw.githubusercontent.com/qelectrotech/qelectrotech-source-mirror/refs/heads/master/misc/Lancer%20QET.bat" -o "$FILES/Lancer QET.bat" + curl -fsSL \ + "https://raw.githubusercontent.com/qelectrotech/qelectrotech-source-mirror/refs/heads/master/misc/Lancer%20QET.bat" \ + -o "$FILES/Lancer QET.bat" cp -r "$GITHUB_WORKSPACE/elements" "$FILES/elements" || true cp -r "$GITHUB_WORKSPACE/titleblocks" "$FILES/titleblocks" || true cp -r "$GITHUB_WORKSPACE/examples" "$FILES/examples" || true cp -r "$GITHUB_WORKSPACE/fonts" "$FILES/fonts" || true - # Language files: start from repo lang/, then overlay .qm files built by CMake cp -r "$GITHUB_WORKSPACE/lang" "$FILES/lang" || true find "$GITHUB_WORKSPACE/build" -name "*.qm" -exec cp {} "$FILES/lang/" \; 2>/dev/null || true echo "=== .qm files in files/lang/ ===" ls "$FILES/lang/"*.qm 2>/dev/null | wc -l || echo "0 .qm files" - # Top-level doc files from the repository (override nsis_base stubs if present) for f in LICENSE ChangeLog CREDIT README ELEMENTS.LICENSE; do cp "$GITHUB_WORKSPACE/$f" "$FILES/$f" 2>/dev/null || true done - # --- Verification: list present or missing files in files/ --- echo "=== Verification of key files in files/ ===" for f in LICENSE ChangeLog CREDIT README ELEMENTS.LICENSE \ qet_uninstall_file_associations.reg register_filetypes.bat "Lancer QET.bat"; do @@ -256,14 +240,11 @@ jobs: run: | set -euo pipefail - # Short commit hash (same as the official packaging script) GITCOMMIT=$(git -C "$GITHUB_WORKSPACE" rev-parse --short HEAD) - # Cumulative revision number (trunk style) + project offset 473 A=$(git -C "$GITHUB_WORKSPACE" rev-list HEAD --count) HEAD=$(( A + 473 )) - # Version read from qetversion.cpp โ€” same logic as the official script VERSION=$(grep 'return QVersionNumber{' "$GITHUB_WORKSPACE/sources/qetversion.cpp" \ | head -1 \ | awk -F '{' '{ print $2 }' \ @@ -272,10 +253,10 @@ jobs: [ -z "$VERSION" ] && VERSION="dev" FULL_VERSION="${VERSION}-r${HEAD}-${GITCOMMIT}_x86_64-win64" - echo "version=$FULL_VERSION" >> "$GITHUB_OUTPUT" - echo "base_version=$VERSION" >> "$GITHUB_OUTPUT" - echo "gitcommit=$GITCOMMIT" >> "$GITHUB_OUTPUT" - echo "head=$HEAD" >> "$GITHUB_OUTPUT" + echo "version=$FULL_VERSION" >> "$GITHUB_OUTPUT" + echo "base_version=$VERSION" >> "$GITHUB_OUTPUT" + echo "gitcommit=$GITCOMMIT" >> "$GITHUB_OUTPUT" + echo "head=$HEAD" >> "$GITHUB_OUTPUT" echo "VERSION : $VERSION" echo "GITCOMMIT : $GITCOMMIT" echo "HEAD (rev) : $HEAD" @@ -298,7 +279,6 @@ jobs: echo "=== Contents of nsis_root/files/ ===" ls "$GITHUB_WORKSPACE/nsis_root/files/" - - name: Build NSIS installer shell: msys2 {0} run: | @@ -306,26 +286,20 @@ jobs: NSIS_ROOT="$GITHUB_WORKSPACE/nsis_root" cd "$NSIS_ROOT" echo "=== CWD : $(pwd) ===" - - # MSYS2_ARG_CONV_EXCL prevents MSYS2 from converting /V4 to a POSIX path MSYS2_ARG_CONV_EXCL="*" makensis /V4 QET64.nsi RC=$? echo "=== Contents of nsis_root after makensis ===" ls "$NSIS_ROOT/" [ $RC -eq 0 ] || { echo "ERROR: makensis failed (exit $RC)"; exit 1; } - - name: Move installer to dist/ shell: msys2 {0} run: | set -euo pipefail mkdir -p "$GITHUB_WORKSPACE/dist" - - # Case-insensitive search to avoid glob issues INSTALLER=$(find "$GITHUB_WORKSPACE/nsis_root" -maxdepth 1 -iname "installer_*.exe" | head -1) if [ -z "$INSTALLER" ]; then echo "ERROR: no installer .exe found in nsis_root/" - echo "=== Contents of nsis_root/ ===" ls "$GITHUB_WORKSPACE/nsis_root/" exit 1 fi @@ -355,3 +329,229 @@ jobs: name: qelectrotech-windows-installer path: dist/Installer_*.exe retention-days: 14 + + # --------------------------------------------------------------------------- + # Job 2 : Publie une release nightly + page GitHub Pages + # Ne tourne que sur push master (pas sur les PRs) + # --------------------------------------------------------------------------- + deploy-pages: + needs: build-windows + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' + permissions: + contents: write + + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v4 + with: + ref: gh-pages + path: gh-pages + + - name: Download installer artifact + uses: actions/download-artifact@v4 + with: + name: qelectrotech-windows-installer + path: downloaded/installer/ + + - name: Update nightly release + uses: softprops/action-gh-release@v2 + with: + tag_name: nightly + name: "Nightly Build โ€“ Windows" + body: | + ๐Ÿ”ง **Automated nightly build** โ€” may be unstable. + + | | | + |---|---| + | **Commit** | ${{ github.sha }} | + | **Run** | https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | + | **Date** | ${{ github.event.head_commit.timestamp }} | + + > โš ๏ธ This release is overwritten on every push to `master`. + > For stable releases, see the [Releases page](https://github.com/${{ github.repository }}/releases). + prerelease: true + make_latest: false + files: downloaded/installer/*.exe + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate download page (index.html) + run: | + DATE=$(date -u '+%Y-%m-%d %H:%M UTC') + SHORT="${{ github.sha }}" + SHORT="${SHORT:0:7}" + REPO="${{ github.repository }}" + RUN_URL="https://github.com/$REPO/actions/runs/${{ github.run_id }}" + EXE_NAME=$(ls downloaded/installer/*.exe | xargs -I{} basename {}) + INSTALLER_URL="https://github.com/$REPO/releases/download/nightly/$EXE_NAME" + + mkdir -p gh-pages + cat > gh-pages/index.html << HTMLEOF + + + + + + QElectroTech โ€“ Nightly Builds + + + +
+

โšก QElectroTech

+

Nightly Windows Builds

+
+ +
+
+

Build info

+
+ ๐Ÿ“…  $DATE
+ ๐Ÿ”€  Commit $SHORT
+ ๐Ÿ”ง  CI Run #${{ github.run_number }} + nightly +
+
+ โš ๏ธ These builds are generated automatically on every commit to master + and may be unstable or incomplete. + For production use, download a + stable release. +
+
+ + +
+ + + + + HTMLEOF + + - name: Commit and push to gh-pages + run: | + cd gh-pages + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add index.html + git diff --staged --quiet \ + || git commit -m "nightly: build #${{ github.run_number }} (${{ github.sha }})" + git push origin gh-pages