Skip to content

CI/CD: Add build GitHub Actions workflows #12

CI/CD: Add build GitHub Actions workflows

CI/CD: Add build GitHub Actions workflows #12

name: Build framework on Windows
on:
# execute on every PR made targeting the branches bellow
pull_request:
branches:
- master
- develop # can be removed on master merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- .github/** # only for testing this PR
# execute on every push made targeting the branches bellow
push:
branches:
- master
- develop # can be removed on master merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
jobs:
build-windows:
runs-on: windows-2022
environment: Build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
$desktopPath = "D:\a"
Write-Output "Installing Visual Studio 2019..."
$vsInstaller = "$desktopPath\vs_community.exe"
Invoke-WebRequest -Uri "https://aka.ms/vs/16/release/vs_community.exe" -OutFile $vsInstaller
Start-Process -FilePath $vsInstaller -ArgumentList "--quiet", "--norestart", "--wait", "--add Microsoft.VisualStudio.Workload.NativeDesktop" -NoNewWindow -Wait
Write-Output "Installing Qt..."
$qtInstaller = "$desktopPath\qt-unified-windows-x86-online.exe"
Invoke-WebRequest -Uri "https://d13lb3tujbc8s0.cloudfront.net/onlineinstallers/qt-online-installer-windows-x64-4.8.0.exe" -OutFile $qtInstaller
Start-Process -FilePath $qtInstaller -ArgumentList "--accept-license", "--default-answer", "--confirm-command install qt.qt5.5158.win64_msvc2019_64 qt.qt5.5158.qtcharts qt.qt5.5158.debug_info qt.qt5.5158.src qt.tools.qtcreator" -NoNewWindow -Wait
Write-Output "Setting up Xerces-C++..."
$xercesZip = "$desktopPath\xerces-c-3.2.5.zip"
Invoke-WebRequest -Uri "https://dlcdn.apache.org/xerces/c/3/sources/xerces-c-3.2.5.zip" -OutFile $xercesZip
Expand-Archive -Path $xercesZip -DestinationPath "$desktopPath"
cd "$desktopPath\xerces-c-3.2.5"
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="$desktopPath\Xerces-Out" ..
cmake --build . --config Release
cmake --build . --config Release --target install
[System.Environment]::SetEnvironmentVariable("XERCES_ROOT", "$desktopPath\Xerces-Out", [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable("Path", $env:Path + ";$desktopPath\Xerces-Out\bin", [System.EnvironmentVariableTarget]::Machine)
Write-Output "Setting up dev_essential..."
mkdir "$desktopPath\dev_essential"
git clone https://github.com/cariad-tech/dev_essential.git "$desktopPath\dev_essential"
cd "$desktopPath\dev_essential"
mkdir build
cd build
cmake -H"$desktopPath\dev_essential" -B. -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="$desktopPath\dev_essential-Out" ..
cmake --build . --config Release
cmake --build . --config Release --target install
shell: pwsh
- name: Build framework
run: |
Write-Output "Setting up QC-Framework..."
cmake -H. -B./build -G "Visual Studio 16 2019" -A x64 -T v142 -DCMAKE_INSTALL_PREFIX="$desktopPath\QC-Framework-Out" -DENABLE_FUNCTIONAL_TESTS=OFF -Ddev_essential_ROOT="$desktopPath\dev_essential-Out\lib\cmake\dev_essential" -DQt5_ROOT="C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5" -DXERCES_ROOT="$desktopPath\Xerces-Out" -DCMAKE_EXE_LINKER_FLAGS="/FORCE:MULTIPLE"
cmake --build . --target install --config Release
cmake --install .
# Final output
Write-Output "All installations and setups are complete!"
shell: pwsh