Skip to content

Commit fe49c63

Browse files
committed
test: implement test workflow
1 parent 55e506a commit fe49c63

File tree

8 files changed

+297
-452
lines changed

8 files changed

+297
-452
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Windows CMake Build & Test
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
pull_request:
8+
branches:
9+
- develop
10+
11+
jobs:
12+
build:
13+
runs-on: windows-latest
14+
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
19+
- name: Install MinGW
20+
run: |
21+
choco install mingw --version=12.2.0 -y
22+
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" >> $GITHUB_PATH
23+
gcc --version
24+
25+
- name: Build
26+
run: |
27+
mkdir __build__
28+
cd __build__
29+
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=gcc -S.. -G Ninja
30+
cmake --build .
31+
32+
- name: Run Tests
33+
working-directory: __build__
34+
run: |
35+
ctest . --output-on-failure

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"files.associations": {
3+
"*.lcdjson": "json",
34
"lwevt_types.h": "c",
45
"lwevt_type.h": "c",
56
"lwevt.h": "c",
67
"string.h": "c",
7-
"lwevt_opt.h": "c"
8+
"lwevt_opt.h": "c",
9+
"windows.h": "c",
10+
"lwprintf.h": "c"
811
},
912
"esbonio.sphinx.confDir": ""
1013
}

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ project(LwLibPROJECT)
66
if(NOT PROJECT_IS_TOP_LEVEL)
77
add_subdirectory(lwprintf)
88
else()
9+
enable_testing()
910
add_executable(${PROJECT_NAME})
1011
target_sources(${PROJECT_NAME} PRIVATE
1112
${CMAKE_CURRENT_LIST_DIR}/dev/main.c
1213
${CMAKE_CURRENT_LIST_DIR}/lwprintf/src/system/lwprintf_sys_win32.c
14+
${CMAKE_CURRENT_LIST_DIR}/tests/test.c
1315
)
1416
target_include_directories(${PROJECT_NAME} PUBLIC
1517
${CMAKE_CURRENT_LIST_DIR}
@@ -24,4 +26,7 @@ else()
2426
# Add compile options to the library, which will propagate options to executable through public link
2527
target_compile_definitions(lwprintf PUBLIC WIN32 _DEBUG CONSOLE LWPRINTF_DEV)
2628
target_compile_options(lwprintf PUBLIC -Wall -Wextra -Wpedantic)
29+
30+
# Add test
31+
add_test(NAME Test COMMAND $<TARGET_FILE:${CMAKE_PROJECT_NAME}>)
2732
endif()

dev/lwprintf_dev.sln

Lines changed: 0 additions & 31 deletions
This file was deleted.

dev/lwprintf_dev.vcxproj

Lines changed: 0 additions & 155 deletions
This file was deleted.

dev/lwprintf_dev.vcxproj.filters

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)