Skip to content

Commit ce0e875

Browse files
authored
Merge branch 'develop' into bugfix/workaround-amendmentcenter-exception
2 parents 0c611fc + e733fad commit ce0e875

File tree

10 files changed

+74
-55
lines changed

10 files changed

+74
-55
lines changed

.github/actions/cmake/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ inputs:
3737
description: Whether to generate Debian package
3838
required: true
3939
default: "false"
40+
version:
41+
description: Version of the clio_server binary
42+
required: false
43+
default: ""
4044

4145
runs:
4246
using: composite
@@ -67,6 +71,9 @@ runs:
6771
# This way it works both for PRs and pushes to branches.
6872
GITHUB_BRANCH_NAME: "${{ github.head_ref || github.ref_name }}"
6973
GITHUB_HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
74+
#
75+
# If tag is being pushed, or it's a nightly release, we use that version.
76+
FORCE_CLIO_VERSION: ${{ inputs.version }}
7077
run: |
7178
cmake \
7279
-B "${BUILD_DIR}" \

.github/workflows/nightly.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,20 @@ defaults:
2828
shell: bash
2929

3030
jobs:
31+
get_date:
32+
name: Get Date
33+
runs-on: ubuntu-latest
34+
outputs:
35+
date: ${{ steps.get_date.outputs.date }}
36+
steps:
37+
- name: Get current date
38+
id: get_date
39+
run: |
40+
echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
41+
3142
build-and-test:
3243
name: Build and Test
44+
needs: get_date
3345

3446
strategy:
3547
fail-fast: false
@@ -67,9 +79,11 @@ jobs:
6779
upload_clio_server: true
6880
download_ccache: false
6981
upload_ccache: false
82+
version: nightly-${{ needs.get_date.outputs.date }}
7083

7184
package:
7285
name: Build debian package
86+
needs: get_date
7387

7488
uses: ./.github/workflows/reusable-build.yml
7589
with:
@@ -83,11 +97,13 @@ jobs:
8397
static: true
8498
upload_clio_server: false
8599
package: true
100+
version: nightly-${{ needs.get_date.outputs.date }}
86101
targets: package
87102
analyze_build_time: false
88103

89104
analyze_build_time:
90105
name: Analyze Build Time
106+
needs: get_date
91107

92108
strategy:
93109
fail-fast: false
@@ -114,17 +130,7 @@ jobs:
114130
upload_clio_server: false
115131
targets: all
116132
analyze_build_time: true
117-
118-
get_date:
119-
name: Get Date
120-
runs-on: ubuntu-latest
121-
outputs:
122-
date: ${{ steps.get_date.outputs.date }}
123-
steps:
124-
- name: Get current date
125-
id: get_date
126-
run: |
127-
echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
133+
version: nightly-${{ needs.get_date.outputs.date }}
128134

129135
nightly_release:
130136
needs: [build-and-test, package, get_date]

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
upload_clio_server: true
4444
download_ccache: false
4545
upload_ccache: false
46-
expected_version: ${{ github.event_name == 'push' && github.ref_name || '' }}
46+
version: ${{ github.event_name == 'push' && github.ref_name || '' }}
4747

4848
package:
4949
name: Build debian package
@@ -60,6 +60,7 @@ jobs:
6060
static: true
6161
upload_clio_server: false
6262
package: true
63+
version: ${{ github.event_name == 'push' && github.ref_name || '' }}
6364
targets: package
6465
analyze_build_time: false
6566

.github/workflows/reusable-build-test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ on:
6363
type: string
6464
default: all
6565

66-
expected_version:
67-
description: Expected version of the clio_server binary
68-
required: false
69-
type: string
70-
default: ""
71-
7266
package:
7367
description: Whether to generate Debian package
7468
required: false
7569
type: boolean
7670
default: false
7771

72+
version:
73+
description: Version of the clio_server binary
74+
required: false
75+
type: string
76+
default: ""
77+
7878
jobs:
7979
build:
8080
uses: ./.github/workflows/reusable-build.yml
@@ -90,8 +90,8 @@ jobs:
9090
upload_clio_server: ${{ inputs.upload_clio_server }}
9191
targets: ${{ inputs.targets }}
9292
analyze_build_time: false
93-
expected_version: ${{ inputs.expected_version }}
9493
package: ${{ inputs.package }}
94+
version: ${{ inputs.version }}
9595

9696
test:
9797
needs: build

.github/workflows/reusable-build.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ on:
6060
required: true
6161
type: boolean
6262

63-
expected_version:
64-
description: Expected version of the clio_server binary
65-
required: false
66-
type: string
67-
default: ""
68-
6963
package:
7064
description: Whether to generate Debian package
7165
required: false
7266
type: boolean
7367

68+
version:
69+
description: Version of the clio_server binary
70+
required: false
71+
type: string
72+
default: ""
73+
7474
secrets:
7575
CODECOV_TOKEN:
7676
required: false
@@ -93,10 +93,6 @@ jobs:
9393
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
9494
with:
9595
fetch-depth: 0
96-
# We need to fetch tags to have correct version in the release
97-
# The workaround is based on https://github.com/actions/checkout/issues/1467
98-
fetch-tags: true
99-
ref: ${{ github.ref }}
10096

10197
- name: Prepare runner
10298
uses: XRPLF/actions/prepare-runner@65da1c59e81965eeb257caa3587b9d45066fb925
@@ -139,6 +135,7 @@ jobs:
139135
static: ${{ inputs.static }}
140136
time_trace: ${{ inputs.analyze_build_time }}
141137
package: ${{ inputs.package }}
138+
version: ${{ inputs.version }}
142139

