Update build-windows.yml #4
This file contains 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 Fritzing App for Windows x64 | |
on: | |
push: | |
branches: [ develop ] | |
pull_request: | |
branches: [ develop ] | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
# 1. Checkout the fritzing-app repository (with submodules if necessary) | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# 2. Clone and build libgit2 as a sibling dependency. | |
# This step changes directory to the parent folder and clones libgit2 if it doesn’t already exist. | |
- name: Clone and Build libgit2 | |
working-directory: .. | |
shell: pwsh | |
run: | | |
if (-Not (Test-Path -Path "./libgit2")) { | |
Write-Host "Cloning libgit2..." | |
git clone https://github.com/libgit2/libgit2.git | |
} else { | |
Write-Host "libgit2 already exists, skipping clone." | |
} | |
Set-Location -Path "./libgit2" | |
if (-Not (Test-Path -Path "./build")) { | |
Write-Host "Creating build directory..." | |
New-Item -ItemType Directory -Name "build" | Out-Null | |
} | |
Set-Location -Path "./build" | |
Write-Host "Configuring libgit2..." | |
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="$PWD\install" .. | |
Write-Host "Building libgit2..." | |
cmake --build . --config Release -- /m | |
Write-Host "Installing libgit2..." | |
cmake --install . --config Release | |
# 3. Set up Qt 6.5.3 for Windows desktop (64-bit) | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: '6.5.3' | |
host: windows | |
target: desktop | |
arch: win64 | |
# 4. (Optional) Clone the fritzing-parts repository if needed. | |
- name: Clone fritzing-parts repository | |
run: git clone https://github.com/fritzing/fritzing-parts.git ../fritzing-parts | |
# 5. Generate a Visual Studio project file from the Qt project (phoenix.pro). | |
- name: Generate Visual Studio project files | |
run: qmake -t vcapp phoenix.pro | |
# 6. Build the generated Visual Studio project using MSBuild. | |
- name: Build Fritzing App | |
run: msbuild fritzing.vcproj /p:Configuration=Release /m | |
# 7. Upload the build artifact (assuming output is in the Release folder). | |
- name: Archive build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Fritzing-App | |
path: Release/ |