Added Xunit tes #73
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: C++ CI CaseConversionAPI - All Platforms (Local App) | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build-and-test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 60 | |
| env: | |
| BUILD_DIR: CaseConversionAPI/CppLib/build | |
| steps: | |
| # ------------------------------- | |
| # Checkout repository | |
| # ------------------------------- | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # ------------------------------- | |
| # Install dependencies | |
| # ------------------------------- | |
| - name: Install compiler & CMake (Linux) | |
| if: runner.os != 'Windows' && runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y build-essential cmake | |
| - name: Install CMake (macOS) | |
| if: runner.os != 'Windows' && runner.os == 'macOS' | |
| run: brew install cmake | |
| - name: Install CMake (Windows) | |
| if: runner.os == 'Windows' | |
| run: choco install cmake ninja --installargs 'ADD_CMAKE_TO_PATH=System' --yes | |
| # ------------------------------- | |
| # Clean build directory (UNIFORM) | |
| # ------------------------------- | |
| - name: Clean build directory (Non-Windows) | |
| if: runner.os != 'Windows' | |
| run: rm -rf $BUILD_DIR | |
| - name: Clean build directory (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| if (Test-Path "$env:BUILD_DIR") { | |
| Remove-Item -Recurse -Force "$env:BUILD_DIR" | |
| } | |
| # ------------------------------- | |
| # Use local app CMakeLists | |
| # ------------------------------- | |
| - name: Use local app CMakeLists | |
| run: cp CaseConversionAPI/CppLib/CMakeListsLocalApp.txt CaseConversionAPI/CppLib/CMakeLists.txt | |
| # ------------------------------- | |
| # Configure project | |
| # ------------------------------- | |
| - name: Configure (Non-Windows) | |
| if: runner.os != 'Windows' | |
| run: cmake -S CaseConversionAPI/CppLib -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Release | |
| - name: Configure (Windows) | |
| if: runner.os == 'Windows' | |
| run: cmake -S CaseConversionAPI/CppLib -B $env:BUILD_DIR -G "Visual Studio 17 2022" -A x64 | |
| # ------------------------------- | |
| # Build project | |
| # ------------------------------- | |
| - name: Build project | |
| run: cmake --build ${{ env.BUILD_DIR }} --config Release --parallel | |
| # ------------------------------- | |
| # Run tests | |
| # ------------------------------- | |
| - name: Run tests (Non-Windows) | |
| if: runner.os != 'Windows' | |
| run: ctest --output-on-failure --test-dir $BUILD_DIR | |
| - name: Run tests (Windows) | |
| if: runner.os == 'Windows' | |
| run: ctest --output-on-failure -C Release --test-dir $env:BUILD_DIR | |
| # ------------------------------- | |
| # Upload test logs | |
| # ------------------------------- | |
| - name: Upload test logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-logs-${{ matrix.os }} | |
| path: ${{ env.BUILD_DIR }}/Testing/Temporary/LastTest.log |