Skip to content

Commit ec48bba

Browse files
authored
chore: Add additional CI configurations. (#35)
1 parent 949962a commit ec48bba

File tree

14 files changed

+135
-13
lines changed

14 files changed

+135
-13
lines changed

.github/actions/ci/action.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,22 @@ inputs:
1414
description: 'Whether gtest targets should be built & run.'
1515
required: false
1616
default: 'true'
17-
17+
platform_version:
18+
required: false
19+
default: "22.04"
20+
toolset:
21+
required: false
1822

1923
runs:
2024
using: composite
2125
steps:
2226
- name: Install boost
23-
uses: MarkusJx/install-boost@v2.4.4
27+
uses: ./.github/actions/install-boost
2428
id: install-boost
2529
with:
26-
boost_version: 1.81.0
27-
platform_version: 22.04
28-
boost_install_dir: /home/runner/boost
30+
platform_version: ${{ inputs.platform_version }}
31+
toolset: ${{ inputs.toolset }}
32+
2933
- name: Build Library
3034
shell: bash
3135
run: ./scripts/build.sh ${{ inputs.cmake_target }} ON
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This custom action is used because the MarkusJx/install-boost does
2+
# not include all built libraries for mac or windows builds.
3+
# Specifically, it was missing boost_json.
4+
name: Install Boost
5+
description: 'Install boost.'
6+
inputs:
7+
platform_version:
8+
required: false
9+
default: "22.04"
10+
toolset:
11+
required: false
12+
13+
outputs:
14+
BOOST_ROOT:
15+
description: The location of the installed boost.
16+
value: ${{ steps.determine-root.outputs.BOOST_ROOT }}
17+
runs:
18+
using: composite
19+
steps:
20+
- name: Install boost using action
21+
if: runner.os == 'Linux'
22+
uses: MarkusJx/[email protected]
23+
id: boost-action
24+
with:
25+
boost_version: 1.81.0
26+
toolset: ${{ inputs.toolset }}
27+
platform_version: ${{ inputs.platform_version }}
28+
29+
- name: Download boost binaries from artifactory
30+
if: runner.os == 'Windows'
31+
id: boost-download
32+
shell: bash
33+
run: |
34+
choco install boost-msvc-14.3 -y
35+
echo "BOOST_ROOT=C:\local\boost_1_81_0" >> $GITHUB_OUTPUT
36+
37+
- name: Install boost using homebrew
38+
id: brew-action
39+
if: runner.os == 'macOS'
40+
shell: bash
41+
run: |
42+
brew install [email protected]
43+
echo "BOOST_ROOT=$(boost --prefix [email protected])" >> $GITHUB_OUTPUT
44+
45+
- name: Determine root
46+
id: determine-root
47+
shell: bash
48+
run: |
49+
if [ ! -z "$ROOT_ACTION" ]; then
50+
echo "BOOST_ROOT=$ROOT_ACTION" >> $GITHUB_OUTPUT
51+
echo Setting BOOST_ROOT to "$ROOT_ACTION"
52+
elif [ ! -z "$ROOT_DOWN" ]; then
53+
echo "BOOST_ROOT=$ROOT_DOWN" >> $GITHUB_OUTPUT
54+
echo Setting BOOST_ROOT to "$ROOT_DOWN"
55+
else
56+
echo "BOOST_ROOT=$ROOT_BREW" >> $GITHUB_OUTPUT
57+
echo Setting BOOST_ROOT to "$ROOT_BREW"
58+
fi
59+
60+
env:
61+
ROOT_ACTION: ${{ steps.boost-action.outputs.BOOST_ROOT }}
62+
ROOT_BREW: ${{ steps.brew-action.outputs.BOOST_ROOT }}
63+
ROOT_DOWN: ${{ steps.boost-download.outputs.BOOST_ROOT }}

.github/workflows/client.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,30 @@ jobs:
1818
- uses: ./.github/actions/ci
1919
with:
2020
cmake_target: launchdarkly-cpp-client
21+
build-test-mac:
22+
runs-on: macos-12
23+
steps:
24+
- run: |
25+
echo "OPENSSL_ROOT_DIR=$(brew --prefix [email protected])" >> "$GITHUB_ENV"
26+
# For debugging
27+
echo "OPENSSL_ROOT_DIR=$(brew --prefix [email protected])"
28+
- uses: actions/checkout@v3
29+
- uses: ./.github/actions/ci
30+
env:
31+
OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }}
32+
with:
33+
cmake_target: launchdarkly-cpp-client
34+
platform_version: 12
35+
build-test-windows:
36+
runs-on: windows-2022
37+
steps:
38+
- uses: actions/checkout@v3
39+
- uses: ./.github/actions/ci
40+
env:
41+
OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }}
42+
BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3'
43+
BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3'
44+
with:
45+
cmake_target: launchdarkly-cpp-client
46+
platform_version: 2022
47+
toolset: msvc

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (BUILD_TESTING)
2626
if (TESTING_SANITIZERS)
2727
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
2828
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak")
29-
elseif (CMAKE_CXX_COMPILER_ID STREQUAL " GNU")
29+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
3030
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=leak")
3131
endif ()
3232
endif ()

