Files
Modernization-Tool/.github/workflows/build.yml
T
Dusk 2d4126ad5e
Build Windows EXE / build (push) Has been cancelled
Reduce CI build and artifact usage
Run validation-only checks on direct test-branch pushes, keep full Windows builds for PRs, main, tags and manual runs, and store Actions artifacts only for explicit manual builds with 7-day retention. Release publishing remains unchanged.
2026-09-08 10:12:07 +02:00

140 lines
5.2 KiB
YAML

name: Build Windows EXE
on:
push:
branches:
- 'main'
- 'test/**'
tags:
- 'v*'
pull_request:
branches:
- 'main'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: modernization-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: windows-2025
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11.9'
- name: Install pinned build toolchain
run: python -m pip install --disable-pip-version-check -r requirements-build.txt
- name: Verify build toolchain
run: |
python --version
pyinstaller --version
python -m pip show pyinstaller pyinstaller-hooks-contrib
# Direct pushes to test/** run validation only. PRs, main, tags and
# explicit manual runs still validate a real Windows build.
- name: Configure x86 MSVC
if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: Prepare bundled remote fallbacks
if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
run: python scripts/prepare_remote_fallbacks.py
- name: Syntax check
run: python -m py_compile setup_tool.py setup_tool_dynamic.py setup_tool_responsive.py dxvk_fps.py remote_packages.py tests/test_safety.py tests/test_dxvk_fps_limit.py scripts/prepare_remote_fallbacks.py
- name: Unit safety tests
run: python -m unittest discover -s tests -v
- name: Build EXE
if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
run: >
pyinstaller
--noconsole
--onefile
--icon=PurpleWowLogo.ico
--add-data "PurpleWowLogo.ico;."
--add-data "Payload;Payload"
--add-data "vanilla-tweaks.exe;."
--name "WoW_Modernization_Tool"
setup_tool_responsive.py
- name: Verify EXE exists
if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
shell: pwsh
run: |
if (-not (Test-Path "dist/WoW_Modernization_Tool.exe")) { throw "Build output missing" }
Get-Item "dist/WoW_Modernization_Tool.exe" | Format-List Name,Length,LastWriteTime
- name: Create ZIP package
if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
shell: pwsh
run: |
$zip = "dist/WoW_Modernization_Tool.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path "dist/WoW_Modernization_Tool.exe" -DestinationPath $zip -CompressionLevel Optimal
if (-not (Test-Path $zip)) { throw "ZIP package missing" }
Get-Item $zip | Format-List Name,Length,LastWriteTime
# Ephemeral Actions artifacts are created only when explicitly requested.
# Release tags publish their EXE/ZIP directly as GitHub Release assets.
- name: Upload manual test artifact
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
with:
name: WoW_Modernization_Tool-test
path: |
dist/WoW_Modernization_Tool.exe
dist/WoW_Modernization_Tool.zip
if-no-files-found: error
retention-days: 7
# One-time production promotion for v2.3. The exact commit message keeps
# normal main pushes from publishing or modifying the v2.3 release.
# Keep the Git tag aligned with the exact commit used to build the assets.
- name: Synchronize Git tag v2.3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.event.head_commit.message == 'release v2.3' }}
shell: pwsh
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -f v2.3 "${{ github.sha }}"
git push origin refs/tags/v2.3 --force
- name: Create GitHub Release v2.3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.event.head_commit.message == 'release v2.3' }}
uses: softprops/action-gh-release@v3
with:
tag_name: v2.3
target_commitish: ${{ github.sha }}
files: |
dist/WoW_Modernization_Tool.exe
dist/WoW_Modernization_Tool.zip
fail_on_unmatched_files: true
overwrite_files: true
name: "WoW Modernization Tool v2.3"
body_path: RELEASE_NOTES.md
generate_release_notes: false
make_latest: true
- name: Create GitHub Release
if: ${{ startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/tags/v2.3' }}
uses: softprops/action-gh-release@v3
with:
files: |
dist/WoW_Modernization_Tool.exe
dist/WoW_Modernization_Tool.zip