Skip to content

CI/CD: Add tests to workflows #73

CI/CD: Add tests to workflows

CI/CD: Add tests to workflows #73

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/workflows/** # 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-2019
env:
TEST_ENABLED: ${{ github.event_name == 'pull_request' && 'ON' || 'OFF' }}
WORKING_PATH: "D:\\a"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Install Qt
uses: jurplel/[email protected]
with:
version: 5.15.2
host: windows
target: desktop
arch: win64_msvc2019_64
- name: Install gtest
if: github.event_name == 'pull_request'
env:
CXX: g++-10
run: |
Write-Output "Installing gtest..."
git clone https://github.com/google/googletest.git -b release-1.10.0
cd googletest
mkdir build
cd build
cmake -G "Visual Studio 16 2019" `
-Dgtest_force_shared_crt=ON `
-DCMAKE_INSTALL_PREFIX="$env:WORKING_PATH\gtest-Out" ..
cmake --build . --config Release
cmake --build . --config Release --target install
Write-Output "Gtest installed."
shell: pwsh
- name: Install XercesC
run: |
Write-Output "Setting up Xerces-C++..."
$xercesZip = "$env:WORKING_PATH\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 "$env:WORKING_PATH"
cd "$env:WORKING_PATH\xerces-c-3.2.5"
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="$env:WORKING_PATH\Xerces-Out" ..
cmake --build . --config Debug
cmake --build . --config Debug --target install
Add-Content $env:GITHUB_PATH "$env:WORKING_PATH\bin\xerces-c_3_2D.dll"
Add-Content $env:GITHUB_PATH "$env:WORKING_PATH\Xerces-Out\include"
Add-Content $env:GITHUB_PATH "$env:WORKING_PATH\Xerces-Out\bin"
shell: pwsh
- name: Build framework
run: |
Write-Output "Setting up QC-Framework..."
cd "$env:WORKING_PATH\qc-framework\qc-framework"
mkdir build
cmake -H"$env:WORKING_PATH\qc-framework\qc-framework" -S. -Bbuild `
-G "Visual Studio 16 2019" -A x64 -T v142 `
-DCMAKE_INSTALL_PREFIX="$env:WORKING_PATH\QC-Framework-Out" `
-DENABLE_FUNCTIONAL_TESTS="$env:TEST_ENABLED" `
-DGTest_ROOT="$env:WORKING_PATH\gtest-Out" `
-DQt5_ROOT="$env:Qt5_DIR\Qt5\" `
-DXercesC_ROOT="$env:WORKING_PATH\Xerces-Out" `
-DCMAKE_EXE_LINKER_FLAGS="/FORCE:MULTIPLE"
cmake --build build --target Release --config Release
cmake --install build
# Final output
Write-Output "All installations and setups are complete!"
shell: pwsh
- name: Test
if: github.event_name == 'pull_request'
run: |
echo Starting tests...
cd "$env:WORKING_PATH\qc-framework\qc-framework\build\test\function"
Start-Process -FilePath “examples\example_checker_bundle\src\example_checker_bundle_tester.exe”
Start-Process -FilePath “report_modules\report_module_gui\src\report_module_gui_tester.exe”
Start-Process -FilePath “report_modules\report_module_text\src\report_module_text_tester.exe”
Start-Process -FilePath “result_pooling\src\result_pooling_tester.exe”
echo All tests done.
shell: pwsh