-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into rlamb/common-persistent-store
- Loading branch information
Showing
89 changed files
with
1,084 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
BasedOnStyle: Chromium | ||
IndentWidth: 4 | ||
QualifierAlignment: Right | ||
NamespaceIndentation: None | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,11 +92,25 @@ runs: | |
if: runner.os == 'Windows' | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- name: Upgrade OpenSSL | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
run: | | ||
choco upgrade openssl --no-progress | ||
- name: Determine OpenSSL Installation Directory | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
run: | | ||
if [ -d "C:\Program Files\OpenSSL-Win64" ]; then | ||
echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64" >> "$GITHUB_ENV" | ||
else | ||
echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL" >> "$GITHUB_ENV" | ||
fi | ||
- name: Build Windows Artifacts | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
env: | ||
OPENSSL_ROOT_DIR: 'C:\Program Files\OpenSSL' | ||
OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }} | ||
BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' | ||
BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' | ||
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} | ||
|
@@ -155,9 +169,8 @@ runs: | |
if: runner.os == 'macOS' | ||
shell: bash | ||
run: | | ||
brew link --overwrite [email protected] | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix [email protected])" >> "$GITHUB_ENV" | ||
export OPENSSL_ROOT_DIR=$(brew --prefix [email protected]) | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV" | ||
export OPENSSL_ROOT_DIR=$(brew --prefix openssl@3) | ||
./scripts/build-release.sh ${{ inputs.sdk_cmake_target }} | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
paths-ignore: | ||
- '**.md' #Do not need to run CI for markdown changes. | ||
pull_request: | ||
branches: [ main, server-side ] | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
|
@@ -16,21 +16,20 @@ jobs: | |
env: | ||
# Port the test service (implemented in this repo) should bind to. | ||
TEST_SERVICE_PORT: 8123 | ||
TEST_SERVICE_BINARY: ./build/contract-tests/client-contract-tests/client-tests | ||
TEST_SERVICE_BINARY: ./build/contract-tests/sdk-contract-tests/sdk-tests | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/ci | ||
with: | ||
cmake_target: client-tests | ||
cmake_target: sdk-tests | ||
run_tests: false | ||
- name: 'Launch test service as background task' | ||
run: $TEST_SERVICE_BINARY $TEST_SERVICE_PORT 2>&1 & | ||
- uses: ./.github/actions/contract-tests | ||
with: | ||
# Inform the test harness of test service's port. | ||
test_service_port: ${{ env.TEST_SERVICE_PORT }} | ||
extra_params: '-skip-from ./contract-tests/client-contract-tests/test-suppressions.txt' | ||
build-test-client: | ||
build-test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -41,10 +40,9 @@ jobs: | |
runs-on: macos-12 | ||
steps: | ||
- run: | | ||
brew link --overwrite [email protected] | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix [email protected])" >> "$GITHUB_ENV" | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV" | ||
# For debugging | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@1.1)" | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/ci | ||
env: | ||
|
@@ -55,11 +53,23 @@ jobs: | |
build-test-client-windows: | ||
runs-on: windows-2022 | ||
steps: | ||
- name: Upgrade OpenSSL | ||
shell: bash | ||
run: | | ||
choco upgrade openssl --no-progress | ||
- name: Determine OpenSSL Installation Directory | ||
shell: bash | ||
run: | | ||
if [ -d "C:\Program Files\OpenSSL-Win64" ]; then | ||
echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64" >> "$GITHUB_ENV" | ||
else | ||
echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL" >> "$GITHUB_ENV" | ||
fi | ||
- uses: actions/checkout@v3 | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
- uses: ./.github/actions/ci | ||
env: | ||
OPENSSL_ROOT_DIR: 'C:\Program Files\OpenSSL' | ||
OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }} | ||
BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' | ||
BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Checks out the tag, builds release builds, and attaches them to the release for the tag. | ||
# If you need to change build scripts, then update the tag to include the modifications. | ||
# NOTE: This workflow uses sdk-release/action.yml @ the tag specified in the workflow_dispatch input. | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
|
@@ -13,6 +14,7 @@ on: | |
type: choice | ||
options: | ||
- libs/client-sdk:launchdarkly-cpp-client | ||
- libs/server-sdk:launchdarkly-cpp-server | ||
|
||
name: Publish SDK Artifacts | ||
|
||
|
@@ -55,18 +57,18 @@ jobs: | |
sdk_path: ${{ needs.split-input.outputs.sdk_path}} | ||
sdk_cmake_target: ${{ needs.split-input.outputs.sdk_cmake_target}} | ||
release-sdk-provenance: | ||
needs: ['release-sdk'] | ||
needs: [ 'release-sdk' ] | ||
strategy: | ||
matrix: | ||
# Generates a combined attestation for each platform | ||
os: [ linux, windows, macos ] | ||
permissions: | ||
permissions: | ||
actions: read | ||
id-token: write | ||
contents: write | ||
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | ||
with: | ||
base64-subjects: "${{ needs.release-sdk.outputs[format('hashes-{0}', matrix.os)] }}" | ||
upload-assets: true | ||
upload-assets: true | ||
upload-tag-name: ${{ inputs.tag }} | ||
provenance-name: ${{ format('{0}-multiple-provenance.intoto.jsonl', matrix.os) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,10 +41,9 @@ jobs: | |
runs-on: macos-12 | ||
steps: | ||
- run: | | ||
brew link --overwrite [email protected] | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix [email protected])" >> "$GITHUB_ENV" | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV" | ||
# For debugging | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@1.1)" | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/ci | ||
env: | ||
|
@@ -55,14 +54,26 @@ jobs: | |
build-test-server-windows: | ||
runs-on: windows-2022 | ||
steps: | ||
- name: Upgrade OpenSSL | ||
shell: bash | ||
run: | | ||
choco upgrade openssl --no-progress | ||
- name: Determine OpenSSL Installation Directory | ||
shell: bash | ||
run: | | ||
if [ -d "C:\Program Files\OpenSSL-Win64" ]; then | ||
echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64" >> "$GITHUB_ENV" | ||
else | ||
echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL" >> "$GITHUB_ENV" | ||
fi | ||
- uses: actions/checkout@v3 | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
- uses: ./.github/actions/ci | ||
env: | ||
OPENSSL_ROOT_DIR: 'C:\Program Files\OpenSSL' | ||
OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }} | ||
BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' | ||
BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' | ||
with: | ||
cmake_target: launchdarkly-cpp-server | ||
cmake_target: launchdarkly-cpp-client | ||
platform_version: 2022 | ||
toolset: msvc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"libs/client-sdk": "3.0.8", | ||
"libs/server-sent-events": "0.1.3", | ||
"libs/common": "0.3.6", | ||
"libs/internal": "0.1.9" | ||
"libs/client-sdk": "3.2.1", | ||
"libs/server-sdk": "0.1.0", | ||
"libs/server-sent-events": "0.2.0", | ||
"libs/common": "0.5.0", | ||
"libs/internal": "0.3.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
# Required for Apple Silicon support. | ||
cmake_minimum_required(VERSION 3.19) | ||
include(CMakeDependentOption) | ||
|
||
project( | ||
LaunchDarklyCPPSDKs | ||
|
@@ -13,22 +14,62 @@ project( | |
|
||
include(GNUInstallDirs) | ||
|
||
option(BUILD_TESTING "Top-level switch for testing. Turn off to disable unit and contract tests." ON) | ||
|
||
option(LD_BUILD_SHARED_LIBS "Build the SDKs as shared libraries" OFF) | ||
|
||
cmake_dependent_option(LD_BUILD_UNIT_TESTS | ||
"Build the C++ unit tests." | ||
ON # default to enabling unit tests | ||
"BUILD_TESTING;NOT LD_BUILD_SHARED_LIBS" # only exposed if top-level switch is on, and also only when building | ||
# static libs. This is because we have hidden visibility of symbols by default (to only expose our C API.) | ||
OFF # otherwise, off | ||
) | ||
|
||
# If you want to run the unit tests with valgrind, then LD_TESTING_SANITIZERS must of OFF. | ||
cmake_dependent_option(LD_TESTING_SANITIZERS | ||
"Enable sanitizers for unit tests." | ||
ON # default to enabling sanitizers | ||
"LD_BUILD_UNIT_TESTS" # only expose if unit tests enabled.. | ||
OFF # otherwise, off | ||
) | ||
|
||
cmake_dependent_option(LD_BUILD_CONTRACT_TESTS | ||
"Build contract test service." | ||
OFF # default to disabling contract tests, since they require running a service | ||
"BUILD_TESTING;NOT LD_BUILD_SHARED_LIBS" # only expose if top-level switch is on and using static libs, since C++ symbols needed would be hidden. | ||
OFF # otherwise, off | ||
) | ||
|
||
# The general strategy is to produce a fat artifact containing all of our dependencies so users | ||
# only have a single thing to link. We should support this either being a static or shared library. | ||
# Because OpenSSL is a large, and security relevant dependency, we should have a separate option | ||
# to link against that statically or dynamically. | ||
|
||
option(LD_DYNAMIC_LINK_OPENSSL | ||
"Dynamically link OpenSSL instead of building with static library" | ||
OFF # default to linking OpenSSL statically | ||
) | ||
|
||
option(LD_BUILD_EXAMPLES "Build hello-world examples." ON) | ||
|
||
# If using 'make' as the build system, CMake causes the 'install' target to have a dependency on 'all', meaning | ||
# it will cause a full build. This disables that, allowing us to build piecemeal instead. This is useful | ||
# so that we only need to build the client or server for a given release (if only the client or server were affected.) | ||
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true) | ||
|
||
# All projects in this repo should share the same version of 3rd party depends. | ||
# It's the only way to remain sane. | ||
set(CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
|
||
option(BUILD_TESTING "Enable C++ unit tests." ON) | ||
|
||
# If you want to run the unit tests with valgrind, then TESTING_SANITIZERS must of OFF. | ||
option(TESTING_SANITIZERS "Enable sanitizers for unit tests." ON) | ||
|
||
if (BUILD_TESTING) | ||
if (LD_BUILD_UNIT_TESTS) | ||
message(STATUS "LaunchDarkly: building unit tests") | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") | ||
add_compile_definitions(LAUNCHDARKLY_USE_ASSERT) | ||
if (TESTING_SANITIZERS) | ||
if (LD_TESTING_SANITIZERS) | ||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak") | ||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") | ||
|
@@ -53,14 +94,22 @@ if (BUILD_TESTING) | |
enable_testing() | ||
endif () | ||
|
||
set(OPENSSL_USE_STATIC_LIBS ON) | ||
set(OPENSSL_ROOT_DIR "/opt/homebrew/opt/[email protected]") | ||
if (LD_DYNAMIC_LINK_OPENSSL) | ||
message(STATUS "LaunchDarkly: searching for shared OpenSSL library") | ||
set(OPENSSL_USE_STATIC_LIBS OFF) | ||
else () | ||
message(STATUS "LaunchDarkly: searching for static OpenSSL library") | ||
set(OPENSSL_USE_STATIC_LIBS ON) | ||
endif () | ||
|
||
find_package(OpenSSL REQUIRED) | ||
message(STATUS "LaunchDarkly: using OpenSSL v${OPENSSL_VERSION}") | ||
|
||
# Even though the main SDK might be a static or shared lib, boost should always statically | ||
# linked into the binary. | ||
set(Boost_USE_STATIC_LIBS ON) | ||
|
||
if (BUILD_SHARED_LIBS) | ||
if (LD_BUILD_SHARED_LIBS) | ||
# When building a shared library we hide all symbols | ||
# aside from this we have specifically exported for the C-API. | ||
set(CMAKE_CXX_VISIBILITY_PRESET hidden) | ||
|
@@ -72,26 +121,25 @@ set(Boost_USE_STATIC_RUNTIME OFF) | |
find_package(Boost 1.81 REQUIRED COMPONENTS json url coroutine) | ||
message(STATUS "LaunchDarkly: using Boost v${Boost_VERSION}") | ||
|
||
add_subdirectory(libs/client-sdk) | ||
add_subdirectory(libs/server-sdk) | ||
|
||
set(ORIGINAL_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}") | ||
set(BUILD_SHARED_LIBS OFF) | ||
include(${CMAKE_FILES}/certify.cmake) | ||
add_subdirectory(vendor/foxy) | ||
|
||
# Always build the common libraries as static libs. | ||
# Common, internal, and server-sent-events are built as "object" libraries. | ||
add_subdirectory(libs/common) | ||
add_subdirectory(libs/internal) | ||
add_subdirectory(libs/server-sent-events) | ||
|
||
set(ORIGINAL_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}") | ||
|
||
set(BUILD_TESTING OFF) | ||
include(${CMAKE_FILES}/certify.cmake) | ||
add_subdirectory(vendor/foxy) | ||
|
||
set(BUILD_TESTING "${ORIGINAL_BUILD_TESTING}") | ||
# Built as static or shared depending on LD_BUILD_SHARED_LIBS variable. | ||
# This target "links" in common, internal, and sse as object libraries. | ||
add_subdirectory(libs/client-sdk) | ||
add_subdirectory(libs/server-sdk) | ||
|
||
set(BUILD_SHARED_LIBS "${ORIGINAL_BUILD_SHARED_LIBS}") | ||
if (LD_BUILD_CONTRACT_TESTS) | ||
message(STATUS "LaunchDarkly: building contract tests") | ||
add_subdirectory(contract-tests) | ||
endif () | ||
|
||
add_subdirectory(contract-tests) | ||
add_subdirectory(examples) | ||
if (LD_BUILD_EXAMPLES) | ||
message(STATUS "LaunchDarkly: building examples") | ||
add_subdirectory(examples) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Repository Maintainers | ||
* @launchdarkly/team-sdk | ||
* @launchdarkly/team-sdk-c |
Oops, something went wrong.