Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9d3810c

Browse files
committedMay 17, 2025
Simplify Debug/Release options
The change in hazelcast#1279 made it obvious that adding configuration for `Debug` builds (e.g. "add an extra compilation argument") was very tedious as it needs to be declared in _each_ workflow and then passed all the way down to the actual scripts that build the code. Instead, it'd be much cleaner if the jobs _only_ declare a release type, and the build scripts react to that with the appropriate actions (e.g. adding some extra debug or whatever). Changes: - migrate the _implementation_ of the `DEBUG` builds into the `build-` scripts - e.g. `WARN_AS_ERROR` can be assumed when `DEBUG` is enabled, rather than being duplicated in each job configuration - remove the architecture to pass these redundant params down - pass `BUILD_TYPE` into the `build-` scripts as an environment variable, as used for other parameters - rename `BUILD_CONFIGURATION` to `BUILD_TYPE` in Windows scripts for consistency - enable `WARN_AS_ERROR` on Windows for consistency This PR also helps to make hazelcast#1279 smaller.
1 parent 02614f2 commit 9d3810c

File tree

11 files changed

+31
-65
lines changed

11 files changed

+31
-65
lines changed
 

‎.github/actions/build-test/macos-x86_64/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ inputs:
55
required: true
66
BOOST_VERSION:
77
required: true
8-
WARN_AS_ERR:
9-
required: true
108
BUILD_TYPE:
119
required: true
1210
SHARED_LIBS_TOGGLE:
@@ -53,7 +51,6 @@ runs:
5351
GH_TOKEN: ${{ inputs.GH_TOKEN }}
5452
BOOST_VERSION: ${{ inputs.BOOST_VERSION }}
5553
THRIFT_VERSION: ${{ inputs.THRIFT_VERSION }}
56-
WARN_AS_ERR: ${{ inputs.WARN_AS_ERR }}
5754
BUILD_TYPE: ${{ inputs.BUILD_TYPE }}
5855
SHARED_LIBS_TOGGLE: ${{ inputs.SHARED_LIBS_TOGGLE }}
5956
OPENSSL_TOGGLE: ${{ inputs.OPENSSL_TOGGLE }}

‎.github/actions/build-test/ubuntu-i386/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ inputs:
77
required: true
88
THRIFT_VERSION:
99
required: true
10-
WARN_AS_ERR:
11-
required: true
1210
BUILD_TYPE:
1311
required: true
1412
SHARED_LIBS_TOGGLE:
@@ -112,7 +110,6 @@ runs:
112110
GH_TOKEN: ${{ inputs.GH_TOKEN }}
113111
BOOST_VERSION: ${{ inputs.BOOST_VERSION }}
114112
THRIFT_VERSION: ${{ inputs.THRIFT_VERSION }}
115-
WARN_AS_ERR: ${{ inputs.WARN_AS_ERR }}
116113
BUILD_TYPE: ${{ inputs.BUILD_TYPE }}
117114
SHARED_LIBS_TOGGLE: ${{ inputs.SHARED_LIBS_TOGGLE }}
118115
OPENSSL_TOGGLE: ${{ inputs.OPENSSL_TOGGLE }}

‎.github/actions/build-test/ubuntu-x86_64/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ inputs:
77
required: true
88
THRIFT_VERSION:
99
required: true
10-
WARN_AS_ERR:
11-
required: true
1210
BUILD_TYPE:
1311
required: true
1412
SHARED_LIBS_TOGGLE:
@@ -74,7 +72,6 @@ runs:
7472
GH_TOKEN: ${{ inputs.GH_TOKEN }}
7573
BOOST_VERSION: ${{ inputs.BOOST_VERSION }}
7674
THRIFT_VERSION: ${{ inputs.THRIFT_VERSION }}
77-
WARN_AS_ERR: ${{ inputs.WARN_AS_ERR }}
7875
BUILD_TYPE: ${{ inputs.BUILD_TYPE }}
7976
SHARED_LIBS_TOGGLE: ${{ inputs.SHARED_LIBS_TOGGLE }}
8077
OPENSSL_TOGGLE: ${{ inputs.OPENSSL_TOGGLE }}