143140
- name: Build Clio
144141
uses: ./.github/actions/build-clio
@@ -162,7 +159,7 @@ jobs:
162159
- name: Show ccache's statistics and zero it
163160
if: ${{ inputs.download_ccache }}
164161
run: |
165-
ccache --show-stats
162+
ccache --show-stats -vv
166163
ccache --zero-stats
167164
168165
- name: Save ccache cache
@@ -218,15 +215,19 @@ jobs:
218215
if: ${{ inputs.code_coverage }}
219216
uses: ./.github/actions/code-coverage
220217

221-
- name: Verify expected version
222-
if: ${{ inputs.expected_version != '' }}
218+
- name: Verify version is expected
219+
if: ${{ inputs.version != '' }}
223220
env:
224-
INPUT_EXPECTED_VERSION: ${{ inputs.expected_version }}
221+
INPUT_VERSION: ${{ inputs.version }}
225222
run: |
226223
set -e
227-
EXPECTED_VERSION="clio-${INPUT_EXPECTED_VERSION}"
228-
actual_version=$(./build/clio_server --version)
229-
if [[ "$actual_version" != "$EXPECTED_VERSION" ]]; then
224+
EXPECTED_VERSION="clio-${INPUT_VERSION}"
225+
if [[ ${{ inputs.build_type }} == "Debug" ]]; then
226+
EXPECTED_VERSION="${EXPECTED_VERSION}+DEBUG"
227+
fi
228+
229+
actual_version=$(./build/clio_server --version | head -n 1)
230+
if [[ "${actual_version}" != "${EXPECTED_VERSION}" ]]; then
230231
echo "Expected version '${EXPECTED_VERSION}', but got '${actual_version}'"
231232
exit 1
232233
fi

cmake/ClioVersion.cmake

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,13 @@ message(STATUS "Git branch: ${GIT_BUILD_BRANCH}")
2727
message(STATUS "Git commit hash: ${GIT_COMMIT_HASH}")
2828
message(STATUS "Build date: ${BUILD_DATE}")
2929

30-
set(GIT_COMMAND describe --tags --exact-match)
31-
execute_process(
32-
COMMAND ${GIT_EXECUTABLE} ${GIT_COMMAND}
33-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
34-
OUTPUT_VARIABLE TAG
35-
RESULT_VARIABLE RC
36-
ERROR_VARIABLE ERR
37-
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE
38-
)
39-
40-
if (RC EQUAL 0)
41-
message(STATUS "Found tag '${TAG}' in git. Will use it as Clio version")
30+
if (DEFINED ENV{FORCE_CLIO_VERSION} AND NOT "$ENV{FORCE_CLIO_VERSION}" STREQUAL "")
31+
message(STATUS "Using explicitly provided '${FORCE_CLIO_VERSION}' as Clio version")
4232

43-
set(CLIO_VERSION "${TAG}")
44-
set(DOC_CLIO_VERSION "${TAG}")
33+
set(CLIO_VERSION "$ENV{FORCE_CLIO_VERSION}")
34+
set(DOC_CLIO_VERSION "$ENV{FORCE_CLIO_VERSION}")
4535
else ()
46-
message(STATUS "Error finding tag in git: ${ERR}")
47-
message(STATUS "Will use 'YYYYMMDDHMS-<branch>-<git short rev>' as Clio version")
36+
message(STATUS "Using 'YYYYMMDDHMS-<branch>-<git short rev>' as Clio version")
4837

4938
string(SUBSTRING ${GIT_COMMIT_HASH} 0 7 GIT_COMMIT_HASH_SHORT)
5039

src/util/Assert.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ OnAssert::resetAction()
5454
void
5555
OnAssert::defaultAction(std::string_view message)
5656
{
57-
if (LogServiceState::initialized()) {
57+
if (LogServiceState::initialized() and LogServiceState::hasSinks()) {
5858
LOG(LogService::fatal()) << message;
5959
} else {
60-
std::cerr << message;
60+
std::cerr << message << std::endl;
6161
}
6262
std::exit(EXIT_FAILURE); // std::abort does not flush gcovr output and causes uncovered lines
6363
}

src/util/Channel.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ class Channel {
141141
asyncSend(D&& data, boost::asio::yield_context yield)
142142
requires(std::convertible_to<std::remove_cvref_t<D>, std::remove_cvref_t<T>>)
143143
{
144-
boost::system::error_code ecIn, ecOut;
144+
boost::system::error_code const ecIn;
145+
boost::system::error_code ecOut;
145146
shared_->channel().async_send(ecIn, std::forward<D>(data), yield[ecOut]);
146147

147148
// Workaround: asio channels bug returns ec=0 on cancel, check isClosed() instead

src/util/log/Logger.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ LogServiceState::initialized()
271271
return initialized_;
272272
}
273273

274+
bool
275+
LogServiceState::hasSinks()
276+
{
277+
return not sinks_.empty();
278+
}
279+
274280
void
275281
LogServiceState::reset()
276282
{

src/util/log/Logger.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,14 @@ class LogServiceState {
267267
[[nodiscard]] static bool
268268
initialized();
269269

270+
/**
271+
* @brief Whether the LogService has any sink. If there is no sink, logger will not log messages anywhere.
272+
*
273+
* @return true if the LogService has at least one sink
274+
*/
275+
[[nodiscard]] static bool
276+
hasSinks();
277+
270278
/**
271279
* @brief Reset the logging service to uninitialized state.
272280
*/

0 commit comments

Comments
 (0)