v2.0.0 release #230
This file contains hidden or 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
| name: Test SDK | |
| on: | |
| pull_request: | |
| paths: | |
| - '**/*' | |
| workflow_dispatch: | |
| workflow_call: | |
| inputs: | |
| test_data_branch: | |
| type: string | |
| description: The branch in sdk-test-data to target for testcase files | |
| required: false | |
| default: main | |
| sdk_branch: | |
| type: string | |
| description: The branch of the SDK to test | |
| required: false | |
| env: | |
| SDK_BRANCH_NAME: ${{ inputs.sdk_branch || github.head_ref || github.ref_name || 'main' }} | |
| TEST_DATA_BRANCH_NAME: ${{ inputs.test_data_branch || 'main' }} | |
| jobs: | |
| format-check: | |
| runs-on: ubuntu-latest | |
| name: Check code formatting | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name || 'Eppo-exp/cpp-sdk' }} | |
| ref: ${{ env.SDK_BRANCH_NAME }} | |
| - name: Install clang-format | |
| run: | | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 18 | |
| sudo apt-get install -y clang-format-18 | |
| sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-18 100 | |
| - name: Check formatting | |
| run: make format-check | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: | |
| - name: g++ | |
| package: g++ | |
| cxx: g++ | |
| cc: gcc | |
| - name: clang++ | |
| package: clang | |
| cxx: clang++ | |
| cc: clang | |
| name: Build with ${{ matrix.compiler.name }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name || 'Eppo-exp/cpp-sdk' }} | |
| ref: ${{ env.SDK_BRANCH_NAME }} | |
| - name: Set up build environment | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake pkg-config ${{ matrix.compiler.package }} libre2-dev | |
| - name: Build library | |
| run: | | |
| cmake -B build -DCMAKE_BUILD_TYPE=Release -DEPPOCLIENT_WARNINGS_AS_ERRORS=ON -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} -DCMAKE_C_COMPILER=${{ matrix.compiler.cc }} | |
| cmake --build build | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| name: Test on ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name || 'Eppo-exp/cpp-sdk' }} | |
| ref: ${{ env.SDK_BRANCH_NAME }} | |
| - name: Set up build environment (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential g++ cmake pkg-config libre2-dev | |
| - name: Set up build environment (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install re2 | |
| brew install cmake | |
| - name: Set up MSVC (Windows) | |
| if: runner.os == 'Windows' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Install re2 via vcpkg (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| # Use the standalone C:/vcpkg (bash on Windows accepts forward slashes) | |
| /c/vcpkg/vcpkg install re2:x64-windows | |
| echo "CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Run tests | |
| shell: bash | |
| run: | | |
| echo "CMAKE_TOOLCHAIN_FILE is: $CMAKE_TOOLCHAIN_FILE" | |
| make test TEST_DATA_BRANCH=${{env.TEST_DATA_BRANCH_NAME}} | |
| memory-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name || 'Eppo-exp/cpp-sdk' }} | |
| ref: ${{ env.SDK_BRANCH_NAME }} | |
| - name: Set up build environment | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential g++ cmake pkg-config libre2-dev | |
| - name: Run memory tests | |
| run: make test-memory TEST_DATA_BRANCH=${{env.TEST_DATA_BRANCH_NAME}} |