‎.github/actions/build-test/unix/action.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ inputs:
77
required: true
88
THRIFT_VERSION:
99
required: true
10-
WARN_AS_ERR:
11-
required: true
1210
BUILD_TYPE:
1311
required: true
1412
SHARED_LIBS_TOGGLE:
@@ -45,11 +43,10 @@ runs:
4543
env:
4644
BUILD_DIR: build
4745
INSTALL: ON
48-
WARN_AS_ERR: ${{ inputs.WARN_AS_ERR }}
46+
BUILD_TYPE: ${{ inputs.BUILD_TYPE }}
4947
shell: ${{ env.shell }}
5048
run: |
5149
./scripts/build-unix.sh \
52-
-DCMAKE_BUILD_TYPE=${{ inputs.BUILD_TYPE }} \
5350
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/destination \
5451
-DBUILD_SHARED_LIBS=${{ inputs.SHARED_LIBS_TOGGLE }} \
5552
-DWITH_OPENSSL=${{ inputs.OPENSSL_TOGGLE }} \

‎.github/actions/coverage-report/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ runs:
6363
env:
6464
BUILD_DIR: build
6565
COVERAGE: ON
66+
BUILD_TYPE: Debug
6667
shell: ${{ env.shell }}
6768
run: |
6869
./scripts/build-unix.sh \
69-
-DCMAKE_BUILD_TYPE=Debug \
7070
-DBUILD_SHARED_LIBS=ON \
7171
-DWITH_OPENSSL=ON \
7272
-DBUILD_TESTS=ON \

‎.github/workflows/build-pr.yml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ jobs:
121121
fail-fast: false
122122
matrix:
123123
build_type:
124-
- type: Debug
125-
warn_as_err: ON
126-
- type: Release
127-
warn_as_err: OFF
124+
- Debug
125+
- Release
128126

129127
shared_libs:
130128
- toggle: OFF
@@ -143,7 +141,7 @@ jobs:
143141
image: i386/ubuntu
144142
options: --privileged
145143

146-
name: ubuntu-i386-(${{ matrix.build_type.type }}, ${{ matrix.shared_libs.name }}, ${{ matrix.with_openssl.name }})
144+
name: ubuntu-i386-(${{ matrix.build_type }}, ${{ matrix.shared_libs.name }}, ${{ matrix.with_openssl.name }})
147145

148146
steps:
149147
# Deliberately uses an old version because i386 is stuck on an outdated version of Javascript
@@ -158,8 +156,7 @@ jobs:
158156
GH_TOKEN: ${{ secrets.GH_TOKEN }}
159157
BOOST_VERSION: ${{ env.boost_version }}
160158
THRIFT_VERSION: ${{ env.thrift_version }}
161-
WARN_AS_ERR: ${{ matrix.build_type.warn_as_err }}
162-
BUILD_TYPE: ${{ matrix.build_type.type }}
159+
BUILD_TYPE: ${{ matrix.build_type }}
163160
SHARED_LIBS_TOGGLE: ${{ matrix.shared_libs.toggle }}
164161
OPENSSL_TOGGLE: ${{ matrix.with_openssl.toggle }}
165162
RUN_TESTS: ${{ env.run_tests }}
@@ -176,10 +173,8 @@ jobs:
176173
matrix:
177174

178175
build_type:
179-
- type: Debug
180-
warn_as_err: ON
181-
- type: Release
182-
warn_as_err: OFF
176+
- Debug
177+
- Release
183178

184179
shared_libs:
185180
- toggle: OFF
@@ -195,7 +190,7 @@ jobs:
195190

196191
runs-on: ubuntu-latest
197192

198-
name: ubuntu-x64-(${{ matrix.build_type.type }}, ${{ matrix.shared_libs.name }}, ${{ matrix.with_openssl.name }})
193+
name: ubuntu-x64-(${{ matrix.build_type }}, ${{ matrix.shared_libs.name }}, ${{ matrix.with_openssl.name }})
199194
steps:
200195

201196
- uses: actions/checkout@v4
@@ -208,8 +203,7 @@ jobs:
208203
GH_TOKEN: ${{ secrets.GH_TOKEN }}
209204
BOOST_VERSION: ${{ env.boost_version }}
210205
THRIFT_VERSION: ${{ env.thrift_version }}
211-
WARN_AS_ERR: ${{ matrix.build_type.warn_as_err }}
212-
BUILD_TYPE: ${{ matrix.build_type.type }}
206+
BUILD_TYPE: ${{ matrix.build_type }}
213207
SHARED_LIBS_TOGGLE: ${{ matrix.shared_libs.toggle }}
214208
OPENSSL_TOGGLE: ${{ matrix.with_openssl.toggle }}
215209
RUN_TESTS: ${{ env.run_tests }}
@@ -283,10 +277,8 @@ jobs:
283277
fail-fast: false
284278
matrix:
285279
build_type:
286-
- type: Debug
287-
warn_as_err: ON
288-
- type: Release
289-
warn_as_err: OFF
280+
- Debug
281+
- Release
290282

