Added vcpkg installation docs and CI smoke test #23
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
| # Install + downstream consumer integration test. | |
| # | |
| # Installs the library to a temporary prefix, then configures and builds a | |
| # minimal consumer project (tests/consumer/) against that prefix using | |
| # `find_package(GeoUtilsCpp 1.0.1 REQUIRED)` and `target_link_libraries(... geo::utils)`. | |
| # Runs the consumer to verify end-to-end integration. | |
| # | |
| # Catches regressions in install paths, exported target names, and | |
| # CMake config files — the kind of bug that pure unit tests can't see. | |
| # | |
| # Runs on Linux/macOS/Windows in parallel. | |
| # Triggered automatically on push/PR to master/main; can also be run manually | |
| # from the Actions tab in GitHub UI. | |
| name: Install | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| install-consumer: | |
| name: install + consumer (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # CMAKE_INSTALL_PREFIX is set at configure time so it's baked into the | |
| # generated .pc file; the install step must not pass --prefix or the | |
| # .pc would point at the configure-time prefix while files land elsewhere. | |
| - name: Configure library | |
| run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/prefix | |
| - name: Build library | |
| run: cmake --build build --config Release | |
| - name: Install library | |
| run: cmake --install build --config Release | |
| # pkg-config sanity: catches regressions in the .pc template, including | |
| # malformed includedirs (doubled prefix → //) and non-relocatable templates | |
| # (the resolved includedir must actually contain our headers, not point at | |
| # a configure-time prefix that no longer matches the install location). | |
| # Skipped on Windows — pkg-config isn't part of the default toolchain. | |
| # | |
| # Expected version is derived from CMakeLists.txt rather than hardcoded | |
| # so that a `project(... VERSION x.y.z ...)` bump doesn't silently leave | |
| # this assertion testing the old number. | |
| - name: Verify pkg-config metadata | |
| if: runner.os != 'Windows' | |
| env: | |
| PKG_CONFIG_PATH: ${{ runner.temp }}/prefix/lib/pkgconfig | |
| run: | | |
| expected_version=$(sed -nE 's/^project\(GeoUtilsCpp VERSION ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' CMakeLists.txt) | |
| test -n "$expected_version" || { echo "ERROR: could not parse project version from CMakeLists.txt" >&2; exit 1; } | |
| version=$(pkg-config --modversion geo-utils-cpp) | |
| cflags=$(pkg-config --cflags geo-utils-cpp) | |
| include_dir=$(pkg-config --variable=includedir geo-utils-cpp) | |
| echo "expected: $expected_version" | |
| echo "version: $version" | |
| echo "cflags: $cflags" | |
| echo "includedir: $include_dir" | |
| test "$version" = "$expected_version" | |
| case "$cflags" in | |
| *//*) echo "ERROR: doubled-slash in include path: $cflags" >&2; exit 1 ;; | |
| esac | |
| test -f "$include_dir/geo/geo.hpp" || { | |
| echo "ERROR: header missing at $include_dir/geo/geo.hpp" >&2 | |
| echo " (the .pc file points outside the install prefix — likely a relocation bug)" >&2 | |
| exit 1 | |
| } | |
| - name: Configure consumer | |
| run: cmake -S tests/consumer -B build-consumer -DCMAKE_PREFIX_PATH=${{ runner.temp }}/prefix | |
| - name: Build consumer | |
| run: cmake --build build-consumer --config Release | |
| - name: Test consumer | |
| run: ctest --test-dir build-consumer -C Release --output-on-failure |