Skip to content

Commit

Permalink
Update GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Rookfighter committed Jan 20, 2024
1 parent 207ef05 commit 425fbc0
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 62 deletions.
59 changes: 11 additions & 48 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,31 @@ jobs:
strategy:
matrix:
config:
- os: ubuntu-20.04
name: Ubuntu 20.04 Debug
- os: ubuntu-latest
name: Ubuntu Debug
build_type: Debug
test_exec: ./test/run_tests
- os: ubuntu-20.04
name: Ubuntu 20.04 Release
- os: ubuntu-latest
name: Ubuntu Release
build_type: Release
test_exec: ./test/run_tests
- os: ubuntu-18.04
name: Ubuntu 18.04 Debug
build_type: Debug
test_exec: ./test/run_tests
- os: ubuntu-18.04
name: Ubuntu 18.04 Release
build_type: Release
test_exec: ./test/run_tests
- os: windows-latest
name: Windows Debug
build_type: Debug
test_exec: ./test/Debug/run_tests.exe
- os: windows-latest
name: Windows Release
build_type: Release
test_exec: ./test/Release/run_tests.exe
- os: macos-latest
name: Mac OS Debug
build_type: Debug
test_exec: ./test/run_tests
- os: macos-latest
name: Mac OS Release
build_type: Release
test_exec: ./test/run_tests
steps:
- uses: actions/checkout@v2

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} -DBUILD_TESTS=True -DBUILD_EXAMPLES=True

- uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure
run: cmake -S . -B ${{runner.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} -DBUILD_TESTS=True -DBUILD_EXAMPLES=True
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{matrix.config.build_type}}

run: cmake --build ${{runner.workspace}}/build
- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ${{matrix.config.test_exec}}
run: ctest -C ${{matrix.config.build_type}} --test-dir ${{runner.workspace}}/build
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
build
build/
Testing/
.project
.cproject
.settings
.vscode
.vscode
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
# Created On: 26 Dec 2015
# License: MIT

cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.15)

project(inifile-cpp)

include(CTest)

SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand All @@ -20,14 +23,12 @@ endif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")

add_subdirectory(dep)

include_directories(
include
)

install(
FILES "include/inicpp.h"
DESTINATION include
)
add_library(inicpp INTERFACE)
target_include_directories(inicpp INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
add_library(inicpp::inicpp ALIAS inicpp)
install(DIRECTORY inicpp TYPE INCLUDE)

if(${BUILD_TESTS})
add_subdirectory(test)
Expand Down
9 changes: 9 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
# Created On: 14 Nov 2020

add_executable(custom_type_conversion "custom_type_conversion.cpp")
target_link_libraries(custom_type_conversion inicpp::inicpp)

add_executable(decode_ini_file "decode_ini_file.cpp")
target_link_libraries(decode_ini_file inicpp::inicpp)

add_executable(encode_ini_file "encode_ini_file.cpp")
target_link_libraries(encode_ini_file inicpp::inicpp)

add_executable(load_ini_file "load_ini_file.cpp")
target_link_libraries(load_ini_file inicpp::inicpp)

add_executable(save_ini_file "save_ini_file.cpp")
target_link_libraries(save_ini_file inicpp::inicpp)
6 changes: 3 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# Created On: 12 Jul 2019

include_directories(
${CMAKE_CURRENT_LIST_DIR}
${CATCH2_INCLUDE_DIR}
)

set(TEST_SRC
add_executable(unit_tests
"main.cpp"
"test_inifile.cpp"
)
target_link_libraries(unit_tests inicpp::inicpp)

add_executable(run_tests ${TEST_SRC})
add_test(NAME unit_tests COMMAND unit_tests)

0 comments on commit 425fbc0

Please sign in to comment.