291283
shared_libs:
292284
- toggle: OFF
@@ -302,7 +294,7 @@ jobs:
302294

303295
runs-on: macos-latest
304296

305-
name: macOS-(${{ matrix.build_type.type }}, ${{ matrix.shared_libs.name }}, ${{ matrix.with_openssl.name }})
297+
name: macOS-(${{ matrix.build_type }}, ${{ matrix.shared_libs.name }}, ${{ matrix.with_openssl.name }})
306298
env:
307299
OPENSSL_ROOT_DIR: /usr/local/opt/openssl/
308300

@@ -316,8 +308,7 @@ jobs:
316308
with:
317309
GH_TOKEN: ${{ secrets.GH_TOKEN }}
318310
BOOST_VERSION: ${{ env.boost_version }}
319-
WARN_AS_ERR: ${{ matrix.build_type.warn_as_err }}
320-
BUILD_TYPE: ${{ matrix.build_type.type }}
311+
BUILD_TYPE: ${{ matrix.build_type }}
321312
SHARED_LIBS_TOGGLE: ${{ matrix.shared_libs.toggle }}
322313
OPENSSL_TOGGLE: ${{ matrix.with_openssl.toggle }}
323314
RUN_TESTS: ${{ env.run_tests }}

‎.github/workflows/nightly-macos-x86_64.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ jobs:
2020
- version: 1.76.0
2121

2222
build_type:
23-
- type: Debug
24-
warn_as_err: ON
25-
- type: Release
26-
warn_as_err: OFF
23+
- Debug
24+
- Release
2725

2826
shared_libs:
2927
- toggle: OFF
@@ -41,7 +39,7 @@ jobs:
4139

4240
name: >-
4341
macOS-x86_64
44-
(${{ matrix.build_type.type }}, ${{ matrix.shared_libs.name }}, ${{ matrix.with_openssl.name }}, ${{matrix.boost.version}})
42+
(${{ matrix.build_type }}, ${{ matrix.shared_libs.name }}, ${{ matrix.with_openssl.name }}, ${{matrix.boost.version}})
4543
4644
env:
4745
OPENSSL_ROOT_DIR: /usr/local/opt/openssl/
@@ -53,8 +51,7 @@ jobs:
5351
with:
5452
GH_TOKEN: ${{ secrets.GH_TOKEN }}
5553
BOOST_VERSION: ${{ matrix.boost.version }}
56-
WARN_AS_ERR: ${{ matrix.build_type.warn_as_err }}
57-
BUILD_TYPE: ${{ matrix.build_type.type }}
54+
BUILD_TYPE: ${{ matrix.build_type }}
5855
SHARED_LIBS_TOGGLE: ${{ matrix.shared_libs.toggle }}
5956
OPENSSL_TOGGLE: ${{ matrix.with_openssl.toggle }}
6057
RUN_TESTS: ${{ inputs.run_tests || github.event_name == 'schedule' }}

‎.github/workflows/nightly-ubuntu-i386.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ jobs:
1919
- version: 1.71.0
2020
- version: 1.76.0
2121
build_type:
22-
- type: Debug
23-
warn_as_err: ON
24-
- type: Release
25-
warn_as_err: OFF
22+
- Debug
23+
- Release
2624

2725
shared_libs:
2826
- toggle: OFF
@@ -43,7 +41,7 @@ jobs:
4341

4442
name: >-
4543
Ubuntu-i386
46-
(${{ matrix.build_type.type }}, ${{ matrix.shared_libs.name }}, ${{matrix.boost.version}},${{ matrix.with_openssl.name }})
44+
(${{ matrix.build_type }}, ${{ matrix.shared_libs.name }}, ${{matrix.boost.version}},${{ matrix.with_openssl.name }})
4745
4846
steps:
4947
# Deliberately uses an old version because i386 is stuck on an outdated version of Javascript
@@ -54,8 +52,7 @@ jobs:
5452
GH_TOKEN: ${{ secrets.GH_TOKEN }}
5553
BOOST_VERSION: ${{ matrix.boost.version }}
5654
THRIFT_VERSION: 0.13.0
57-
WARN_AS_ERR: ${{ matrix.build_type.warn_as_err }}
58-
BUILD_TYPE: ${{ matrix.build_type.type }}
55+
BUILD_TYPE: ${{ matrix.build_type }}
5956
SHARED_LIBS_TOGGLE: ${{ matrix.shared_libs.toggle }}
6057
OPENSSL_TOGGLE: ${{ matrix.with_openssl.toggle }}
6158
RUN_TESTS: ${{ inputs.run_tests || github.event_name == 'schedule' }}

