Update Version in readme #47
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: Build and Test | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} (${{ matrix.build_type }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| build_type: [Release] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup MSVC (Windows) | |
| if: runner.os == 'Windows' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Setup CMake | |
| uses: jwlawson/actions-setup-cmake@v2 | |
| with: | |
| cmake-version: '3.20.x' | |
| - name: Configure CMake (Windows) | |
| if: runner.os == 'Windows' | |
| run: cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| - name: Configure CMake (Linux) | |
| if: runner.os == 'Linux' | |
| run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| - name: Build | |
| run: cmake --build build --config ${{ matrix.build_type }} | |
| - name: Run Tests (Linux) | |
| if: runner.os == 'Linux' | |
| timeout-minutes: 10 | |
| run: | | |
| cd build | |
| ctest --output-on-failure --build-config ${{ matrix.build_type }} --timeout 300 | |
| - name: Run Tests (Windows) | |
| if: runner.os == 'Windows' | |
| timeout-minutes: 10 | |
| run: | | |
| cd build | |
| ctest -C ${{ matrix.build_type }} --output-on-failure --timeout 300 | |
| - name: Test Demo Executable (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| run: | | |
| echo "Testing demo executable..." | |
| ./build/ghostmem_demo < /dev/null || echo "Demo ran (may have exited with error due to stdin)" | |
| timeout-minutes: 2 | |
| continue-on-error: true | |
| - name: Test Demo Executable (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| Write-Host "Testing demo executable..." | |
| $process = Start-Process -FilePath "build\${{ matrix.build_type }}\ghostmem_demo.exe" -NoNewWindow -PassThru | |
| Start-Sleep -Seconds 5 | |
| if (!$process.HasExited) { | |
| Stop-Process -Id $process.Id -Force | |
| Write-Host "Demo executed successfully (forced termination after 5s)" | |
| } else { | |
| Write-Host "Demo completed" | |
| } | |
| timeout-minutes: 2 | |
| continue-on-error: true | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ghostmem-${{ matrix.os }}-${{ matrix.build_type }} | |
| path: | | |
| build/ghostmem_demo* | |
| build/*.a | |
| build/*.lib | |
| build/*.so | |
| build/*.dll | |
| build/*.dylib | |
| build/Release/ | |
| build/Debug/ | |
| retention-days: 7 | |
| if-no-files-found: warn | |
| static-analysis: | |
| name: Static Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install cppcheck | |
| run: sudo apt-get install -y cppcheck | |
| - name: Run cppcheck | |
| run: | | |
| cppcheck --enable=warning,performance,portability \ | |
| --suppress=missingInclude \ | |
| --suppress=unmatchedSuppression \ | |
| --error-exitcode=0 \ | |
| src/ | |
| continue-on-error: true | |
| build-status: | |
| name: Build Status Check | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Check build results | |
| run: | | |
| if [ "${{ needs.build.result }}" == "success" ]; then | |
| echo "✅ All builds passed!" | |
| exit 0 | |
| else | |
| echo "❌ Some builds failed" | |
| exit 1 | |
| fi |