|
| 1 | +name: Samples cpp httplib server |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "samples/server/petstore/cpp-httplib-server/**" |
| 7 | + pull_request: |
| 8 | + paths: |
| 9 | + - "samples/server/petstore/cpp-httplib-server/**" |
| 10 | + |
| 11 | +env: |
| 12 | + GRADLE_VERSION: 6.9 |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + name: Build cpp httplib server |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + sample: |
| 20 | + - samples/server/petstore/cpp-httplib-server |
| 21 | + os: |
| 22 | + - ubuntu-latest |
| 23 | + - macOS-latest |
| 24 | + - windows-latest |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - name: Install dependencies (Linux) |
| 29 | + if: matrix.os == 'ubuntu-latest' |
| 30 | + run: | |
| 31 | + sudo apt-get update |
| 32 | + sudo apt-get install -y nlohmann-json3-dev libssl-dev zlib1g-dev |
| 33 | + # Install httplib from source since it's not in Ubuntu repos |
| 34 | + git clone https://github.com/yhirose/cpp-httplib.git |
| 35 | + cd cpp-httplib |
| 36 | + mkdir build && cd build |
| 37 | + cmake .. -DCMAKE_BUILD_TYPE=Release |
| 38 | + make -j$(nproc) |
| 39 | + sudo make install |
| 40 | + - name: Install dependencies (macOS) |
| 41 | + if: matrix.os == 'macOS-latest' |
| 42 | + run: | |
| 43 | + brew install nlohmann-json openssl zlib |
| 44 | + # Install httplib via Homebrew |
| 45 | + brew install cpp-httplib |
| 46 | + - name: Install vcpkg (Windows) |
| 47 | + if: matrix.os == 'windows-latest' |
| 48 | + run: | |
| 49 | + git clone https://github.com/microsoft/vcpkg.git |
| 50 | + .\vcpkg\bootstrap-vcpkg.bat |
| 51 | + shell: cmd |
| 52 | + - name: Install dependencies (Windows) |
| 53 | + if: matrix.os == 'windows-latest' |
| 54 | + run: | |
| 55 | + .\vcpkg\vcpkg.exe install nlohmann-json:x64-windows openssl:x64-windows cpp-httplib:x64-windows zlib:x64-windows |
| 56 | + shell: cmd |
| 57 | + - name: Build |
| 58 | + working-directory: ${{ matrix.sample }} |
| 59 | + run: cmake -B build && cmake --build build --verbose |
0 commit comments