diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index cce2395..3b44a3d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -18,10 +18,10 @@ jobs: build_type: ["Debug", "RelWithDebInfo", "Release"] unity_build: ["ON", "OFF"] conan_profile: ["./ConanProfiles/host/clang", "./ConanProfiles/host/clang_asan"] - toolmode: + variant: - { value: "True", name: "toolmode" } - { value: "False", name: "game" } - name: "Build & Test ${{ matrix.build_type }} with ${{ matrix.conan_profile }} (Unity Build: ${{ matrix.unity_build }}, Variant: ${{ matrix.toolmode.name }})" + name: "Build & Test ${{ matrix.build_type }} with ${{ matrix.conan_profile }} (Unity Build: ${{ matrix.unity_build }}, Variant: ${{ matrix.variant.name }})" steps: - name: Install Node.js run: apt-get update && apt-get install -y nodejs @@ -33,18 +33,18 @@ jobs: - name: Build run: | - conan install . --remote=bigfootpackages -pr:h=${{ matrix.conan_profile }} -pr:b=./ConanProfiles/build/clang --build=missing -s build_type=${{ matrix.build_type }} -o bigfoot/*:build_tests=True -o bigfoot/*:build_benchmarks=True -o bigfoot/*:tracy=False -o bigfoot/*:vulkan=True -o bigfoot/*:toolmode=${{ matrix.toolmode.value }} -of build-${{ matrix.toolmode.name }} - . ./build-${{ matrix.toolmode.name }}/build/${{ matrix.build_type }}/generators/conanbuild.sh - cmake -S . -B ./build-${{ matrix.toolmode.name }}/${{ matrix.build_type }} --toolchain ./build-${{ matrix.toolmode.name }}/build/${{ matrix.build_type }}/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_UNITY_BUILD=${{ matrix.unity_build }} -G "Ninja" - cmake --build build-${{ matrix.toolmode.name }}/${{ matrix.build_type }} --parallel $(nproc) - . ./build-${{ matrix.toolmode.name }}/build/${{ matrix.build_type }}/generators/deactivate_conanbuild.sh + conan install . --remote=bigfootpackages -pr:h=${{ matrix.conan_profile }} -pr:b=./ConanProfiles/build/clang --build=missing -s build_type=${{ matrix.build_type }} -o bigfoot/*:build_tests=True -o bigfoot/*:build_benchmarks=True -o bigfoot/*:tracy=False -o bigfoot/*:vulkan=True -o bigfoot/*:toolmode=${{ matrix.variant.value }} -of build-${{ matrix.variant.name }} + . ./build-${{ matrix.variant.name }}/build/${{ matrix.build_type }}/generators/conanbuild.sh + cmake -S . -B ./build-${{ matrix.variant.name }}/${{ matrix.build_type }} --toolchain ./build-${{ matrix.variant.name }}/build/${{ matrix.build_type }}/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_UNITY_BUILD=${{ matrix.unity_build }} -G "Ninja" + cmake --build build-${{ matrix.variant.name }}/${{ matrix.build_type }} --parallel $(nproc) + . ./build-${{ matrix.variant.name }}/build/${{ matrix.build_type }}/generators/deactivate_conanbuild.sh - name: Unit Tests run: | - cd ./build-${{ matrix.toolmode.name }}/${{ matrix.build_type }} - . ../../build-${{ matrix.toolmode.name }}/build/${{ matrix.build_type }}/generators/conanbuild.sh + cd ./build-${{ matrix.variant.name }}/${{ matrix.build_type }} + . ../../build-${{ matrix.variant.name }}/build/${{ matrix.build_type }}/generators/conanbuild.sh xvfb-run ctest . --output-on-failure - . ../../build-${{ matrix.toolmode.name }}/build/${{ matrix.build_type }}/generators/deactivate_conanbuild.sh + . ../../build-${{ matrix.variant.name }}/build/${{ matrix.build_type }}/generators/deactivate_conanbuild.sh clang-format: runs-on: ubuntu-latest @@ -60,6 +60,6 @@ jobs: uses: actions/checkout@v6 with: submodules: recursive - + - name: Clang Format Checks - run: chmod +x format.sh && ./format.sh --check Bigfoot \ No newline at end of file + run: chmod +x format.sh && ./format.sh --check Bigfoot diff --git a/.gitea/workflows/sonarqube.yml b/.gitea/workflows/sonarqube.yml index a642d6e..ec995f3 100644 --- a/.gitea/workflows/sonarqube.yml +++ b/.gitea/workflows/sonarqube.yml @@ -17,7 +17,14 @@ jobs: container: image: git.romainboullard.com/bigfootdev/linuxcppbuilder:development - name: "Sonarqube" + strategy: + fail-fast: false + matrix: + variant: + - { value: "True", name: "toolmode", projectKey: "Bigfoot-Tool", projectName: "Bigfoot Tool" } + - { value: "False", name: "game", projectKey: "Bigfoot-Game", projectName: "Bigfoot Game" } + + name: "Sonarqube (${{ matrix.variant.name }})" steps: - name: Install Node.js run: apt-get update && apt-get install -y nodejs @@ -29,26 +36,30 @@ jobs: submodules: recursive ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Read version + id: version + run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" + - name: Build run: | - conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/host/clang_coverage -pr:b=./ConanProfiles/build/clang --build=missing -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:build_benchmarks=True -o bigfoot/*:tracy=False -o bigfoot/*:toolmode=True -o bigfoot/*:vulkan=True -of build-toolmode - . ./build-toolmode/build/Debug/generators/conanbuild.sh - cmake -S . -B ./build-toolmode/Debug --toolchain ./build-toolmode/build/Debug/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -G "Ninja" - cmake --build build-toolmode/Debug --parallel $(nproc) - . ./build-toolmode/build/Debug/generators/deactivate_conanbuild.sh + conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/host/clang_coverage -pr:b=./ConanProfiles/build/clang --build=missing -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:build_benchmarks=True -o bigfoot/*:tracy=False -o bigfoot/*:toolmode=${{ matrix.variant.value }} -o bigfoot/*:vulkan=True -of build-${{ matrix.variant.name }} + . ./build-${{ matrix.variant.name }}/build/Debug/generators/conanbuild.sh + cmake -S . -B ./build-${{ matrix.variant.name }}/Debug --toolchain ./build-${{ matrix.variant.name }}/build/Debug/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -G "Ninja" + cmake --build build-${{ matrix.variant.name }}/Debug --parallel $(nproc) + . ./build-${{ matrix.variant.name }}/build/Debug/generators/deactivate_conanbuild.sh - name: Run tests run: | - cd ./build-toolmode/Debug - . ../../build-toolmode/build/Debug/generators/conanbuild.sh + cd ./build-${{ matrix.variant.name }}/Debug + . ../../build-${{ matrix.variant.name }}/build/Debug/generators/conanbuild.sh LLVM_PROFILE_FILE="%p.profraw%c" xvfb-run ctest --output-on-failure - . ../../build-toolmode/build/Debug/generators/deactivate_conanbuild.sh + . ../../build-${{ matrix.variant.name }}/build/Debug/generators/deactivate_conanbuild.sh - name: Clang-Tidy - run: run-clang-tidy -p ./build-toolmode/Debug/ >> tidy_result.txt + run: run-clang-tidy -p ./build-${{ matrix.variant.name }}/Debug/ > tidy_result.txt - name: Infer - run: infer run --compilation-database build-toolmode/Debug/compile_commands.json + run: infer run --compilation-database build-${{ matrix.variant.name }}/Debug/compile_commands.json - name: Generate coverage report shell: bash @@ -58,8 +69,8 @@ jobs: # rejects outright ("Wrong major version"). Bypassing gcovr's JSON # path entirely: llvm-cov's lcov exporter is a separate, unaffected # code path, so merge -> export lcov -> convert lcov to Cobertura. - llvm-profdata merge -sparse $(find build-toolmode/Debug -name "*.profraw") -o merged.profdata - BINARIES=($(find build-toolmode/Debug -maxdepth 8 -type f -executable -iname "*Tests")) + llvm-profdata merge -sparse $(find build-${{ matrix.variant.name }}/Debug -name "*.profraw") -o merged.profdata + BINARIES=($(find build-${{ matrix.variant.name }}/Debug -maxdepth 8 -type f -executable -iname "*Tests")) OBJECT_ARGS=$(printf -- '-object %s ' "${BINARIES[@]:1}") llvm-cov export -format=lcov -instr-profile=merged.profdata "${BINARIES[0]}" $OBJECT_ARGS > coverage.lcov # lcov_cobertura isn't preinstalled on the image; inject it into @@ -71,7 +82,11 @@ jobs: uses: SonarSource/sonarqube-scan-action@v7.0.0 with: args: > - -Dsonar.cxx.jsonCompilationDatabase=./build-toolmode/Debug/compile_commands.json + -Dsonar.projectKey=${{ matrix.variant.projectKey }} + -Dsonar.projectName=${{ matrix.variant.projectName }} + -Dsonar.projectVersion=${{ steps.version.outputs.version }} + -Dsonar.cxx.jsonCompilationDatabase=./build-${{ matrix.variant.name }}/Debug/compile_commands.json + -Dsonar.cxx.xunit.reportPaths=build-${{ matrix.variant.name }}/Debug/TestResults/*.xml -Dsonar.qualitygate.wait=true ${{ github.event_name == 'pull_request' && format('-Dsonar.pullrequest.key={0} -Dsonar.pullrequest.branch={1} -Dsonar.pullrequest.base={2} -Dsonar.analysis.sqbot={3}', diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ac58d1..5f50841 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,10 @@ else() set(BIGFOOT_PROJECT_NAME BigfootGame) endif() -project(${BIGFOOT_PROJECT_NAME} VERSION 0.1.0 +file(READ ${CMAKE_SOURCE_DIR}/VERSION BIGFOOT_VERSION) +string(STRIP "${BIGFOOT_VERSION}" BIGFOOT_VERSION) + +project(${BIGFOOT_PROJECT_NAME} VERSION ${BIGFOOT_VERSION} DESCRIPTION "The Bigfoot engine" LANGUAGES CXX) diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/conanfile.py b/conanfile.py index 11a4c44..64afada 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout -from conan.tools.files import copy +from conan.tools.files import copy, load import os required_conan_version = ">=1.33.0" @@ -11,7 +11,9 @@ class Bigfoot(ConanFile): description = "Bigfoot is a 3D game engine written in C++" topics = ("game engine", "3d") license = "MIT" - version = "0.1.0" + + def set_version(self): + self.version = load(self, "VERSION").strip() # Binary configuration settings = "os", "compiler", "build_type", "arch" diff --git a/sonar-project.properties b/sonar-project.properties index 9fe172c..9ac7aa0 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,3 @@ -sonar.projectKey=Bigfoot - -sonar.projectVersion=0.1.0 - sonar.sourceEncoding=UTF-8 sonar.sources=Bigfoot/Sources @@ -10,7 +6,6 @@ sonar.tests=Bigfoot/Tests sonar.cxx.file.suffixes=.hpp,.cpp,.h sonar.cxx.clangtidy.reportPaths=tidy_result.txt sonar.cxx.infer.reportPaths=infer-out/report.json -sonar.cxx.xunit.reportPaths=build-toolmode/Debug/TestResults/*.xml sonar.cxx.cobertura.reportPaths=coverage.xml sonar.coverage.exclusions=**/*_generated.hpp