Skip to content

Commit ef65646

Browse files
authored
Rewrite CI scripts (#180)
- Split test script into two scripts: one for Windows and one for POSIX system - Define reported errors in CI environment instead of build system file - Add address sanitizer - Enable building shared libraries for POSIX and both types for Windows in CMake
1 parent d74f856 commit ef65646

File tree

6 files changed

+64
-45
lines changed

6 files changed

+64
-45
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
---
2-
name: tests
2+
name: posix
33
"on":
44
push:
55
branches: [main]
66
pull_request:
77

8+
env:
9+
CXXFLAGS: -fsanitize=address -Werror -Wall -Wextra -pedantic
10+
LDFLAGS: -fsanitize=address
11+
812
jobs:
9-
test:
13+
cmake:
1014
runs-on: ${{ matrix.os }}
1115
strategy:
1216
fail-fast: false
@@ -16,32 +20,29 @@ jobs:
1620
- ubuntu-24.04
1721
- macos-13
1822
- macos-15
19-
- windows-2019
20-
- windows-2022
2123
steps:
2224
- name: Set up `tmpfs` (if supported)
2325
run: sudo mount tmpfs -t tmpfs -o size=100m /tmp
2426
if: runner.os == 'Linux'
2527
- name: Checkout repository
2628
uses: actions/checkout@v4
2729
- name: Configure CMake
28-
run: cmake -B build -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
30+
run: cmake -B build -DBUILD_SHARED_LIBS=TRUE
2931
- name: Build tests
3032
run: cmake --build build
3133
- name: Run tests
3234
run: ctest --output-on-failure --test-dir build
33-
test-meson:
35+
36+
meson:
3437
runs-on: ${{ matrix.os }}
3538
strategy:
3639
fail-fast: false
3740
matrix:
3841
os:
39-
- macos-13
40-
- macos-15
4142
- ubuntu-20.04
4243
- ubuntu-24.04
43-
- windows-2019
44-
- windows-2022
44+
- macos-13
45+
- macos-15
4546
steps:
4647
- name: Set up `tmpfs` (if supported)
4748
run: sudo mount tmpfs -t tmpfs -o size=100m /tmp
@@ -52,16 +53,9 @@ jobs:
5253
- name: Install Meson (Brew)
5354
run: brew install meson
5455
if: runner.os == 'macOS'
55-
- name: Install Meson (Pip)
56-
run: pip install meson ninja
57-
if: runner.os == 'Windows'
5856
- name: Checkout repository
5957
uses: actions/checkout@v4
60-
- name: Configure Meson (Unix)
58+
- name: Configure Meson
6159
run: meson setup build
62-
if: runner.os != 'Windows'
63-
- name: Configure Meson (Windows)
64-
run: meson setup build -Dvsenv=true
65-
if: runner.os == 'Windows'
6660
- name: Run tests
6761
run: meson test -C build

.github/workflows/release.yml

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

.github/workflows/windows.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: windows
3+
"on":
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
CXXFLAGS: /WX /W3 /wd4251
10+
11+
jobs:
12+
cmake:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os:
18+
- windows-2019
19+
- windows-2022
20+
BUILD_SHARED_LIBS:
21+
- "TRUE"
22+
- "FALSE"
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
- name: Configure CMake
27+
run: cmake -B build -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }}
28+
- name: Build tests
29+
run: cmake --build build
30+
- name: Run tests
31+
run: ctest --output-on-failure --test-dir build
32+
33+
meson:
34+
runs-on: ${{ matrix.os }}
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
os:
39+
- windows-2019
40+
- windows-2022
41+
steps:
42+
- name: Install Meson
43+
run: pip install meson ninja
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
- name: Configure Meson
47+
run: meson setup build -Dvsenv=true
48+
- name: Run tests
49+
run: meson test -C build

cmake/modules/FindGTest.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ if(GTest_FOUND)
5050
return()
5151
endif()
5252

53+
set(BUILD_SHARED_LIBS OFF)
5354
if(POLICY CMP0135)
5455
cmake_policy(SET CMP0135 NEW)
5556
endif()

meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ else
2323
dll_build_args = []
2424
endif
2525

26+
dll_build_args += '-D_CRT_SECURE_NO_WARNINGS'
27+
2628
tmp = library(
2729
'tmp',
2830
'src/create.cpp',

src/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
find_package(Filesystem REQUIRED)
2-
include(GenerateExportHeader)
32

43
add_library(${PROJECT_NAME} create.cpp file.cpp directory.cpp)
54
target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
@@ -18,15 +17,6 @@ target_include_directories(${PROJECT_NAME}
1817
PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
1918
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
2019

21-
if(TMP_IS_TOP_LEVEL)
22-
if(CMAKE_CXX_COMPILER_ID MATCHES GNU|Clang)
23-
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic)
24-
elseif(MSVC)
25-
# FIXME: warning C4251 for 'tmp::entry::pathobject'
26-
target_compile_options(${PROJECT_NAME} PRIVATE /W3 /wd4251)
27-
endif()
28-
endif()
29-
3020
if(BUILD_SHARED_LIBS)
3121
target_compile_definitions(${PROJECT_NAME}
3222
PRIVATE TMP_BUILDING_DLL INTERFACE TMP_SHARED)

0 commit comments

Comments
 (0)