‎.github/workflows/nightly-ubuntu-x86_64.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ jobs:
2020
- version: 1.76.0
2121

2222
build_type:
23-
- type: Debug
24-
warn_as_err: ON
25-
- type: Release
26-
warn_as_err: OFF
23+
- Debug
24+
- Release
2725

2826
shared_libs:
2927
- toggle: OFF
@@ -41,7 +39,7 @@ jobs:
4139

4240
name: >-
4341
Ubuntu-x86_64
44-
(${{ matrix.build_type.type }}, ${{ matrix.shared_libs.name }}, ${{matrix.boost.version}}, ${{ matrix.with_openssl.name }})
42+
(${{ matrix.build_type }}, ${{ matrix.shared_libs.name }}, ${{matrix.boost.version}}, ${{ matrix.with_openssl.name }})
4543
4644
steps:
4745
- uses: actions/checkout@v4
@@ -51,8 +49,7 @@ jobs:
5149
GH_TOKEN: ${{ secrets.GH_TOKEN }}
5250
BOOST_VERSION: ${{ matrix.boost.version }}
5351
THRIFT_VERSION: 0.13.0
54-
WARN_AS_ERR: ${{ matrix.build_type.warn_as_err }}
55-
BUILD_TYPE: ${{ matrix.build_type.type }}
52+
BUILD_TYPE: ${{ matrix.build_type }}
5653
SHARED_LIBS_TOGGLE: ${{ matrix.shared_libs.toggle }}
5754
OPENSSL_TOGGLE: ${{ matrix.with_openssl.toggle }}
5855
RUN_TESTS: ${{ inputs.run_tests || github.event_name == 'schedule' }}

‎scripts/build-unix.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# - BIT_VERSION : target platform architecture (32 or 64)
99
# - COVERAGE : add compiler flags necessary for test coverage (set to ON)
1010
# - INSTALL : install after the build finishes (set to ON)
11-
# - WARN_AS_ERR : treat compiler warnings as errors (set to ON)
1211
# - CXXFLAGS : additional compiler flags
12+
# - BUILD_TYPE : config to use when building (Release, Debug, etc.)
1313
#
1414
# Command line arguments are forwarded to CMake.
1515
#
@@ -30,7 +30,8 @@ fi
3030
# enable all compiler warnings
3131
CXXFLAGS="$CXXFLAGS -Wall"
3232

33-
if [ "$WARN_AS_ERR" = "ON" ]; then
33+
if [ "${BUILD_TYPE}" = "Debug" ]; then
34+
# treat compiler warnings as errors when the build type is Debug
3435
CXXFLAGS="$CXXFLAGS -Werror"
3536
fi
3637

@@ -46,6 +47,7 @@ echo "BIT_VERSION = $BIT_VERSION"
4647
echo "COVERAGE = $COVERAGE"
4748
echo "INSTALL = $INSTALL"
4849
echo "CXXFLAGS = $CXXFLAGS"
50+
echo "BUILD_TYPE = $BUILD_TYPE"
4951
echo "CMake arguments = $@"
5052

5153
# export flags variable to be used by CMake
@@ -57,7 +59,7 @@ mkdir $BUILD_DIR
5759
cd $BUILD_DIR
5860

5961
echo "Configuring..."
60-
cmake $SOURCE_DIR "$@"
62+
cmake $SOURCE_DIR -DCMAKE_BUILD_TYPE=${BUILD_TYPE} "$@"
6163

6264
echo "Building..."
6365
VERBOSE=1 cmake --build .

‎scripts/do-all-unix.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ set -e
1717
export BUILD_DIR=build
1818
export INSTALL=ON
1919

20-
# treat compiler warnings as errors when the build type is Debug
21-
if [ "$BUILD_TYPE" == "Debug" ]; then
22-
export WARN_AS_ERR=ON
23-
fi
24-
2520
DESTINATION=$(pwd)/destination
2621

2722
# set BUILD_SHARED_LIBS depending on LIBRARY_TYPE
@@ -31,7 +26,6 @@ if [ "$LIBRARY_TYPE" == "STATIC" ]; then
3126
fi
3227

3328
./scripts/build-unix.sh \
34-
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
3529
-DCMAKE_INSTALL_PREFIX=$DESTINATION \
3630
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
3731
-DWITH_OPENSSL=$WITH_OPENSSL \

0 commit comments

Comments
 (0)
Please sign in to comment.