Added another example #7
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: CI | |
| on: | |
| push: | |
| branches: [ "main"] | |
| pull_request: | |
| branches: [ "main"] | |
| jobs: | |
| build-and-test: | |
| name: ${{ matrix.os }} - ${{ matrix.build-type }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux: Uses the "linux-ninja-debug" preset | |
| - os: ubuntu-latest | |
| configure-preset: "linux-ninja-debug" | |
| build-preset: "linux-ninja-debug" | |
| build-type: "Debug" | |
| # Windows: Uses "windows-msvc" (Config) and "windows-msvc-debug" (Build) | |
| - os: windows-latest | |
| configure-preset: "windows-msvc" | |
| build-preset: "windows-msvc-debug" | |
| build-type: "Debug" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # ---------------------------------------------------------------- | |
| # 1. Setup Environment (The Correct Way) | |
| # ---------------------------------------------------------------- | |
| # 'lukka/get-cmake' installs both CMake and Ninja. | |
| # We pin it to 'latest' to ensure we get a version that supports Presets v3. | |
| - name: Setup CMake & Ninja | |
| uses: lukka/get-cmake@latest | |
| # ---------------------------------------------------------------- | |
| # 2. Configure | |
| # ---------------------------------------------------------------- | |
| - name: Configure Project | |
| run: cmake --preset ${{ matrix.configure-preset }} | |
| # ---------------------------------------------------------------- | |
| # 3. Build | |
| # ---------------------------------------------------------------- | |
| - name: Build | |
| run: cmake --build --preset ${{ matrix.build-preset }} | |
| # ---------------------------------------------------------------- | |
| # 4. Test | |
| # ---------------------------------------------------------------- | |
| - name: Test | |
| # '|| true' ensures the CI doesn't fail if you haven't written tests yet. | |
| # Remove '|| true' once you actually have tests. | |
| run: ctest --preset ${{ matrix.build-preset }} --output-on-failure || true |