Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
ef96db9
Moved .gitignore inside folder
juliamauri Dec 13, 2024
19704a5
Renamed folder
juliamauri Dec 13, 2024
19ac176
Startup CMake project
juliamauri Dec 13, 2024
755fc99
vcpkg implementation and ported RedLens
juliamauri Dec 13, 2024
86d04ae
Added vcpkg submodule
juliamauri Dec 13, 2024
d072f8d
WindowsManager module
juliamauri Dec 14, 2024
eb054ec
WindowsManager as RedEye library
juliamauri Dec 14, 2024
17c7947
Link draw Main window function
juliamauri Dec 14, 2024
ea4cba4
Removed imgui linkage to Lens project, already defined in WindowsMana…
juliamauri Dec 14, 2024
5e45347
Removed SDL include
juliamauri Dec 14, 2024
b16b64f
FileSystem Module
juliamauri Dec 14, 2024
dd58d5e
Renamed Window to GUI
juliamauri Dec 14, 2024
07cd7ed
Renamed FIleSystem module
juliamauri Dec 14, 2024
c6e2875
Removed white space
juliamauri Dec 14, 2024
8db25d2
Added EventSystem module
juliamauri Dec 14, 2024
6c5275e
Added WIndowManager module
juliamauri Dec 15, 2024
3dfd7fd
Added Dialogs module
juliamauri Dec 15, 2024
9cfa64d
Unindent functions from Dialogs module
juliamauri Dec 15, 2024
ac5732e
Quit SDL video subsystems at cleanup
juliamauri Dec 15, 2024
85bc58a
Removed static from variable
juliamauri Dec 15, 2024
560d01a
Changed unsigned int to unit32_t
juliamauri Dec 15, 2024
92dd52e
Removed todo
juliamauri Dec 15, 2024
eb29b20
[WIP] Added JSON module
juliamauri Dec 16, 2024
a00a87e
Added function comments at modules
juliamauri Dec 16, 2024
63df1ab
Proper way to remove a flag
juliamauri Dec 16, 2024
fa40649
Update .gitignore
juliamauri Dec 16, 2024
bf06251
Apply ClangFormat
juliamauri Dec 16, 2024
bf92ae4
Fix include
juliamauri Dec 16, 2024
f8a99d4
Added more Json functionality
juliamauri Dec 16, 2024
4434fa9
Added Linux configurations
juliamauri Dec 17, 2024
3008984
Create cmake-multi-platform.yml
juliamauri Dec 17, 2024
babc8d2
Enable submodule checkout
juliamauri Dec 17, 2024
632173e
Fix submodules parameter
juliamauri Dec 17, 2024
338e8e8
Run bootstrap-vcpkg.sh before configure cmake
juliamauri Dec 17, 2024
2309f0a
Removed unrecognized action
juliamauri Dec 17, 2024
bfab235
Added vcpkg toolchain
juliamauri Dec 17, 2024
2120041
Install linux dependences before running cmake
juliamauri Dec 17, 2024
c5f88d5
Removed unamed namespace from export
juliamauri Dec 17, 2024
6a676cd
Add perl-open
juliamauri Dec 17, 2024
844827e
Install perl
juliamauri Dec 17, 2024
5d79003
Log vcpkg output
juliamauri Dec 17, 2024
ca8894f
Always run
juliamauri Dec 17, 2024
fca1cdd
Install libtool-bin package
juliamauri Dec 17, 2024
af0194f
Tesst with nanother package
juliamauri Dec 17, 2024
25cbe5c
Add libltdl-dev package
juliamauri Dec 18, 2024
23f57fb
Clear logs
juliamauri Dec 18, 2024
d1d64a5
[DevOps] Define DCMAKE_CXX_SCAN_FOR_MODULES aargument
juliamauri Dec 18, 2024
6ec2bd8
[DevOps] Add Ninja to CMake
juliamauri Dec 18, 2024
527b8ff
PreInstall ninja
juliamauri Dec 18, 2024
0bf5b46
[DevOps] Enable CMAKE_CXX_SCAN_FOR_MODULES in CMakeLists
juliamauri Dec 18, 2024
c1e5855
[DevOps] Set up Visual Studio environment
juliamauri Dec 18, 2024
8a638a6
[DevOps] Execute windows calls as cmd
juliamauri Dec 18, 2024
a18ec25
[DevOps] Fix VS path
juliamauri Dec 18, 2024
71e9229
[DevOps] Try to set missing cl compiler
juliamauri Dec 18, 2024
2f73f14
[DevOps] Fix VS path
juliamauri Dec 18, 2024
7294265
Change CL for CL.exe
juliamauri Dec 18, 2024
d3e93b7
Add quotes in arguments
juliamauri Dec 18, 2024
f4a1e84
[DevOps] Enable Set up Visual Studio environment
juliamauri Dec 18, 2024
7219e8d
[DevOps] Fix VS path
juliamauri Dec 18, 2024
e3290ea
[DevOps] Try with complete CL path
juliamauri Dec 18, 2024
9288146
[DevOps] Add quotes
juliamauri Dec 18, 2024
633808c
[DevOps] Add single quote
juliamauri Dec 18, 2024
f3741b7
Removed shell
juliamauri Dec 18, 2024
680fa5f
[DevOps] Revert CL path
juliamauri Dec 18, 2024
102fe3a
[DevOps] FIx VS call
juliamauri Dec 18, 2024
216baf2
[DevOps] Persistent shell
juliamauri Dec 18, 2024
f7beb48
[DevOps] Fix CMake call
juliamauri Dec 18, 2024
d33e101
[DevOps] Setup VS with egor-tensin/vs-shell tool
juliamauri Dec 18, 2024
cf7556f
[DevOps] Fix step
juliamauri Dec 18, 2024
f59cd8e
[DevOps] Add CMake to Linux dependences
juliamauri Dec 18, 2024
2bd0b82
[DevOps] Add build-essential to ensure that uses last gcc compiler
juliamauri Dec 18, 2024
354150f
[DevOps] Install Linux packages from ppa:ubuntu-toolchain-r/test
juliamauri Dec 18, 2024
411584b
[Library] Update rapidjson include
juliamauri Dec 18, 2024
a9436fa
[Lens] Update rapidjson include
juliamauri Dec 18, 2024
e21ab0e
[Library] FileSystem multiplatform support
juliamauri Dec 18, 2024
8888335
[DevOps] Use CMake presets
juliamauri Dec 18, 2024
95576fc
[DevOps] Fix matrix exclude
juliamauri Dec 18, 2024
8e1e21d
[DevOps] Add beauty_os exclude
juliamauri Dec 18, 2024
8ce41a1
[DevOps] Remove configuration from matrix
juliamauri Dec 18, 2024
b8f8a7d
[DevOps] Fix build path
juliamauri Dec 18, 2024
e69ede9
[DevOps] Remove preset from build
juliamauri Dec 18, 2024
126159c
[DevOps[ Comment test step
juliamauri Dec 18, 2024
aaa0c7a
[Library] NDF module multiplatform support
juliamauri Dec 19, 2024
df29c6f
[Lens] Add missing include for support linux
juliamauri Dec 19, 2024
288cb41
[Lens] Add missing include at Json for multiplatform support
juliamauri Dec 19, 2024
9335b5f
[Library] NDF uses char insted of wchar on Linux
juliamauri Dec 19, 2024
7a84691
[Library] Remove missing wchat_t from NDF linux
juliamauri Dec 19, 2024
0d7a8de
[Library][Linux] Remove wchar_t outputs form Dialogs
juliamauri Dec 19, 2024
f957176
[Library][Linux] Removed last wchat_t from Dialogs
juliamauri Dec 19, 2024
fa31232
[Library][GUI][Linux] Use static when it´s on unnamed namespace
juliamauri Dec 19, 2024
fd73d7d
[Library][GUI][Linux] Removed unnamed namespace
juliamauri Dec 19, 2024
ac84653
[Library][Event][Lionux] Remove unnamed namespace
juliamauri Dec 19, 2024
2c8cf86
[Lens][Input][Linux] Fix to bind function
juliamauri Dec 19, 2024
2c90639
[Lens][Input[Linux] Add typeinfo include
juliamauri Dec 19, 2024
ac66071
[Lens][Input][Linux] Pass a function pointer
juliamauri Dec 19, 2024
50f5691
[Lens][Input][Linux] Use lambda function
juliamauri Dec 19, 2024
8e0bf7e
[Lens][Input][Linux] Avoid implicit conversions
juliamauri Dec 19, 2024
58f4d46
[Library][Json][Linux] Remove unnamed namespace
juliamauri Dec 19, 2024
3974d55
[Library][Json][Linux] Static functions
juliamauri Dec 19, 2024
4ab253c
[Lens][Linux] Fix functions binds to event system
juliamauri Dec 19, 2024
afc4358
[Library][Json] Add more JSON functionaloties
juliamauri Dec 19, 2024
ef80ba2
[Lens][Json] Use JSON module to load/save projects
juliamauri Dec 19, 2024
be03815
[Lens] Add missing output files
juliamauri Dec 19, 2024
07c4441
[Lens] Add missing header changes
juliamauri Dec 19, 2024
279b057
[Lens] Add missing include
juliamauri Dec 20, 2024
37af816
[Library] Remove unnamed namespaces and statics from modules
juliamauri Dec 20, 2024
47a4bb4
[Library]FileSystem] Change FS deprecated functions
juliamauri Dec 20, 2024
322c98d
[Library][JSON] Fix -Wreturn-type warning
juliamauri Dec 20, 2024
5a373d0
[Lens] Fix -Wformat-security warnings
juliamauri Dec 20, 2024
516809b
[Lens] Fix -Wunused-result warning
juliamauri Dec 20, 2024
8911eab
[Library] Import module before export defininition
juliamauri Dec 20, 2024
bae2707
Revert last commit
juliamauri Dec 20, 2024
1ddefbf
[Library][JSON] Use optional for _selected variable
juliamauri Dec 20, 2024
8f079cf
[DevOps] Integrate SonarCloud (#10)
juliamauri Dec 20, 2024
1db47e7
[DevOps][SonarCloud] Fix to get sha from commit (#12)
juliamauri Dec 21, 2024
ef4e7a8
[DevOps] Dedicated SonarCloud pipelines
juliamauri Dec 21, 2024
8bb3f4a
[DevOps] Fix secret variable
juliamauri Dec 21, 2024
c24c6aa
[DevOps][SonarCloud] Fix build-output-dir variable
juliamauri Dec 21, 2024
0e1ffc0
[DevOps] Template sonacloud jobs name
juliamauri Dec 21, 2024
782715b
[DevOps] Fix target_source variable
juliamauri Dec 21, 2024
0d1434d
[DevOps][SonarCloud] Template sonar.projectKey
juliamauri Dec 21, 2024
7bd0d1e
[DevOps][SonarCloud] Add missing parameter
juliamauri Dec 21, 2024
e1bd916
[DevOps][SonarCloud] FIx target_source path
juliamauri Dec 21, 2024
dc1ddfd
[DevOps][SonarCloud] Remove trim from shaVersion
juliamauri Dec 21, 2024
50b027e
[DevOps][SonarCloud] Only trigger on source changes
juliamauri Dec 21, 2024
e39d8fa
[DevOps] CleanUp caches when pull_request is closed
juliamauri Dec 21, 2024
158dbf0
Merge pull request #13 from juliamauri/sonarcloud_jobs
juliamauri Dec 21, 2024
620f849
[Project] Cleanup files (#14)
juliamauri Dec 21, 2024
32316f0
Update README.md (#15)
juliamauri Dec 21, 2024
4708bf7
[Project] Apply license correctly
juliamauri Dec 21, 2024
ebac6d1
[DevOps] Remove build_dir parameter
juliamauri Dec 21, 2024
b1d9768
Merge pull request #16 from juliamauri/licensing
juliamauri Dec 21, 2024
adcd95b
[Library][Dialogs] Handle when default strings are nullptr
juliamauri Dec 22, 2024
c8f5fbe
[Lens] Project template inside a folder
juliamauri Dec 22, 2024
82bf0bb
Merge pull request #17 from juliamauri/polish_lens
juliamauri Dec 22, 2024
8570ede
[Unit Tests] Add gtest and basic json unite test
juliamauri Dec 22, 2024
02e5a75
[DevOps] Enable ctest
juliamauri Dec 22, 2024
f05cf9a
[DevOps] Fix unit test path and test for debug also
juliamauri Dec 22, 2024
fe74698
Merge pull request #18 from juliamauri/gtest_implementation
juliamauri Dec 22, 2024
e01bf56
[Lens][Library] Add SDL_Video init to window manager 👂
cumus Dec 22, 2024
86b7797
[Library] Added RenderAPIHandler 🙍
cumus Dec 22, 2024
fbf636a
[Engine] Add basic Application running basic render 👴
cumus Dec 22, 2024
8e420c4
[Engine][Library] Add Glew 📼
cumus Dec 22, 2024
9e00adb
[DevOps] Test to install vcpkg dependences on linux
juliamauri Dec 23, 2024
401a498
[DevOps] Always output errors
juliamauri Dec 23, 2024
91e384c
[DevOps][Linux] Add missing dependence
juliamauri Dec 23, 2024
fed9b93
[DevOps] Change log to output and add vulkan
juliamauri Dec 23, 2024
58727d6
[DevOps][Linux] Add dependences
juliamauri Dec 23, 2024
55e4a6a
[DevOps] Update output log
juliamauri Dec 23, 2024
7767c29
[DevOps] Update output log
juliamauri Dec 23, 2024
fb940e2
[DevOps][Linux] Add missing dependence
juliamauri Dec 23, 2024
cd531cd
[DevOps] Add imgui feature vulkan-binding
juliamauri Dec 23, 2024
a4e3d78
[VCPKG] Add imgui feature sdl2-renderer-binding
juliamauri Dec 23, 2024
c3388a5
[DevOps] Remove commented code
juliamauri Dec 23, 2024
c9f61f2
[DevOps] Add render API libraries and pipeline dependencies
juliamauri Dec 23, 2024
77c7425
Merge branch 'main' into Triangle-Render
juliamauri Dec 23, 2024
aa8b2a2
[CMake] New presets for render configuration ☕
cumus Dec 23, 2024
50d598a
[CMake] Improve presets
juliamauri Dec 23, 2024
3910a9d
[DevOps] Update to new configurations
juliamauri Dec 23, 2024
fdcd42f
[DevOps] Fix preset and reduce pipeline overhead
juliamauri Dec 23, 2024
6d61362
[DevOps] Compile all render API
juliamauri Dec 23, 2024
41db862
[DevOps] Remove duplicated code
juliamauri Dec 23, 2024
7af85f3
[DevOps] Matrix SonarCloud
juliamauri Dec 23, 2024
d1f1bdb
[DevOps[ Fix sonarcloud workflow
juliamauri Dec 23, 2024
04fbb74
[DevOps] Fix sonarcloud workflow
juliamauri Dec 23, 2024
4817f22
[DevOps] Remove matrix conbinations
juliamauri Dec 23, 2024
e284cd9
[DevOps] Specify shell
juliamauri Dec 23, 2024
b13c131
[DevOps] Fix environment variable
juliamauri Dec 23, 2024
b252867
[DevOps] Fix variables
juliamauri Dec 23, 2024
8649438
[DevOps] Check if there are changes form pull request
juliamauri Dec 23, 2024
d0188b2
[CMake][Library] Add Vulkan & OpenGL options to library's cmake 🔻
cumus Dec 23, 2024
93b7c36
[Library] Fix Vulkan implementation 🍔
cumus Dec 23, 2024
583c503
Merge pull request #19 from juliamauri/Triangle-Render
cumus Dec 23, 2024
ba35821
[DevOps] Enable code coverage
juliamauri Dec 24, 2024
618d637
[TMP] Add change to trigger sonarcloud
juliamauri Dec 24, 2024
22746c1
[DevOps] Exti 1 when therea are no source files at sonarcloud
juliamauri Dec 24, 2024
1e458ad
[DevOps] FIx gcov version dependence
juliamauri Dec 24, 2024
e74994f
[DevOps] Skip job when there are not any change for sonarcloud
juliamauri Dec 24, 2024
a10d2b0
[DevOps] Error handling and debugging for coverage reports
juliamauri Dec 24, 2024
dfe5e07
[Unit Tests] Update json_test
juliamauri Dec 24, 2024
48c60ef
[DevOps] Add argument to lcov call
juliamauri Dec 24, 2024
c0d0f60
[Unit Test] Comment ParseInvalidJsonString test
juliamauri Dec 24, 2024
e67c189
[DevOps] Add config matrix variable
juliamauri Dec 24, 2024
d9aa6ab
[DevOps] Remove any include from system at code coverage
juliamauri Dec 24, 2024
cd59237
[DevOps] Add --ignore-errors mismatch to code coverage
juliamauri Dec 24, 2024
41e2401
[DevOps] Fix argument
juliamauri Dec 24, 2024
fd2472b
[DevOps] Fix Run tests and generate coverage report (Linux) script
juliamauri Dec 24, 2024
67f14d1
[DevOps] Add back --ignore-errors mismatch
juliamauri Dec 24, 2024
3d34149
[DevOps] Remove code coverage path unnused path
juliamauri Dec 24, 2024
0feb1f0
[DevOps] Fix code coverage output
juliamauri Dec 24, 2024
c0e0bf8
[DevOps] Use lcov-cobertura npm package
juliamauri Dec 24, 2024
023dca8
[DevOps] Use gcovr for code coverage output
juliamauri Dec 24, 2024
b461d40
[DevOps] Use fully gcovr instead of lcov
juliamauri Dec 24, 2024
cd5a240
[DevOps] Fix gcovr paths
juliamauri Dec 24, 2024
0bd485c
[DevOps] Generate directory for code coverage report
juliamauri Dec 24, 2024
3b77b04
[DevOps] Generate SonarQube-compatible XML coverage report
juliamauri Dec 24, 2024
f878d08
[CMake] Add coverage compile options
juliamauri Dec 24, 2024
998b661
Point to path
juliamauri Dec 24, 2024
85ca7fa
[DevOps] Test Gcorv
juliamauri Dec 24, 2024
18c838e
Fix source path
juliamauri Dec 24, 2024
e4bc31c
Test gcorv
juliamauri Dec 24, 2024
484586f
Fix path
juliamauri Dec 24, 2024
1363bda
Add --sonarqube argument
juliamauri Dec 24, 2024
cc61f12
Specify path
juliamauri Dec 24, 2024
f628301
Add more logs
juliamauri Dec 24, 2024
4609622
debug mode
juliamauri Dec 24, 2024
88ac510
Add sonar.cfamily.gcov.reportsPath
juliamauri Dec 24, 2024
bb5e982
Tri different
juliamauri Dec 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 9 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 120
BreakBeforeBraces: Allman
AllowShortFunctionsOnASingleLine: false
IndentCaseLabels: true
NamespaceIndentation: All
PointerAlignment: Left
31 changes: 31 additions & 0 deletions .github/workflows/cleanup-caches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Cleanup caches by a branch

on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cleanup
run: |
echo "Fetching list of cache keys"
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')

## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh cache delete $cacheKey || true
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
106 changes: 106 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: CMake on multiple platforms

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: ${{ matrix.os }}
env:
BUILD_WRAPPER_OUT_DIR: ${{ github.workspace }}/sonar

strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
platform: [x64]
c_compiler: [gcc, clang, cl]
graphics: [opengl, vulkan]
include:
- os: windows-latest
beauty_os: windows
platform: x64
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
beauty_os: linux
platform: x64
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
beauty_os: linux
platform: x64
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- name: Set reusable strings
id: strings
shell: bash
run: echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y autoconf automake libtool libtool-bin pkg-config m4 libltdl-dev ninja-build cmake libglu1-mesa-dev libxext-dev libxrandr-dev
sudo apt-get install -y gcc-14 g++-14 # Replace with the desired version if necessary
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
gcc --version
g++ --version

- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: choco install ninja

- name: Set up Visual Studio shell
if: matrix.os == 'windows-latest'
uses: egor-tensin/vs-shell@v2
with:
arch: ${{ matrix.platform }}

- name: Configure CMake Debug
run: cmake --preset ${{ matrix.platform }}-debug-${{ matrix.beauty_os }}-${{ matrix.graphics }}

- name: Build Debug
run: cmake --build ${{ steps.strings.outputs.build-output-dir }}/${{ matrix.platform }}-debug-${{ matrix.beauty_os }}-${{ matrix.graphics }}

- name: Test Debug
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cd ${{ steps.strings.outputs.build-output-dir }}/${{ matrix.platform }}-debug-${{ matrix.beauty_os }}-${{ matrix.graphics }}
ctest --verbose
cd ${{ github.workspace }}

- name: Configure CMake Release
run: cmake --preset ${{ matrix.platform }}-release-${{ matrix.beauty_os }}-${{ matrix.graphics }}

- name: Build Release
run: cmake --build ${{ steps.strings.outputs.build-output-dir }}/${{ matrix.platform }}-release-${{ matrix.beauty_os }}-${{ matrix.graphics }}

- name: Test Release
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cd ${{ steps.strings.outputs.build-output-dir }}/${{ matrix.platform }}-release-${{ matrix.beauty_os }}-${{ matrix.graphics }}
ctest --verbose
cd ${{ github.workspace }}
199 changes: 199 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
name: SonarCloud on whole project files

on:
push:
branches: [ "main" ]
paths:
- 'source/Engine/**'
- 'source/Lens/**'
- 'source/Modules/**'
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened]
paths:
- 'source/Engine/**'
- 'source/Lens/**'
- 'source/Modules/**'

jobs:
sonarcloud:
runs-on: ${{ matrix.os }}
env:
PLATFORM: x64

strategy:
fail-fast: false
matrix:
include:
- target_source: 'source/Engine'
project_key: 'redeye_engine'
os: windows-latest
beauty_os: windows
build_wrapper: 'build-wrapper-win-x86-64.exe'
config: 'release'
- target_source: 'source/Lens'
project_key: 'redeye_lens'
os: windows-latest
beauty_os: windows
build_wrapper: 'build-wrapper-win-x86-64.exe'
config: 'release'
- target_source: 'source/Modules'
project_key: 'redeye_library'
os: windows-latest
beauty_os: windows
build_wrapper: 'build-wrapper-win-x86-64.exe'
config: 'release'
- target_source: 'source/Engine,source/Lens,source/Modules'
project_key: 'redeye_main'
os: ubuntu-latest
beauty_os: linux
build_wrapper: 'build-wrapper-linux-x86-64'
config: 'debug'

steps:
- name: 'Checkout fetch-depth: 0'
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Fetch all branches
run: git fetch --all

- name: Check for changes in target source
id: check_changes
shell: bash
continue-on-error: true
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch origin ${{ github.event.pull_request.base.ref }}
git fetch origin ${{ github.event.pull_request.head.ref }}
git diff --name-only origin/${{ github.event.pull_request.base.ref }}...origin/${{ github.event.pull_request.head.ref }} > changed_files.txt
else
git fetch origin main
git diff --name-only origin/main...HEAD > changed_files.txt
fi
target_source_pattern=$(echo "${{ matrix.target_source }}" | sed 's/,/|/g')
if ! grep -qE "$target_source_pattern" changed_files.txt; then
echo "No changes in ${{ matrix.target_source }}. Skipping job."
echo "skip_job=true" >> $GITHUB_ENV
fi

- name: Set reusable strings
if: env.skip_job != 'true'
id: strings
shell: bash
run: |
echo "build-wrapper-out-dir=${{ github.workspace }}/sonar" >> "$GITHUB_OUTPUT"
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "preset=${{ env.PLATFORM }}-${{ matrix.config }}-${{ matrix.beauty_os }}-opengl" >> "$GITHUB_OUTPUT"

- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest' && env.skip_job != 'true'
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y autoconf automake libtool libtool-bin pkg-config m4 libltdl-dev ninja-build cmake libglu1-mesa-dev libxext-dev libxrandr-dev
sudo apt-get install -y gcc-14 g++-14 lcov
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-14 100
gcc --version
g++ --version
gcov --version
lcov --version

- name: Install gcovr (Linux)
if: matrix.os == 'ubuntu-latest' && env.skip_job != 'true'
run: sudo pip install gcovr

- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest' && env.skip_job != 'true'
run: choco install ninja

- name: Set up Visual Studio shell (Windows)
if: matrix.os == 'windows-latest' && env.skip_job != 'true'
uses: egor-tensin/vs-shell@v2
with:
arch: ${{ env.PLATFORM }}

- name: Configure CMake Release (Windows)
if: matrix.os == 'windows-latest' && env.skip_job != 'true'
run: cmake --preset ${{ steps.strings.outputs.preset }}

- name: Configure CMake Release (Linux)
if: matrix.os == 'ubuntu-latest' && env.skip_job != 'true'
run: cmake --preset ${{ steps.strings.outputs.preset }} -DCODE_COVERAGE=ON

- name: Create sonar-project.properties
if: env.skip_job != 'true'
shell: bash
run: |
sourceDirectory="${{ github.workspace }}"
majorVersion=6
minorVersion=0

branch="${{ github.ref }}"
if [[ "$branch" == refs/pull/* ]]; then
branch="${{ github.head_ref }}"
else
branch="${branch#refs/heads/}"
fi
echo "Branch: $branch"

shaVersion=$(git rev-parse --short origin/$branch)
version="${majorVersion}.${minorVersion}.${shaVersion}"
echo "Version: $version"

content="sonar.projectKey=${{ matrix.project_key }}\n"
content+="sonar.organization=redeye\n"
content+="sonar.projectVersion=$version\n"
content+="sonar.sources=${{ matrix.target_source }}\n"
content+="sonar.cfamily.enableModules=true\n"

if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
content+="sonar.cfamily.gcov.reportsPath=sonarqube-report.xml\n"
fi

echo -e $content > "${sourceDirectory}/sonar-project.properties"

- name: Install sonar-scanner and build-wrapper
if: env.skip_job != 'true'
uses: SonarSource/sonarcloud-github-c-cpp@v3

- name: Run build-wrapper Release
if: env.skip_job != 'true'
run: |
${{ matrix.build_wrapper }} --out-dir ${{ steps.strings.outputs.build-wrapper-out-dir }} cmake --build ${{ steps.strings.outputs.build-output-dir }}/${{ steps.strings.outputs.preset }}

- name: Run tests (Linux)
if: matrix.os == 'ubuntu-latest' && env.skip_job != 'true'
run: |
# Navigate to build directory
cd ${{ steps.strings.outputs.build-output-dir }}/${{ steps.strings.outputs.preset }}

# Run tests with verbose output
ctest --output-on-failure

- name: Generate coverage report (Linux)
if: matrix.os == 'ubuntu-latest' && env.skip_job != 'true'
run: |
# Generate SonarQube-compatible coverage XML report for Modules
gcovr --root source --object-directory ${{ steps.strings.outputs.build-output-dir }}/${{ steps.strings.outputs.preset }} --xml --output coverage.xml --sonarqube sonarqube-report.xml

# Log SonarQube-compatible XML coverage report for debugging
echo "SonarQube XML Coverage Report:"
cat sonarqube-report.xml

# Log XML coverage report for debugging
echo "XML Coverage Report:"
cat coverage.xml

- name: Run sonar-scanner
if: env.skip_job != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.sonar_token }}
run: sonar-scanner -X --define sonar.cfamily.compile-commands="${{ steps.strings.outputs.build-wrapper-out-dir }}/compile_commands.json"
Loading