Skip to content

Commit 185d668

Browse files
committed
Build tests and contract tests with and without CURL.
1 parent f7a2490 commit 185d668

5 files changed

Lines changed: 190 additions & 7 deletions

File tree

.github/actions/ci/action.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ inputs:
2929
description: 'Whether to run ./build-release-windows.sh for the CMake target'
3030
required: false
3131
default: 'false'
32+
use_curl:
33+
description: 'Whether to enable CURL networking (LD_CURL_NETWORKING=ON)'
34+
required: false
35+
default: 'false'
3236

3337
runs:
3438
using: composite
@@ -44,22 +48,30 @@ runs:
4448
- name: Install OpenSSL
4549
uses: ./.github/actions/install-openssl
4650
id: install-openssl
51+
- name: Install CURL
52+
if: inputs.use_curl == 'true'
53+
uses: ./.github/actions/install-curl
54+
id: install-curl
4755
- name: Build Library
4856
shell: bash
49-
run: ./scripts/build.sh ${{ inputs.cmake_target }} ON
57+
run: ./scripts/build.sh ${{ inputs.cmake_target }} ON ${{ inputs.use_curl }}
5058
env:
5159
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
5260
Boost_DIR: ${{ steps.install-boost.outputs.Boost_DIR }}
5361
OPENSSL_ROOT_DIR: ${{ steps.install-openssl.outputs.OPENSSL_ROOT_DIR }}
62+
CURL_ROOT: ${{ steps.install-curl.outputs.CURL_ROOT }}
63+
CMAKE_PREFIX_PATH: ${{ steps.install-curl.outputs.CURL_ROOT }}
5464
- name: Build Tests
5565
id: build-tests
5666
if: inputs.run_tests == 'true'
5767
shell: bash
58-
run: ./scripts/build.sh gtest_${{ inputs.cmake_target }} ON
68+
run: ./scripts/build.sh gtest_${{ inputs.cmake_target }} ON ${{ inputs.use_curl }}
5969
env:
6070
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
6171
Boost_DIR: ${{ steps.install-boost.outputs.Boost_DIR }}
6272
OPENSSL_ROOT_DIR: ${{ steps.install-openssl.outputs.OPENSSL_ROOT_DIR }}
73+
CURL_ROOT: ${{ steps.install-curl.outputs.CURL_ROOT }}
74+
CMAKE_PREFIX_PATH: ${{ steps.install-curl.outputs.CURL_ROOT }}
6375
- name: Run Tests
6476
if: steps.build-tests.outcome == 'success'
6577
shell: bash
@@ -70,16 +82,30 @@ runs:
7082
- name: Simulate Release (Linux/MacOS)
7183
if: inputs.simulate_release == 'true'
7284
shell: bash
73-
run: ./scripts/build-release.sh ${{ inputs.cmake_target }}
85+
run: |
86+
if [ "${{ inputs.use_curl }}" == "true" ]; then
87+
./scripts/build-release.sh ${{ inputs.cmake_target }} --with-curl
88+
else
89+
./scripts/build-release.sh ${{ inputs.cmake_target }}
90+
fi
7491
env:
7592
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
7693
OPENSSL_ROOT_DIR: ${{ steps.install-openssl.outputs.OPENSSL_ROOT_DIR }}
94+
CURL_ROOT: ${{ steps.install-curl.outputs.CURL_ROOT }}
95+
CMAKE_PREFIX_PATH: ${{ steps.install-curl.outputs.CURL_ROOT }}
7796

7897
- name: Simulate Release (Windows)
7998
if: inputs.simulate_windows_release == 'true'
8099
shell: bash
81-
run: ./scripts/build-release-windows.sh ${{ inputs.cmake_target }}
100+
run: |
101+
if [ "${{ inputs.use_curl }}" == "true" ]; then
102+
./scripts/build-release-windows.sh ${{ inputs.cmake_target }} --with-curl
103+
else
104+
./scripts/build-release-windows.sh ${{ inputs.cmake_target }}
105+
fi
82106
env:
83107
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
84108
OPENSSL_ROOT_DIR: ${{ steps.install-openssl.outputs.OPENSSL_ROOT_DIR }}
85109
Boost_DIR: 'C:\local\boost_1_87_0\lib64-msvc-14.3\cmake\Boost-1.87.0'
110+
CURL_ROOT: ${{ steps.install-curl.outputs.CURL_ROOT }}
111+
CMAKE_PREFIX_PATH: ${{ steps.install-curl.outputs.CURL_ROOT }}

.github/workflows/client.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,26 @@ on:
1515

