Fix CMake target detection and remove compiler warnings #74
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: Build-Windows-Visual-Studio | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build_windows: | |
| runs-on: windows-2022 | |
| timeout-minutes: 60 | |
| env: | |
| BUILD_TYPE: Debug | |
| steps: | |
| - name: Configure git | |
| shell: pwsh | |
| run: | | |
| git config --global core.autocrlf false | |
| git config --global core.eol lf | |
| git config --global core.longpaths true | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: true | |
| clean: true | |
| fetch-depth: 1 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Visual Studio | |
| uses: microsoft/setup-msbuild@v1.1 | |
| with: | |
| vs-version: '17.0' | |
| msbuild-architecture: x64 | |
| - name: Cache FetchContent downloads | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/build/_deps | |
| key: ${{ runner.os }}-vs-fetchcontent-${{ hashFiles('CMakeLists.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-vs-fetchcontent- | |
| - name: Prepare build directory | |
| shell: pwsh | |
| run: | | |
| if (Test-Path build) { Remove-Item -Recurse -Force build } | |
| New-Item -ItemType Directory -Path build | |
| - name: Build with Visual Studio (FetchContent mode) | |
| shell: pwsh | |
| run: | | |
| cd build | |
| Write-Host "Building with FetchContent to download all external systems..." | |
| cmake .. ` | |
| -G "Visual Studio 17 2022" ` | |
| -A x64 ` | |
| -DCMAKE_BUILD_TYPE="$env:BUILD_TYPE" ` | |
| -DMESSAGING_USE_FETCHCONTENT=ON ` | |
| -DMESSAGING_BUILD_TESTS=ON ` | |
| -DMESSAGING_BUILD_EXAMPLES=ON ` | |
| -DCMAKE_INSTALL_PREFIX="../target" | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| cmake --build . --config "$env:BUILD_TYPE" --parallel | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| - name: Run tests | |
| shell: pwsh | |
| run: | | |
| cd build | |
| ctest -C "$env:BUILD_TYPE" --output-on-failure --parallel | |
| # Allow tests to fail for now | |
| if ($LASTEXITCODE -ne 0) { Write-Host "Some tests failed" } | |
| - name: Upload build artifacts | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: messaging-system-windows-vs-${{ env.BUILD_TYPE }} | |
| path: | | |
| ${{ github.workspace }}/build/bin/ | |
| ${{ github.workspace }}/build/${{ env.BUILD_TYPE }}/ | |
| ${{ github.workspace }}/target/ | |
| if-no-files-found: warn |