Skip to content

Add copyright, license header and SPDX-License-Identifier #585

Add copyright, license header and SPDX-License-Identifier

Add copyright, license header and SPDX-License-Identifier #585

name: Build framework on Windows
on:
# execute on every PR made targeting the branches bellow
pull_request:
branches:
- main
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- qc_framework/**
- docker/**
# execute on every push made targeting the branches bellow
push:
branches:
- main
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- qc_framework/**
- docker/**
workflow_dispatch: # Allows manual triggering of the workflow
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
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://archive.apache.org/dist/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 Release
cmake --build . --config Release --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"
cmake --build build --target ALL_BUILD --config Release
cmake --install build
# Final output
Write-Output "All installations and setups are complete!"
shell: pwsh
- name: Archive release binaries
run: |
mkdir artifacts
copy .\build\src\result_pooling\Release\ResultPooling.exe .\artifacts\
copy .\build\src\report_modules\report_module_text\Release\TextReport.exe .\artifacts\
copy .\build\src\report_modules\report_module_github_ci\Release\GithubCIReport.exe .\artifacts\
copy .\build\src\report_modules\report_module_gui\Release\ReportGUI.exe .\artifacts\
shell: cmd
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: qc-framework-executables-windows
path: artifacts
- name: Unit test execution
run: |
Write-Output "Starting unit tests..."
cd "$env:WORKING_PATH\qc-framework\qc-framework"
ctest --test-dir build -C Release
Write-Output "All unit tests done."
shell: pwsh
- name: Archive test results
uses: actions/upload-artifact@v4
with:
name: test-report
path: ${{ github.workspace }}\build\Testing\Temporary\LastTest.log
- name: Framework test execution
run: |
Write-Output "Starting framework tests..."
Rename-Item -path "$env:WORKING_PATH\qc-framework\qc-framework\build" -NewName "$env:WORKING_PATH\qc-framework\qc-framework\out_build"
Copy-Item -Path "$env:WORKING_PATH\QC-Framework-Out\bin" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\bin" -Recurse
Copy-Item -Path "$env:WORKING_PATH\qc-framework\qc-framework\out_build\examples\checker_bundle_example\Release\DemoCheckerBundle.exe" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\bin"
cd "$env:WORKING_PATH\qc-framework\qc-framework\qc_framework"
python3 -m pip install poetry
python3 -m poetry install
python3 -m poetry run pytest
Write-Output "All framework tests done."
shell: pwsh
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Execute checker bundles
run: |
$env:ASAM_QC_FRAMEWORK_MANIFEST_DIR="$env:WORKING_PATH\qc-framework\qc-framework\.github\workflows\windows-manifest"
$env:ASAM_QC_FRAMEWORK_INSTALLATION_DIR="$env:WORKING_PATH\QC-Framework-Out\bin"
git config --system core.longpaths true
pip install -e $env:WORKING_PATH\qc-framework\qc-framework\qc_framework
mkdir "$env:WORKING_PATH\odr_out"
pip install asam-qc-opendrive@git+https://github.com/asam-ev/qc-opendrive@main
qc_runtime --config="$env:WORKING_PATH\qc-framework\qc-framework\.github\workflows\windows-files\odr_config.xml" --manifest="$env:WORKING_PATH\qc-framework\qc-framework\.github\workflows\windows-manifest\framework.json" --working_dir="$env:WORKING_PATH\odr_out"
if (-not (Test-Path "$env:WORKING_PATH\odr_out\xodr_bundle_report.xqar")) { Throw "Error: Odr output does not exist." }
if (-not (Test-Path "$env:WORKING_PATH\odr_out\Result.xqar")) { Throw "Error: Odr output does not exist." }
if (-not (Test-Path "$env:WORKING_PATH\odr_out\Report.txt")) { Throw "Error: Odr output does not exist." }
mkdir "$env:WORKING_PATH\osc_out"
pip install asam-qc-openscenarioxml@git+https://github.com/asam-ev/qc-openscenarioxml@main
qc_runtime --config="$env:WORKING_PATH\qc-framework\qc-framework\.github\workflows\windows-files\osc_config.xml" --manifest="$env:WORKING_PATH\qc-framework\qc-framework\.github\workflows\windows-manifest\framework.json" --working_dir="$env:WORKING_PATH\osc_out"
if (-not (Test-Path "$env:WORKING_PATH\osc_out\xosc_bundle_report.xqar")) { Throw "Error: Osc output does not exist." }
if (-not (Test-Path "$env:WORKING_PATH\osc_out\Result.xqar")) { Throw "Error: Osc output does not exist." }
if (-not (Test-Path "$env:WORKING_PATH\osc_out\Report.txt")) { Throw "Error: Odr output does not exist." }
mkdir "$env:WORKING_PATH\otx_out"
pip install asam-qc-otx@git+https://github.com/asam-ev/qc-otx@main
qc_runtime --config="$env:WORKING_PATH\qc-framework\qc-framework\.github\workflows\windows-files\otx_config.xml" --manifest="$env:WORKING_PATH\qc-framework\qc-framework\.github\workflows\windows-manifest\framework.json" --working_dir="$env:WORKING_PATH\otx_out"
if (-not (Test-Path "$env:WORKING_PATH\otx_out\otx_bundle_report.xqar")) { Throw "Error: Otx output does not exist." }
if (-not (Test-Path "$env:WORKING_PATH\otx_out\Result.xqar")) { Throw "Error: Otx output does not exist." }
if (-not (Test-Path "$env:WORKING_PATH\otx_out\Report.txt")) { Throw "Error: Odr output does not exist." }
shell: pwsh