libs/client-sdk/src/data_sources/base_64.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "launchdarkly/client_side/data_sources/detail/base_64.hpp"
22

3+
#include <algorithm>
34
#include <array>
45
#include <bitset>
56
#include <climits>
@@ -58,8 +59,11 @@ std::string Base64UrlEncode(std::string const& input) {
5859

5960
while (bit_index < bit_count) {
6061
// Get either 6 bits, or the remaining number of bits.
61-
auto bits = GetBits(bit_index,
62-
std::min(kIndexBits, bit_count - bit_index), input);
62+
auto bits =
63+
GetBits(bit_index,
64+
std::min(kIndexBits,
65+
static_cast<unsigned long>(bit_count - bit_index)),
66+
input);
6367
out.push_back(static_cast<char>(kBase64Table.at(bits.to_ulong())));
6468
bit_index += kIndexBits;
6569
}

libs/client-sdk/tests/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ file(GLOB tests "${PROJECT_SOURCE_DIR}/tests/*.cpp")
77

88
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
99

10+
# Get things in the same directory on windows.
11+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}../")
12+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}../")
13+
1014
add_executable(gtest_${LIBNAME}
1115
${tests})
1216
target_link_libraries(gtest_${LIBNAME} launchdarkly::client GTest::gtest_main)

libs/common/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ set(OPENSSL_ROOT_DIR "/opt/homebrew/opt/[email protected]")
2929
find_package(OpenSSL REQUIRED)
3030
message(STATUS "LaunchDarkly: using OpenSSL v${OPENSSL_VERSION}")
3131

32-
set(Boost_USE_STATIC_LIBS OFF)
32+
set(Boost_USE_STATIC_LIBS ON)
3333
set(Boost_USE_MULTITHREADED ON)
3434
set(Boost_USE_STATIC_RUNTIME OFF)
3535
find_package(Boost 1.80 REQUIRED COMPONENTS json url)

libs/common/include/network/detail/http_requester.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
#include "config/detail/built/http_properties.hpp"
1313

14+
#ifdef _MSC_VER
15+
// MSVC doesn't support strcasecmp.
16+
#define strcasecmp _stricmp
17+
#endif
18+
1419
namespace launchdarkly::network::detail {
1520

1621
struct CaseInsensitiveComparator {
@@ -150,3 +155,7 @@ std::optional<std::string> AppendUrl(std::optional<std::string> url_in,
150155
std::string const& to_append);
151156

152157
} // namespace launchdarkly::network::detail
158+
159+
#ifdef _MSC_VER
160+
#undef strcasecmp _stricmp
161+
#endif

libs/common/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ add_library(launchdarkly::common ALIAS ${LIBNAME})
6060

6161
target_link_libraries(${LIBNAME}
6262
PUBLIC Boost::headers tl::expected OpenSSL::SSL foxy
63-
PRIVATE Boost::url Boost::json)
63+
PRIVATE Boost::url Boost::json Boost::disable_autolinking)
6464

6565
# Need the public headers to build.
6666
target_include_directories(${LIBNAME} PUBLIC ../include)

libs/common/tests/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ file(GLOB tests "${PROJECT_SOURCE_DIR}/tests/*.cpp")
88

99
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
1010

11+
# Get things in the same directory on windows.
12+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}../")
13+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}../")
14+
1115
add_executable(gtest_${LIBNAME}
1216
${tests})
1317
target_link_libraries(gtest_${LIBNAME} launchdarkly::common GTest::gtest_main)

libs/common/tests/application_tags_test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11

22
#include <gtest/gtest.h>
3+
34
#include <ostream>
45
#include <tuple>
6+
#include <algorithm>
7+
58
#include "config/detail/builders/app_info_builder.hpp"
69
#include "error.hpp"
710
#include "null_logger.hpp"

libs/server-sent-events/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ endif ()
2727
# Needed to fetch external dependencies.
2828
include(FetchContent)
2929

30-
31-
set(OPENSSL_USE_STATIC_LIBS OFF)
30+
set(OPENSSL_USE_STATIC_LIBS ON)
3231
find_package(OpenSSL REQUIRED)
3332
message(STATUS "LaunchDarkly: using OpenSSL v${OPENSSL_VERSION}")
3433

libs/server-sent-events/src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ add_library(${LIBNAME}
1111
backoff.cpp)
1212
target_link_libraries(${LIBNAME}
1313
PUBLIC OpenSSL::SSL Boost::headers
14-
PRIVATE Boost::url foxy)
14+
PRIVATE Boost::url Boost::disable_autolinking foxy
15+
)
1516

1617
add_library(launchdarkly::sse ALIAS ${LIBNAME})
1718

libs/server-sent-events/tests/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ file(GLOB tests "${PROJECT_SOURCE_DIR}/tests/*.cpp")
77

88
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
99

10+
# Get things in the same directory on windows.
11+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}../")
12+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}../")
13+
1014
add_executable(gtest_${LIBNAME}
1115
${tests})
1216
target_link_libraries(gtest_${LIBNAME} launchdarkly::sse GTest::gtest_main)

0 commit comments

Comments
 (0)