Update CI configuration and enhance websocket test callbacks with ove… #5
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| name: ${{ matrix.os }} / ${{ matrix.build_type }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| build_type: [Debug, Release] | |
| env: | |
| VCPKG_DIR: ${{ github.workspace }}/vcpkg | |
| VCPKG_BINARY_CACHE: ${{ github.workspace }}/vcpkg-binary-cache | |
| VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg-binary-cache,readwrite" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Cache the vcpkg clone + bootstrap binary separately from package binaries. | |
| # Bump the suffix (v1, v2, ...) to force a fresh vcpkg update. | |
| - name: Cache vcpkg tool | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/vcpkg | |
| key: vcpkg-tool-${{ runner.os }}-v1 | |
| - name: Cache vcpkg binary packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.VCPKG_BINARY_CACHE }} | |
| key: vcpkg-binary-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml', '**/CMakeLists.txt') }} | |
| restore-keys: vcpkg-binary-${{ runner.os }}- | |
| - name: Prepare vcpkg binary cache directory | |
| run: cmake -E make_directory "${{ env.VCPKG_BINARY_CACHE }}" | |
| - name: Bootstrap vcpkg (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| run: | | |
| if [ ! -f "${{ env.VCPKG_DIR }}/vcpkg" ]; then | |
| git clone https://github.com/microsoft/vcpkg.git "${{ env.VCPKG_DIR }}" | |
| "${{ env.VCPKG_DIR }}/bootstrap-vcpkg.sh" -disableMetrics | |
| fi | |
| "${{ env.VCPKG_DIR }}/vcpkg" install nlohmann-json openssl jwt-cpp boost-asio boost-beast boost-context boost-system | |
| - name: Bootstrap vcpkg (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $vcpkgDir = "${{ env.VCPKG_DIR }}" | |
| if (-not (Test-Path "$vcpkgDir\vcpkg.exe")) { | |
| git clone https://github.com/microsoft/vcpkg.git $vcpkgDir | |
| & "$vcpkgDir\bootstrap-vcpkg.bat" -disableMetrics | |
| } | |
| & "$vcpkgDir\vcpkg.exe" install nlohmann-json:x64-windows openssl:x64-windows jwt-cpp:x64-windows boost-asio:x64-windows boost-beast:x64-windows boost-context:x64-windows boost-system:x64-windows | |
| - name: Configure (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| -DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_DIR }}/scripts/buildsystems/vcpkg.cmake" \ | |
| -DBUILD_COINBASE_ADVANCED_TESTS=ON \ | |
| -DBUILD_COINBASE_ADVANCED_EXAMPLES=OFF | |
| - name: Configure (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| cmake -S . -B build ` | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` | |
| "-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_DIR }}\scripts\buildsystems\vcpkg.cmake" ` | |
| -DVCPKG_TARGET_TRIPLET=x64-windows ` | |
| -DBUILD_COINBASE_ADVANCED_TESTS=ON ` | |
| -DBUILD_COINBASE_ADVANCED_EXAMPLES=OFF | |
| - name: Build | |
| run: cmake --build build --config ${{ matrix.build_type }} -j 4 | |
| - name: Test | |
| run: ctest --test-dir build -C ${{ matrix.build_type }} -E "(Order|Fill|Portfolio)" --output-on-failure |