Add GTest support and GitHub Actions CI #1
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: | |
| test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout CanopyJSON | |
| uses: actions/checkout@v4 | |
| with: | |
| path: CanopyJSON | |
| # Canopy must sit at ../Canopy relative to CanopyJSON so that | |
| # add_subdirectory(../Canopy canopy_build) in CMakeLists.txt resolves correctly. | |
| # Canopy's cmake/Canopy.cmake initialises only the submodules it needs at | |
| # configure time, so no manual submodule steps are required here. | |
| # If Canopy is a private repository, add a personal access token as the | |
| # secret CANOPY_PAT (Settings → Secrets and variables → Actions) and | |
| # uncomment the token line below. | |
| - name: Checkout Canopy | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: edwardbr/Canopy | |
| path: Canopy | |
| # token: ${{ secrets.CANOPY_PAT }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y clang ninja-build libssl-dev | |
| - name: Configure | |
| working-directory: CanopyJSON | |
| run: cmake --preset Debug | |
| - name: Build | |
| working-directory: CanopyJSON | |
| run: cmake --build build_debug --target json_test --parallel $(nproc) | |
| - name: Test | |
| working-directory: CanopyJSON | |
| run: ctest --test-dir build_debug --output-on-failure |