|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: ${{ matrix.os }} / ${{ matrix.build_type }} |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + os: [ubuntu-latest, windows-latest] |
| 17 | + build_type: [Debug, Release] |
| 18 | + |
| 19 | + env: |
| 20 | + VCPKG_DIR: ${{ github.workspace }}/vcpkg |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Cache vcpkg |
| 26 | + uses: actions/cache@v4 |
| 27 | + with: |
| 28 | + path: ${{ github.workspace }}/vcpkg |
| 29 | + key: vcpkg-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }} |
| 30 | + restore-keys: vcpkg-${{ runner.os }}- |
| 31 | + |
| 32 | + - name: Bootstrap vcpkg (Linux) |
| 33 | + if: runner.os == 'Linux' |
| 34 | + run: | |
| 35 | + if [ ! -f "${{ env.VCPKG_DIR }}/vcpkg" ]; then |
| 36 | + git clone https://github.com/microsoft/vcpkg.git "${{ env.VCPKG_DIR }}" |
| 37 | + "${{ env.VCPKG_DIR }}/bootstrap-vcpkg.sh" -disableMetrics |
| 38 | + fi |
| 39 | + "${{ env.VCPKG_DIR }}/vcpkg" install nlohmann-json openssl jwt-cpp |
| 40 | +
|
| 41 | + - name: Bootstrap vcpkg (Windows) |
| 42 | + if: runner.os == 'Windows' |
| 43 | + shell: pwsh |
| 44 | + run: | |
| 45 | + $vcpkgDir = "${{ env.VCPKG_DIR }}" |
| 46 | + if (-not (Test-Path "$vcpkgDir\vcpkg.exe")) { |
| 47 | + git clone https://github.com/microsoft/vcpkg.git $vcpkgDir |
| 48 | + & "$vcpkgDir\bootstrap-vcpkg.bat" -disableMetrics |
| 49 | + } |
| 50 | + & "$vcpkgDir\vcpkg.exe" install nlohmann-json:x64-windows openssl:x64-windows jwt-cpp:x64-windows |
| 51 | +
|
| 52 | + - name: Configure (Linux) |
| 53 | + if: runner.os == 'Linux' |
| 54 | + run: | |
| 55 | + cmake -S . -B build \ |
| 56 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 57 | + -DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_DIR }}/scripts/buildsystems/vcpkg.cmake" \ |
| 58 | + -DBUILD_COINBASE_ADVANCED_TESTS=ON \ |
| 59 | + -DBUILD_COINBASE_ADVANCED_EXAMPLES=OFF |
| 60 | +
|
| 61 | + - name: Configure (Windows) |
| 62 | + if: runner.os == 'Windows' |
| 63 | + shell: pwsh |
| 64 | + run: | |
| 65 | + cmake -S . -B build ` |
| 66 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` |
| 67 | + "-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_DIR }}\scripts\buildsystems\vcpkg.cmake" ` |
| 68 | + -DVCPKG_TARGET_TRIPLET=x64-windows ` |
| 69 | + -DBUILD_COINBASE_ADVANCED_TESTS=ON ` |
| 70 | + -DBUILD_COINBASE_ADVANCED_EXAMPLES=OFF |
| 71 | +
|
| 72 | + - name: Build |
| 73 | + run: cmake --build build --config ${{ matrix.build_type }} -j 4 |
| 74 | + |
| 75 | + - name: Test |
| 76 | + run: ctest --test-dir build -C ${{ matrix.build_type }} -E "(Order|Fill)" --output-on-failure |
0 commit comments