-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Expand file tree
/
Copy pathsamples-cpp-httplib-server.yaml
More file actions
92 lines (90 loc) · 4.09 KB
/
samples-cpp-httplib-server.yaml
File metadata and controls
92 lines (90 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Samples cpp httplib server
# This workflow tests the C++ httplib server code generator across multiple platforms.
# Dependencies installed per OS:
# - nlohmann/json: Auto-fetched via CMake FetchContent
# - cpp-httplib: Auto-fetched via CMake FetchContent
# - OpenSSL: System package (libssl-dev on Linux, openssl on macOS, vcpkg on Windows)
# - ZLIB: System package (zlib1g-dev on Linux, zlib on macOS, vcpkg on Windows)
# - CMake: Build tool (apt on Linux, brew on macOS, pre-installed on Windows)
on:
push:
paths:
- "samples/server/petstore/cpp-httplib-server/**"
- "modules/openapi-generator/src/main/resources/cpp-httplib-server/**"
- "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppHttplibServerCodegen.java"
- "modules/openapi-generator/src/test/java/org/openapitools/codegen/cpphttplibserver/**"
- "modules/openapi-generator/src/test/resources/3_0/cpp-httplib-server/**"
- "bin/configs/cpp-httplib-server*.yaml"
- ".github/workflows/samples-cpp-httplib-server.yaml"
pull_request:
paths:
- "samples/server/petstore/cpp-httplib-server/**"
- "modules/openapi-generator/src/main/resources/cpp-httplib-server/**"
- "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppHttplibServerCodegen.java"
- "modules/openapi-generator/src/test/java/org/openapitools/codegen/cpphttplibserver/**"
- "modules/openapi-generator/src/test/resources/3_0/cpp-httplib-server/**"
- "bin/configs/cpp-httplib-server*.yaml"
- ".github/workflows/samples-cpp-httplib-server.yaml"
jobs:
build:
name: Build cpp httplib server
strategy:
matrix:
sample:
- samples/server/petstore/cpp-httplib-server/petstore
- samples/server/petstore/cpp-httplib-server/feature-test
os:
- ubuntu-latest
- macOS-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build OpenAPI Generator
run: ./mvnw clean package -DskipTests -pl modules/openapi-generator-cli -am
- name: Run unit tests for CppHttplibServerCodegen
run: ./mvnw -pl modules/openapi-generator test -Dtest=CppHttplibServerCodegenTest,CppHttplibServerCodegenModelTest
- name: Generate C++ httplib server samples (petstore + feature-test)
run: |
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar batch bin/configs/cpp-httplib-server-petstore.yaml
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar batch bin/configs/cpp-httplib-server-feature-test.yaml
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev zlib1g-dev cmake
- name: Install dependencies (macOS)
if: matrix.os == 'macOS-latest'
run: |
brew install openssl zlib cmake
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
vcpkg install openssl:x64-windows zlib:x64-windows --recurse
shell: pwsh
timeout-minutes: 10
- name: Set vcpkg toolchain (Windows)
if: matrix.os == 'windows-latest'
run: echo "CMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV
shell: bash
- name: Build generated C++ code
working-directory: ${{ matrix.sample }}
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE
else
cmake -S . -B build
fi
cmake --build build --verbose
shell: bash