fix workflow : update for windows dll #37
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: Test Suite | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
| env: | ||
| CI: true | ||
| jobs: | ||
| test: | ||
| name: Run Tests (${{ matrix.os }}, ${{ matrix.compiler }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-22.04 | ||
| compiler: gcc | ||
| version: 11 | ||
| - os: ubuntu-22.04 | ||
| compiler: clang | ||
| version: 14 | ||
| - os: windows-2022 | ||
| compiler: msvc | ||
| version: 2022 | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| fetch-depth: 0 | ||
| - name: Setup ccache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.ccache | ||
| C:\ccache | ||
| key: ccache-test-${{ matrix.os }}-${{ matrix.compiler }}-${{ github.sha }} | ||
| restore-keys: | | ||
| ccache-test-${{ matrix.os }}-${{ matrix.compiler }}- | ||
| ccache-test-${{ matrix.os }}- | ||
| - name: Setup dependency cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| .deps | ||
| ~/.deps | ||
| key: deps-test-${{ matrix.os }}-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }} | ||
| restore-keys: | | ||
| deps-test-${{ matrix.os }}-${{ matrix.compiler }}- | ||
| deps-test-${{ matrix.os }}- | ||
| - name: Set up build environment | ||
| shell: bash | ||
| id: build-env | ||
| run: | | ||
| echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | ||
| # ---------------- Linux (Ubuntu) setup ---------------- | ||
| - name: Install dependencies (Ubuntu) | ||
| if: startsWith(matrix.os, 'ubuntu') | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential cmake ninja-build \ | ||
| libgl1-mesa-dev libx11-dev libxrandr-dev libxinerama-dev \ | ||
| libxcursor-dev libxi-dev libasound2-dev libglu1-mesa-dev \ | ||
| libwayland-dev libxkbcommon-dev libegl1-mesa-dev \ | ||
| pkg-config ccache | ||
| - name: Set up GCC (Ubuntu) | ||
| if: matrix.compiler == 'gcc' && startsWith(matrix.os, 'ubuntu') | ||
| run: | | ||
| echo "CC=gcc-${{ matrix.version }}" >> "$GITHUB_ENV" | ||
| echo "CXX=g++-${{ matrix.version }}" >> "$GITHUB_ENV" | ||
| - name: Set up Clang (Ubuntu) | ||
| if: matrix.compiler == 'clang' && startsWith(matrix.os, 'ubuntu') | ||
| run: | | ||
| echo "CC=clang-${{ matrix.version }}" >> "$GITHUB_ENV" | ||
| echo "CXX=clang++-${{ matrix.version }}" >> "$GITHUB_ENV" | ||
| # ---------------- Windows setup ---------------- | ||
| - name: Install dependencies (Windows) | ||
| if: matrix.os == 'windows-2022' | ||
| run: | | ||
| choco install cmake ninja ccache zip --no-progress | ||
| - name: Clear CMake cache | ||
| shell: bash | ||
| run: | | ||
| if [ "${{ matrix.os }}" = "windows-2022" ]; then | ||
| # Windows commands | ||
| rm -rf "${{ steps.build-env.outputs.build-output-dir }}" 2>/dev/null || echo "Build dir not found or already clean" | ||
| rm -rf ".deps" 2>/dev/null || echo "Deps dir not found or already clean" | ||
| rm -f CMakeCache.txt cmake_install.cmake 2>/dev/null || echo "Cache files not found or already clean" | ||
| # Remove any remaining CMakeFiles directories | ||
| find . -name "CMakeFiles" -type d -exec rm -rf {} + 2>/dev/null || echo "No CMakeFiles dirs found" | ||
| else | ||
| # Unix/Linux commands | ||
| rm -rf "${{ steps.build-env.outputs.build-output-dir }}" | ||
| rm -rf ".deps" | ||
| rm -f CMakeCache.txt cmake_install.cmake CMakeFiles/ | ||
| fi | ||
| - name: Create build directory | ||
| run: mkdir -p "${{ steps.build-env.outputs.build-output-dir }}" | ||
| - name: Configure CMake for testing | ||
| shell: bash | ||
| run: | | ||
| if [ "${{ matrix.os }}" = "windows-2022" ]; then | ||
| # Use Ninja generator for Windows | ||
| cmake -B "${{ steps.build-env.outputs.build-output-dir }}" \ | ||
| -GNinja \ | ||
| -DCMAKE_BUILD_TYPE=Debug \ | ||
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | ||
| -DBUILD_TESTS=ON \ | ||
| -DBUILD_BENCHMARKS=ON \ | ||
| -DENABLE_COVERAGE=OFF \ | ||
| -DENABLE_WARNINGS=OFF \ | ||
| -DENABLE_UNITY_BUILD=OFF \ | ||
| -DENABLE_SANITIZERS=OFF \ | ||
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
| -DENABLE_DEV_TOOLS=OFF \ | ||
| -DENABLE_DEBUG_INFO=ON \ | ||
| -S "${{ github.workspace }}" | ||
| else | ||
| # Use default generator for other platforms | ||
| cmake -B "${{ steps.build-env.outputs.build-output-dir }}" \ | ||
| -DCMAKE_BUILD_TYPE=Debug \ | ||
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | ||
| -DBUILD_TESTS=ON \ | ||
| -DBUILD_BENCHMARKS=ON \ | ||
| -DENABLE_COVERAGE=OFF \ | ||
| -DENABLE_WARNINGS=OFF \ | ||
| -DENABLE_UNITY_BUILD=OFF \ | ||
| -DENABLE_SANITIZERS=OFF \ | ||
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
| -DENABLE_DEV_TOOLS=OFF \ | ||
| -DENABLE_DEBUG_INFO=ON \ | ||
| -S "${{ github.workspace }}" | ||
| fi | ||
| - name: Build tests and benchmarks | ||
| shell: bash | ||
| run: | | ||
| cmake --build "${{ steps.build-env.outputs.build-output-dir }}" \ | ||
| --config Debug \ | ||
| --target ChainedDecos ChainedDecosMapEditor ChainedDecosTests benchmarks \ | ||
| --parallel $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 8) | ||
| - name: Run static analysis | ||
| shell: bash | ||
| if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'gcc' | ||
| run: | | ||
| echo "🔍 Running static analysis..." | ||
| # Count warnings in build output | ||
| echo "📊 Build completed successfully" | ||
| # Check for potential memory leaks or issues | ||
| echo "🔍 Checking for common C++ issues..." | ||
| find src -name "*.cpp" -o -name "*.h" | wc -l | xargs echo "Found files to analyze:" | ||
| - name: Generate coverage report (Ubuntu GCC only) | ||
| if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'gcc' | ||
| shell: bash | ||
| run: | | ||
| echo "📊 Generating coverage report..." | ||
| # Coverage would be generated here if we had tests with coverage instrumentation | ||
| echo "ℹ️ Coverage report generation skipped (no tests with coverage)" | ||
| - name: Upload test results | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: test-results-${{ matrix.os }}-${{ matrix.compiler }} | ||
| path: | | ||
| ${{ steps.build-env.outputs.build-output-dir }}/Testing/ | ||
| ${{ steps.build-env.outputs.build-output-dir }}/compile_commands.json | ||
| retention-days: 7 | ||
| - name: Upload coverage report (Ubuntu GCC only) | ||
| uses: actions/upload-artifact@v4 | ||
| if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'gcc' && always() | ||
| with: | ||
| name: coverage-report-${{ matrix.os }}-${{ matrix.compiler }} | ||
| path: | | ||
| ${{ steps.build-env.outputs.build-output-dir }}/coverage/ | ||
| retention-days: 30 | ||