1616
jobs:
1717
contract-tests:
18+
runs-on: ubuntu-22.04
19+
env:
20+
# Port the test service (implemented in this repo) should bind to.
21+
TEST_SERVICE_PORT: 8123
22+
TEST_SERVICE_BINARY: ./build/contract-tests/client-contract-tests/client-tests
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: ./.github/actions/ci
26+
with:
27+
cmake_target: client-tests
28+
run_tests: false
29+
- name: 'Launch test service as background task'
30+
run: $TEST_SERVICE_BINARY $TEST_SERVICE_PORT 2>&1 &
31+
- uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.1.0
32+
with:
33+
# Inform the test harness of test service's port.
34+
test_service_port: ${{ env.TEST_SERVICE_PORT }}
35+
token: ${{ secrets.GITHUB_TOKEN }}
1836

37+
contract-tests-curl:
1938
runs-on: ubuntu-22.04
2039
env:
2140
# Port the test service (implemented in this repo) should bind to.
@@ -27,6 +46,7 @@ jobs:
2746
with:
2847
cmake_target: client-tests
2948
run_tests: false
49+
use_curl: true
3050
- name: 'Launch test service as background task'
3151
run: $TEST_SERVICE_BINARY $TEST_SERVICE_PORT 2>&1 &
3252
- uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.1.0
@@ -42,6 +62,17 @@ jobs:
4262
with:
4363
cmake_target: launchdarkly-cpp-client
4464
simulate_release: true
65+
66+
build-test-curl:
67+
runs-on: ubuntu-22.04
68+
steps:
69+
- uses: actions/checkout@v4
70+
- uses: ./.github/actions/ci
71+
with:
72+
cmake_target: launchdarkly-cpp-client
73+
use_curl: true
74+
simulate_release: true
75+
4576
build-test-client-mac:
4677
runs-on: macos-13
4778
steps:
@@ -51,6 +82,18 @@ jobs:
5182
cmake_target: launchdarkly-cpp-client
5283
platform_version: 12
5384
simulate_release: true
85+
86+
build-test-client-mac-curl:
87+
runs-on: macos-13
88+
steps:
89+
- uses: actions/checkout@v4
90+
- uses: ./.github/actions/ci
91+
with:
92+
cmake_target: launchdarkly-cpp-client
93+
platform_version: 12
94+
use_curl: true
95+
simulate_release: true
96+
5497
build-test-client-windows:
5598
runs-on: windows-2022
5699
steps:
@@ -66,3 +109,20 @@ jobs:
66109
platform_version: 2022
67110
toolset: msvc
68111
simulate_windows_release: true
112+
113+
build-test-client-windows-curl:
114+
runs-on: windows-2022
115+
steps:
116+
- uses: actions/checkout@v4
117+
- uses: ilammy/msvc-dev-cmd@v1
118+
- uses: ./.github/actions/ci
119+
env:
120+
BOOST_LIBRARY_DIR: 'C:\local\boost_1_87_0\lib64-msvc-14.3'
121+
BOOST_LIBRARYDIR: 'C:\local\boost_1_87_0\lib64-msvc-14.3'
122+
Boost_DIR: 'C:\local\boost_1_87_0\lib64-msvc-14.3\cmake\Boost-1.87.0'
123+
with:
124+
cmake_target: launchdarkly-cpp-client
125+
platform_version: 2022
126+
toolset: msvc
127+
use_curl: true
128+
simulate_windows_release: true

