Skip to content

Commit

Permalink
CI/CD: Add build GitHub Actions workflows (#53)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Abrahão <[email protected]>
Signed-off-by: Patrick Abrahão <[email protected]>
  • Loading branch information
patrickpa authored and pmai committed Jun 6, 2024
1 parent d29be71 commit 7795c56
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 2 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build-on-change-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build framework on Linux

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/**

# 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-linux:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Create dependencies build space
run: mkdir dependencies
shell: bash

- name: Install dependencies
working-directory: dependencies
run: |
echo Updating CMAKE...
wget https://github.com/Kitware/CMake/releases/download/v3.29.3/cmake-3.29.3-linux-x86_64.sh
sudo apt remove cmake
sudo apt purge --auto-remove cmake
sudo bash cmake-3.29.3-linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local
echo Installing Qt...
sudo apt update
sudo apt install \
qtbase5-dev \
libqt5xmlpatterns5-dev \
libxerces-c-dev \
pkg-config
echo Dependencies installed.
shell: bash

- name: Build framework
# Currently this is building without the XSD file. If we want to expose
# the build artifact after, we might as well need to add the XSD file.
run: |
echo Building framework...
cmake -G "Unix Makefiles" -B./build -S . -DCMAKE_INSTALL_PREFIX="/home/$(whoami)/qc-build" \
-DENABLE_FUNCTIONAL_TESTS=OFF -DXERCES_ROOT="/usr" \
-DQt5_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5/" \
-DQt5XmlPatterns_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5XmlPatterns/"
cmake --build ./build --target install --config Release -j4
cmake --install ./build
echo Done.
shell: bash
85 changes: 85 additions & 0 deletions .github/workflows/build-on-change-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
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/**

# 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
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 dependencies
run: |
$workingPath = "D:\a"
Write-Output "Setting up Xerces-C++..."
$xercesZip = "$workingPath\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 "$workingPath"
cd "$workingPath\xerces-c-3.2.5"
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="$workingPath\Xerces-Out" ..
cmake --build . --config Debug
cmake --build . --config Debug --target install
Add-Content $env:GITHUB_PATH "$workingPath\bin\xerces-c_3_2D.dll"
Add-Content $env:GITHUB_PATH "$workingPath\Xerces-Out\include"
Add-Content $env:GITHUB_PATH "$workingPath\Xerces-Out\bin"
shell: pwsh

- name: Build framework
run: |
$workingPath = "D:\a"
Write-Output "Setting up QC-Framework..."
cd "$workingPath\qc-framework\qc-framework"
mkdir build
cmake -H"$workingPath\qc-framework\qc-framework" -S. -Bbuild `
-G "Visual Studio 16 2019" -A x64 -T v142 `
-DCMAKE_INSTALL_PREFIX="$workingPath\QC-Framework-Out" `
-DENABLE_FUNCTIONAL_TESTS=OFF `
-DQt5_ROOT="$env:Qt5_DIR\Qt5\" `
-DXercesC_ROOT="$workingPath\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
6 changes: 4 additions & 2 deletions src/report_modules/report_module_gui/src/report_format_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ XERCES_CPP_NAMESPACE_USE
int main(int argc, char *argv[])
{
#ifdef WIN32
auto workdir = fs::current_path();
SetDllDirectoryA(workdir.toString().c_str());
auto currentPath = std::filesystem::current_path();
auto currentPathW = currentPath.string();
// Set the DLL directory
SetDllDirectory(currentPathW.c_str());
#endif

std::string strToolpath = argv[0];
Expand Down

0 comments on commit 7795c56

Please sign in to comment.