Files
fritzing-build/.github/workflows/windows.yml
T
2026-03-07 19:00:30 +07:00

141 lines
5.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build Fritzing on Windows
on:
workflow_dispatch:
jobs:
build:
runs-on: windows-2022
env:
VCPKG_DEFAULT_TRIPLET: x64-windows
# Pin VCPKG_ROOT to the runner's pre-installed copy to suppress
# the mismatch warning with the VS-bundled vcpkg path.
VCPKG_ROOT: C:\vcpkg
steps:
# ── 0. Checkout this build repo (for patches) ────────────────────────
- name: Checkout fritzing-build
uses: actions/checkout@v4
with:
path: fritzing-build
# ── 1. Checkout Fritzing source ──────────────────────────────────────
- name: Checkout fritzing-app
uses: actions/checkout@v4
with:
repository: fritzing/fritzing-app
path: fritzing-app
- name: Checkout fritzing-parts
uses: actions/checkout@v4
with:
repository: fritzing/fritzing-parts
path: fritzing-parts
# ── 1b. Apply build patches ──────────────────────────────────────────
- name: Patch libgit2detect.pri for vcpkg
working-directory: fritzing-app
run: git apply ../fritzing-build/patches/libgit2detect-vcpkg.patch
shell: bash
# ── 2. Setup MSVC 2022 64-bit environment ────────────────────────────
- name: Setup MSVC environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
# ── 2b. Re-pin VCPKG_ROOT ────────────────────────────────────────────
# ilammy/msvc-dev-cmd runs vcvarsall.bat which overrides
# VCPKG_ROOT to the VS-bundled path. Re-set it to the runner's
# pre-installed copy where our packages are actually installed.
- name: Pin VCPKG_ROOT after MSVC setup
run: echo "VCPKG_ROOT=C:\vcpkg" >> $env:GITHUB_ENV
shell: pwsh
# ── 3. Install Qt 6.5.3 (latest open-source 6.5.x; phoenix.pro allows 6.5.3–6.5.10)
# Arch label for MSVC 2022 / 2019 64-bit is identical
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.5.3'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
modules: 'qt5compat'
cache: true
# ── 4. Restore vcpkg cache ──────────────────────────────────────────
# Restore the installed/ tree and binary cache from a previous
# run so vcpkg install can skip already-built packages.
- name: Restore vcpkg cache
id: vcpkg-cache
uses: actions/cache/restore@v4
with:
path: |
C:\vcpkg\installed
C:\Users\runneradmin\AppData\Local\vcpkg\archives
key: vcpkg-x64-windows-${{ hashFiles('**/vcpkg-deps.txt') }}
restore-keys: |
vcpkg-x64-windows-
# ── 5. Install C++ dependencies via vcpkg ───────────────────────────
- name: Install dependencies with vcpkg
run: |
vcpkg install boost-filesystem boost-optional boost-assign `
libgit2 quazip openssl `
--triplet x64-windows
shell: pwsh
# ── 5a. Save vcpkg cache immediately ─────────────────────────────────
# Save right after install so the 3-hour build is never lost,
# even if a later step (e.g. qmake) fails.
- name: Save vcpkg cache
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
C:\vcpkg\installed
C:\Users\runneradmin\AppData\Local\vcpkg\archives
key: vcpkg-x64-windows-${{ hashFiles('**/vcpkg-deps.txt') }}
# ── 5b. Verify libgit2 is installed correctly ────────────────────────
- name: Verify vcpkg packages
run: |
echo "VCPKG_ROOT = $env:VCPKG_ROOT"
echo "--- libgit2 include ---"
Get-ChildItem "$env:VCPKG_ROOT\installed\x64-windows\include\git2*" -ErrorAction SilentlyContinue
echo "--- libgit2 lib ---"
Get-ChildItem "$env:VCPKG_ROOT\installed\x64-windows\lib\git2*" -ErrorAction SilentlyContinue
shell: pwsh
# ── 6. Configure and build Fritzing ─────────────────────────────────
- name: Configure Fritzing (qmake)
working-directory: fritzing-app
run: |
$VcpkgInstalled = "$env:VCPKG_ROOT\installed\x64-windows"
qmake phoenix.pro `
"BOOST_PATH=$VcpkgInstalled\include" `
"LIBGIT2_PATH=$VcpkgInstalled"
shell: pwsh
- name: Build Fritzing (nmake)
working-directory: fritzing-app
run: nmake release
shell: cmd
# ── 7. Deploy Qt runtime DLLs next to the executable ────────────────
- name: Deploy Qt (windeployqt)
working-directory: fritzing-app/release
run: windeployqt Fritzing.exe
shell: cmd
# ── 8. Upload the finished build as a downloadable artifact ─────────
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: fritzing-windows-x64
path: fritzing-app/release/
retention-days: 14