C++ Httplib server codegen #3
Workflow file for this run
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: 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 |