-
Notifications
You must be signed in to change notification settings - Fork 66
204 lines (181 loc) · 6.64 KB
/
cmake-windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: CMake Windows
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'master' }}
# Controls when the action will run.
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
NINJA_VERSION: "1.11.1"
jobs:
cmake_windows:
name: ${{ matrix.name }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- name: "MSVC"
build_type: "Release"
cc: "cl"
cxx: "cl"
build_testing: "OFF"
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
- name: "MinGW-gcc"
build_type: "Release"
cc: "gcc"
cxx: "g++"
build_testing: "ON"
- name: "MinGW-gcc debug-discovery-resource-observable-rep-realloc-concurrent-requests-1"
build_type: "Debug"
cc: "gcc"
cxx: "g++"
build_testing: "ON"
build_args: "-DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON -DOC_REPRESENTATION_REALLOC_ENCODING_ENABLED=ON -DOC_DEVICE_MAX_NUM_CONCURRENT_REQUESTS=1"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "true"
- name: Download Ninja
shell: cmake -P {0}
run: |
message(STATUS "Using host CMake version: ${CMAKE_VERSION}")
message(STATUS "Downloading Ninja (v$ENV{NINJA_VERSION}) build system")
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v$ENV{NINJA_VERSION}/ninja-win.zip")
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip COMMAND_ERROR_IS_FATAL ANY)
- name: Configure
shell: cmake -P {0}
run: |
if (NOT "${{ matrix.environment_script }}" STREQUAL "")
message(STATUS "Set Windows environment")
execute_process(
COMMAND "${{ matrix.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
COMMAND_ERROR_IS_FATAL ANY
)
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program)
message(STATUS "Create Ninja build system")
execute_process(
COMMAND cmake
-S .
-B build
-G Ninja
-D CMAKE_C_COMPILER=${{ matrix.cc }}
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }}
-D CMAKE_MAKE_PROGRAM=${ninja_program}
-D CMAKE_VERBOSE_MAKEFILE=ON
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
-D BUILD_TESTING=${{ matrix.build_testing }}
-D OC_CLOUD_ENABLED=ON
-D OC_COLLECTIONS_IF_CREATE_ENABLED=ON
-D OC_PUSH_ENABLED=ON
-D OC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON
-D PLGD_DEV_TIME_ENABLED=ON
-D OC_ETAG_ENABLED=ON
-D OC_DEBUG_ENABLED=ON
${{ matrix.build_args }}
COMMAND_ERROR_IS_FATAL ANY
)
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
execute_process(
COMMAND cmake --build build
COMMAND_ERROR_IS_FATAL ANY
)
- name: Test
if: ${{ matrix.build_testing == 'ON' }}
shell: cmake -P {0}
working-directory: build
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
execute_process(
COMMAND ctest --verbose --label-regex "oc-unittest"
COMMAND_ERROR_IS_FATAL ANY
)
cmake_windows_msys:
name: ${{ matrix.name }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- name: Clang64
msystem: CLANG64
build_type: Debug
build_args: "-DOC_ASAN_ENABLED=ON -DOC_UBSAN_ENABLED=ON"
cc: clang
cxx: clang++
build_testing: ON
steps:
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: >-
mingw-w64-clang-x86_64-clang
mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-ninja
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "true"
- name: Configure and build
shell: msys2 {0}
run: |
cmake -S . \
-B build \
-G Ninja \
-D CMAKE_C_COMPILER=${{ matrix.cc }} \
-D CMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-D CMAKE_VERBOSE_MAKEFILE=ON \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D BUILD_TESTING=${{ matrix.build_testing }} \
-D OC_CLOUD_ENABLED=ON \
-D OC_COLLECTIONS_IF_CREATE_ENABLED=ON \
-D OC_PUSH_ENABLED=ON \
-D OC_RESOURCE_ACCESS_IN_RFOTM_ENABLED=ON \
-D PLGD_DEV_TIME_ENABLED=ON \
-D OC_ETAG_ENABLED=ON \
-D OC_DEBUG_ENABLED=ON \
${{ matrix.build_args }}
cmake --build build
- name: Test
if: ${{ matrix.build_testing == 'ON' }}
shell: msys2 {0}
working-directory: build
run: |
ctest --verbose --label-regex "oc-unittest"