.github/workflows/server.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,29 @@ jobs:
3434
test_service_port: ${{ env.TEST_SERVICE_PORT }}
3535
extra_params: '-skip-from ./contract-tests/server-contract-tests/test-suppressions.txt'
3636
token: ${{ secrets.GITHUB_TOKEN }}
37+
38+
contract-tests-curl:
39+
runs-on: ubuntu-22.04
40+
env:
41+
# Port the test service (implemented in this repo) should bind to.
42+
TEST_SERVICE_PORT: 8123
43+
TEST_SERVICE_BINARY: ./build/contract-tests/server-contract-tests/server-tests
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: ./.github/actions/ci
47+
with:
48+
cmake_target: server-tests
49+
run_tests: false
50+
use_curl: true
51+
- name: 'Launch test service as background task'
52+
run: $TEST_SERVICE_BINARY $TEST_SERVICE_PORT 2>&1 &
53+
- uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.1.0
54+
with:
55+
# Inform the test harness of test service's port.
56+
test_service_port: ${{ env.TEST_SERVICE_PORT }}
57+
extra_params: '-skip-from ./contract-tests/server-contract-tests/test-suppressions.txt'
58+
token: ${{ secrets.GITHUB_TOKEN }}
59+
3760
build-test-server:
3861
runs-on: ubuntu-22.04
3962
steps:
@@ -42,6 +65,17 @@ jobs:
4265
with:
4366
cmake_target: launchdarkly-cpp-server
4467
simulate_release: true
68+
69+
build-test-server-curl:
70+
runs-on: ubuntu-22.04
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: ./.github/actions/ci
74+
with:
75+
cmake_target: launchdarkly-cpp-server
76+
use_curl: true
77+
simulate_release: true
78+
4579
build-test-server-mac:
4680
runs-on: macos-13
4781
steps:
@@ -51,6 +85,18 @@ jobs:
5185
cmake_target: launchdarkly-cpp-server
5286
platform_version: 12
5387
simulate_release: true
88+
89+
build-test-server-mac-curl:
90+
runs-on: macos-13
91+
steps:
92+
- uses: actions/checkout@v4
93+
- uses: ./.github/actions/ci
94+
with:
95+
cmake_target: launchdarkly-cpp-server
96+
platform_version: 12
97+
use_curl: true
98+
simulate_release: true
99+
54100
build-test-server-windows:
55101
runs-on: windows-2022
56102
steps:
@@ -62,3 +108,16 @@ jobs:
62108
platform_version: 2022
63109
toolset: msvc
64110
simulate_windows_release: true
111+
112+
build-test-server-windows-curl:
113+
runs-on: windows-2022
114+
steps:
115+
- uses: actions/checkout@v4
116+
- uses: ilammy/msvc-dev-cmd@v1
117+
- uses: ./.github/actions/ci
118+
with:
119+
cmake_target: launchdarkly-cpp-server
120+
platform_version: 2022
121+
toolset: msvc
122+
use_curl: true
123+
simulate_windows_release: true

.github/workflows/sse.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ jobs:
1818
- uses: ./.github/actions/ci
1919
with:
2020
cmake_target: launchdarkly-sse-client
21+
22+
build-test-sse-curl:
23+
runs-on: ubuntu-22.04
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: ./.github/actions/ci
27+
with:
28+
cmake_target: launchdarkly-sse-client
29+
use_curl: true
30+
2131
contract-tests:
2232
runs-on: ubuntu-22.04
2333
env:
@@ -38,3 +48,25 @@ jobs:
3848
branch: 'main'
3949
test_service_port: ${{ env.TEST_SERVICE_PORT }}
4050
token: ${{ secrets.GITHUB_TOKEN }}
51+
52+
contract-tests-curl:
53+
runs-on: ubuntu-22.04
54+
env:
55+
# Port the test service (implemented in this repo) should bind to.
56+
TEST_SERVICE_PORT: 8123
57+
TEST_SERVICE_BINARY: ./build/contract-tests/sse-contract-tests/sse-tests
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: ./.github/actions/ci
61+
with:
62+
cmake_target: sse-tests
63+
run_tests: false
64+
use_curl: true
65+
- name: 'Launch test service as background task'
66+
run: $TEST_SERVICE_BINARY $TEST_SERVICE_PORT 2>&1 &
67+
- uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.1.0
68+
with:
69+
repo: 'sse-contract-tests'
70+
branch: 'main'
71+
test_service_port: ${{ env.TEST_SERVICE_PORT }}
72+
token: ${{ secrets.GITHUB_TOKEN }}

scripts/build.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
# This script builds a specific cmake target.
44
# This script should be ran from the root directory of the project.
5-
# ./scripts/build.sh my-build-target ON
5+
# ./scripts/build.sh my-build-target ON [true|false]
66
#
77
# $1 the name of the target. For example "launchdarkly-cpp-common".
88
# $2 ON/OFF which enables/disables building in a test configuration (unit tests + contract tests.)
9+
# $3 (optional) true/false to enable/disable CURL networking (LD_CURL_NETWORKING)
910

1011
function cleanup {
1112
cd ..
@@ -24,12 +25,17 @@ if [ "$1" == "launchdarkly-cpp-server-redis-source" ] || [ "$1" == "gtest_launch
2425
build_redis="ON"
2526
fi
2627

27-
28+
# Check for CURL networking option
29+
build_curl="OFF"
30+
if [ "$3" == "true" ]; then
31+
build_curl="ON"
32+
fi
2833

2934
cmake -G Ninja -D CMAKE_COMPILE_WARNING_AS_ERROR=TRUE \
3035
-D BUILD_TESTING="$2" \
3136
-D LD_BUILD_UNIT_TESTS="$2" \
3237
-D LD_BUILD_CONTRACT_TESTS="$2" \
33-
-D LD_BUILD_REDIS_SUPPORT="$build_redis" ..
38+
-D LD_BUILD_REDIS_SUPPORT="$build_redis" \
39+
-D LD_CURL_NETWORKING="$build_curl" ..
3440

3541
cmake --build . --target "$1"

0 commit comments

Comments
 (0)