Skip to content

Commit 7fcd526

Browse files
committed
Improve repository structure and github workflows (avoid false positives)
1 parent 8e4befa commit 7fcd526

14 files changed

Lines changed: 221 additions & 234 deletions

.github/workflows/cpp-linter.yml

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

.github/workflows/examples-multi-platform.yml

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

.github/workflows/linux.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Linux CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
build_type: [Release]
16+
cpp_compiler: [g++, clang++]
17+
cxx_std: [17, 20, 23]
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set reusable strings
21+
id: strings
22+
shell: bash
23+
run: |
24+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
25+
- name: Setup CMake
26+
uses: jwlawson/actions-setup-cmake@v2
27+
with:
28+
cmake-version: '3.24.x'
29+
- name: Configure CMake
30+
run: >
31+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
32+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
33+
-DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }}
34+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
35+
-DCMAKE_BUILD_TESTS=TRUE
36+
-DCMAKE_BUILD_EXAMPLES=TRUE
37+
-S ${{ github.workspace }}
38+
- name: Build
39+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel
40+
- name: Run Tests
41+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
42+
run: ctest --test-dir tests/ --output-on-failure --parallel
43+
- name: Run Examples
44+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
45+
run: ./examples/examples

.github/workflows/macos.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: macOS
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: macos-latest
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
build_type: [Release]
16+
cpp_compiler: [clang++]
17+
cxx_std: [17, 20, 23]
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set reusable strings
21+
id: strings
22+
shell: bash
23+
run: |
24+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
25+
- name: Setup CMake
26+
uses: jwlawson/actions-setup-cmake@v2
27+
with:
28+
cmake-version: '3.24.x'
29+
- name: Configure CMake
30+
run: >
31+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
32+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
33+
-DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }}
34+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
35+
-DCMAKE_BUILD_TESTS=TRUE
36+
-DCMAKE_BUILD_EXAMPLES=TRUE
37+
-S ${{ github.workspace }}
38+
- name: Build
39+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel
40+
- name: Run Tests
41+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
42+
run: ctest --test-dir tests/ --output-on-failure --parallel
43+
- name: Run Examples
44+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
45+
run: ./examples/examples

.github/workflows/tests-multi-platform.yml

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

.github/workflows/windows.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Windows
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: windows-latest
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
build_type: [Release]
16+
cpp_compiler: [cl]
17+
cxx_std: [17, 20, 23]
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set reusable strings
21+
id: strings
22+
shell: bash
23+
run: |
24+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
25+
- name: Setup CMake
26+
uses: jwlawson/actions-setup-cmake@v2
27+
with:
28+
cmake-version: '3.24.x'
29+
- name: Configure CMake
30+
run: >
31+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
32+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
33+
-DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }}
34+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
35+
-DCMAKE_BUILD_TESTS=TRUE
36+
-DCMAKE_BUILD_EXAMPLES=TRUE
37+
-S ${{ github.workspace }}
38+
- name: Build
39+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel
40+
- name: Run Tests
41+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
42+
run: ctest --test-dir tests/ -C ${{ matrix.build_type }} --output-on-failure --parallel
43+
- name: Run Examples
44+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
45+
run: ./examples/${{ matrix.build_type }}/examples.exe

CMakeLists.txt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
cmake_minimum_required(VERSION 3.24)
2-
project(cstring-lite)
2+
project(cstring_lite)
33

4-
if (NOT CMAKE_CXX_STANDARD)
5-
set(CMAKE_CXX_STANDARD 17)
4+
set(CMAKE_CXX_STANDARD 17 CACHE STRING "")
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
7+
set(CMAKE_BUILD_TESTS FALSE CACHE BOOL "")
8+
set(CMAKE_BUILD_EXAMPLES FALSE CACHE BOOL "")
9+
10+
add_library(${PROJECT_NAME} INTERFACE)
11+
target_include_directories(${PROJECT_NAME} INTERFACE
12+
${CMAKE_CURRENT_SOURCE_DIR}/include
13+
)
14+
15+
if(MSVC)
16+
add_compile_options(/W4 /WX /permissive-)
17+
else()
18+
add_compile_options(-Wall -Wextra -Werror -Wpedantic)
619
endif()
720

8-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
21+
if(${CMAKE_BUILD_TESTS})
22+
add_subdirectory(tests)
23+
endif()
924

10-
if (${TULI_ENV_BUILD_TESTS})
11-
add_subdirectory(tests)
12-
elseif (${TULI_ENV_BUILD_EXAMPLES})
13-
add_subdirectory(examples)
25+
if(${CMAKE_BUILD_EXAMPLES})
26+
add_subdirectory(examples)
1427
endif()

0 commit comments

Comments
 (0)