Skip to content

Merge remote-tracking branch 'origin/dev' #11

Merge remote-tracking branch 'origin/dev'

Merge remote-tracking branch 'origin/dev' #11

name: Build OpenModSim Installer (Windows x64, Qt5)
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
branch:
description: 'Checkout branch'
required: false
tag:
description: 'Checkout tag'
required: false
permissions:
contents: write
env:
QT_VERSION: 5.15.2
QT_ARCH: win64_msvc2019_64
CMAKE_COMPILER: msvc2019_64
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_ARCH: x64
BUILD_TYPE: Release
jobs:
build-omodsim:
name: Build OpenModSim installer version '${{ github.event.inputs.tag || github.event.inputs.branch || github.ref_name }}' with Qt5 on Windows x64
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.event.inputs.branch || github.ref_name }}
- name: Extract version from CMakeLists.txt
run: |
for /f "tokens=2" %%i in ('findstr /R /C:"VERSION [0-9]*\.[0-9]*\.[0-9]*" omodsim\CMakeLists.txt') do echo APP_VERSION=%%i>>%GITHUB_ENV%
shell: cmd
- name: Convert version for dev branch
if: ${{ github.ref_name == 'dev' || github.event.inputs.branch == 'dev' }}
run: |
for /f "tokens=1,2 delims=." %%a in ("%APP_VERSION%") do (
echo APP_VERSION=%%a.%%b-dev>>%GITHUB_ENV%
)
shell: cmd
- name: Install Python (for aqtinstall)
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install aqtinstall
run: |
python -m pip install aqtinstall
- name: Install Qt
run: |
python -m aqt install-qt windows desktop ${{ env.QT_VERSION }} ${{ env.QT_ARCH }} -O C:\Qt
shell: cmd
- name: Set BUILD_DIR
run: |
echo BUILD_DIR=build-omodsim-Qt_${{ env.QT_VERSION }}_${{ env.CMAKE_COMPILER }}bit-${{ env.BUILD_TYPE }}>>%GITHUB_ENV%
shell: cmd
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3.2
with:
vs-version: '16.11'
- name: Configure CMake
run: |
cmake omodsim -B ${{ env.BUILD_DIR }} -G "${{ env.CMAKE_GENERATOR }}" -A ${{ env.CMAKE_ARCH }} -T v142 -DCMAKE_PREFIX_PATH="C:/Qt/${{ env.QT_VERSION }}/${{ env.CMAKE_COMPILER }}"
shell: cmd
- name: Build
run: |
cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel
shell: cmd
- name: Copy docs
run: xcopy %CD%\${{ env.BUILD_DIR }}\docs %CD%\${{ env.BUILD_DIR }}\${{ env.BUILD_TYPE }}\docs /E /I /Y
shell: cmd
- name: Get Visual Studio path
run: |
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ^
-latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set VS_PATH=%%i
echo VS_PATH=%VS_PATH%>>%GITHUB_ENV%
shell: cmd
- name: Deploy Qt dependencies using windeployqt
run: |
call "${{ env.VS_PATH }}\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.29
"C:\Qt\${{ env.QT_VERSION }}\${{ env.CMAKE_COMPILER }}\bin\windeployqt.exe" ^
"%CD%\${{ env.BUILD_DIR }}\${{ env.BUILD_TYPE }}\omodsim.exe" ^
--release ^
--no-opengl-sw ^
--no-system-d3d-compiler ^
--plugindir "%CD%\${{ env.BUILD_DIR }}\${{ env.BUILD_TYPE }}\plugins"
shell: cmd
- name: Install NSIS
run: |
choco install nsis -y
shell: cmd
- name: Build NSIS installer
run: |
"C:\Program Files (x86)\NSIS\makensis.exe" ^
/DVERSION="${{ env.APP_VERSION }}" ^
/DBUILD_PATH="%CD%\${{ env.BUILD_DIR }}\${{ env.BUILD_TYPE }}" ^
/DICON_FILE="%CD%\omodsim\res\omodsim.ico" ^
/DLICENSE_FILE="%CD%\omodsim\res\license.txt" ^
/DOUTPUT_FILE="%CD%\qt5-omodsim-${{ env.APP_VERSION }}_${{ env.CMAKE_ARCH }}.exe" ^
%CD%\.nsis\installer-win64.nsi
shell: cmd
- name: Upload Installer
uses: actions/upload-artifact@v4
if: success()
with:
name: qt5-omodsim-${{ env.APP_VERSION }}_${{ env.CMAKE_ARCH }}
path: qt5-omodsim-${{ env.APP_VERSION }}_${{ env.CMAKE_ARCH }}.exe
- name: Create or update GitHub Release and upload EXE
if: success() && github.event_name == 'push' && github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: ${{ github.ref_name }}
name: Open ModSim ${{ env.APP_VERSION }}
files: |
qt5-omodsim-${{ env.APP_VERSION }}_${{ env.CMAKE_ARCH }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}