Build Windows #10
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 Windows | |
on: | |
workflow_dispatch: | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
include: | |
- QT_ARCH: 'win64_msvc2017_64' | |
PLATFORM: 'x64' | |
PLATFORM_ALT_NAME: 'x64' | |
OUTPUT_BIN_DIR: 'bin64' | |
- QT_ARCH: 'win32_msvc2017' | |
PLATFORM: 'x86' | |
PLATFORM_ALT_NAME: 'x86' | |
OUTPUT_BIN_DIR: 'bin32' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# 1) Install Chocolatey (if not already present) | |
- name: Install Chocolatey | |
if: ${{ runner.os == 'Windows' }} | |
shell: powershell | |
run: | | |
Set-ExecutionPolicy Bypass -Scope Process -Force | |
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 | |
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
# 2) Install Visual Studio 2017 Build Tools + vswhere | |
# This package includes the C++ toolset 14.16, needed by Qt 5.12 for MSVC2017. | |
- name: Install Visual Studio 2017 Build Tools | |
shell: powershell | |
run: | | |
choco install visualstudio2017buildtools --version=15.9.54.0 ` | |
--package-parameters "--allWorkloads --includeRecommended --includeOptional" -y | |
choco install vswhere -y | |
# 3) Install Qt (5.12.12) for the desired MSVC2017 architecture | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
aqtversion: '==3.1.*' | |
version: '5.12.12' | |
host: 'windows' | |
target: 'desktop' | |
arch: '${{ matrix.QT_ARCH }}' | |
# 4) Move repository content to C:\dev\labrador (like AppVeyor clone_folder) | |
- name: Move repository to C:\dev\labrador | |
shell: cmd | |
run: | | |
mkdir C:\dev\labrador | |
xcopy /s /e /i /y "%GITHUB_WORKSPACE%\*" C:\dev\labrador\ | |
# 5) Activate the newly installed MSVC 2017 environment with toolset 14.16 | |
- name: Setup MSVC Developer Command Prompt | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{ matrix.PLATFORM }} | |
toolset: 14.16 | |
# 6) Debug step: Confirm cl, nmake, qmake are found | |
- name: Debug environment | |
shell: cmd | |
run: | | |
echo "PATH=%PATH%" | |
where cl | |
where nmake | |
where qmake | |
# 7) Build Labrador | |
- name: Build Labrador | |
shell: cmd | |
run: | | |
cd C:\dev\labrador\Desktop_Interface | |
for /f "delims=" %%i in ('git rev-parse --short HEAD') do set GIT_HASH_SHORT=%%i | |
qmake CONFIG+=release DEFINES+=GIT_HASH_SHORT=%GIT_HASH_SHORT% | |
nmake | |
# 8) Post-build steps: windeployqt, copy fftw DLL, etc. | |
- name: Post-build steps | |
shell: cmd | |
run: | | |
cd C:\dev\labrador\Desktop_Interface | |
windeployqt bin\Labrador.exe | |
xcopy /i /s /y "build_win\fftw\${{ matrix.PLATFORM_ALT_NAME }}"\libfftw3-3.dll bin | |
del bin\vcredist*.exe | |
del bin\*.pdb | |
# 9) Upload artifact | |
- name: Upload Windows artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Labrador_${{ matrix.PLATFORM }} | |
path: C:\dev\labrador\Desktop_Interface\bin | |
# 10) Optional: Push result to Labrador-win-builder | |
- name: Publish update to Labrador-win-builder | |
if: success() | |
shell: pwsh | |
env: | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
OUTPUT_BIN_DIR: ${{ matrix.OUTPUT_BIN_DIR }} | |
run: | | |
cd C:\dev | |
git clone --depth 1 https://github.com/espotek-org/Labrador-win-builder | |
cd Labrador-win-builder | |
git config --global credential.helper store | |
Add-Content "$env:USERPROFILE\.git-credentials" "https://$env:ACCESS_TOKEN:x-oauth-basic@github.com`n" | |
git config --global user.email "admin@espotek.com" | |
git config --global user.name "Chris Esposito" | |
git checkout master | |
xcopy /i /s /y C:\dev\labrador\Desktop_Interface\bin $env:OUTPUT_BIN_DIR | |
git add $env:OUTPUT_BIN_DIR | |
git commit -a -m "Automatic update from main Labrador repository" | |
git push |