From f15616ede6910609cf38418979fbe167f8f77961 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Fri, 13 Sep 2024 16:41:59 +0700 Subject: [PATCH 1/4] feat: add unit tests CI --- .github/workflows/cortex-cpp-quality-gate.yml | 17 +++++++++++------ engine/Makefile | 12 ++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cortex-cpp-quality-gate.yml b/.github/workflows/cortex-cpp-quality-gate.yml index e2233c036..6e03884e1 100644 --- a/.github/workflows/cortex-cpp-quality-gate.yml +++ b/.github/workflows/cortex-cpp-quality-gate.yml @@ -24,26 +24,26 @@ jobs: - os: "linux" name: "amd64" runs-on: "ubuntu-20-04-cuda-12-0" - cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake" - build-deps-cmake-flags: "" + cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake" + build-deps-cmake-flags: "" ccache-dir: '' - os: "mac" name: "amd64" runs-on: "macos-13" - cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake" + cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake" build-deps-cmake-flags: "" ccache-dir: '' - os: "mac" name: "arm64" runs-on: "macos-latest" - cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake" + cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake" build-deps-cmake-flags: "" ccache-dir: '' - os: "windows" name: "amd64" runs-on: "windows-cuda-12-0" - cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja" - build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja" + cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja" + build-deps-cmake-flags: "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja" ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache' steps: - name: Clone @@ -78,6 +78,11 @@ jobs: run: | cd engine make build CMAKE_EXTRA_FLAGS="${{ matrix.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ matrix.build-deps-cmake-flags }}" + + - name: Run unit tests + run: | + make run-unit-tests + - name: Pre-package run: | diff --git a/engine/Makefile b/engine/Makefile index 5bc84d120..98779f845 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -53,6 +53,18 @@ else make -j4; endif +run-unit-tests: +ifeq ($(OS),Windows_NT) + @powershell -Command "cd build\test\components\Release\; .\test-components.exe;" +else ifeq ($(shell uname -s),Linux) + @cd build/test/components/;\ + ./test-components +else + @cd build/test/components/;\ + ./test-components +endif + + pre-package: ifeq ($(OS),Windows_NT) @powershell -Command "mkdir -p cortex;" From 9941fad1c4b05cfe028709fec56a555806e27d6b Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Fri, 13 Sep 2024 16:49:58 +0700 Subject: [PATCH 2/4] fix: make --- .github/workflows/cortex-cpp-quality-gate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cortex-cpp-quality-gate.yml b/.github/workflows/cortex-cpp-quality-gate.yml index 6e03884e1..5eeea439d 100644 --- a/.github/workflows/cortex-cpp-quality-gate.yml +++ b/.github/workflows/cortex-cpp-quality-gate.yml @@ -81,9 +81,9 @@ jobs: - name: Run unit tests run: | + cd engine make run-unit-tests - - name: Pre-package run: | cd engine From 995e215e38d7f2e19e889caabb62fdb9c0e746e5 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Fri, 13 Sep 2024 17:11:05 +0700 Subject: [PATCH 3/4] fix: more --- engine/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/Makefile b/engine/Makefile index 98779f845..d75df75a2 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -55,7 +55,7 @@ endif run-unit-tests: ifeq ($(OS),Windows_NT) - @powershell -Command "cd build\test\components\Release\; .\test-components.exe;" + @powershell -Command "cd build\test\components\; .\test-components.exe;" else ifeq ($(shell uname -s),Linux) @cd build/test/components/;\ ./test-components From d343e00cc564430838dfbf1122b64a1244eacd01 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Fri, 13 Sep 2024 17:41:17 +0700 Subject: [PATCH 4/4] fix: format --- .github/workflows/cortex-cpp-quality-gate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cortex-cpp-quality-gate.yml b/.github/workflows/cortex-cpp-quality-gate.yml index 5eeea439d..66a0715ea 100644 --- a/.github/workflows/cortex-cpp-quality-gate.yml +++ b/.github/workflows/cortex-cpp-quality-gate.yml @@ -25,7 +25,7 @@ jobs: name: "amd64" runs-on: "ubuntu-20-04-cuda-12-0" cmake-flags: "-DCORTEX_CPP_VERSION=${{github.event.pull_request.head.sha}} -DCMAKE_BUILD_TEST=ON -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake" - build-deps-cmake-flags: "" + build-deps-cmake-flags: "" ccache-dir: '' - os: "mac" name: "amd64"