Add GCC and MSVC to CI for cross-compiler testing #234
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| clang-format-check: | |
| name: Check Code Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run clang-format | |
| uses: jidicula/clang-format-action@v4.13.0 | |
| with: | |
| clang-format-version: 19 | |
| build-and-test-cmake: | |
| name: Build and Test (CMake, ${{ matrix.compiler.name }}-${{ matrix.compiler.version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| compiler: | |
| - { name: gcc, version: 13, cc: gcc-13, cxx: g++-13 } | |
| - { name: clang, version: 19, cc: clang-19, cxx: clang++-19 } | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache CCache | |
| uses: actions/cache@v4 | |
| id: ccache | |
| with: | |
| path: ~/.cache/ccache | |
| key: ${{ runner.os }}-ccache-${{ hashFiles('conanfile.py') }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('CMakePresets.json') }}-${{ github.run_id }} | |
| restore-keys: | | |
| ${{ runner.os }}-ccache-${{ hashFiles('conanfile.py') }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('CMakePresets.json') }}- | |
| ${{ runner.os }}-ccache- | |
| - name: Setup Conan | |
| uses: hankhsu1996/setup-conan@v1 | |
| with: | |
| conan-version: "2.5.0" | |
| cache-dependencies: true | |
| cache-tool: true | |
| - name: Install ${{ matrix.compiler.name }}-${{ matrix.compiler.version }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ${{ matrix.compiler.cc }} ${{ matrix.compiler.cxx }} | |
| sudo update-alternatives --install /usr/bin/cc cc /usr/bin/${{ matrix.compiler.cc }} 100 | |
| sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/${{ matrix.compiler.cxx }} 100 | |
| sudo update-alternatives --set cc /usr/bin/${{ matrix.compiler.cc }} | |
| sudo update-alternatives --set c++ /usr/bin/${{ matrix.compiler.cxx }} | |
| - name: Install dependencies | |
| run: | | |
| export CC=${{ matrix.compiler.cc }} | |
| export CXX=${{ matrix.compiler.cxx }} | |
| conan profile detect --force | |
| conan install . --build=missing | |
| conan install . -s build_type=Debug --build=missing | |
| - name: Verify compiler is available | |
| run: | | |
| ${{ matrix.compiler.cc }} --version | |
| ${{ matrix.compiler.cxx }} --version | |
| - name: Configure CMake and build project | |
| run: | | |
| cmake --preset release | |
| cmake --build --preset release | |
| - name: Run tests | |
| run: ctest --preset release | |
| build-and-test-bazel: | |
| name: Build and Test (Bazel, clang-19) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bazel | |
| uses: bazel-contrib/setup-bazel@0.14.0 | |
| with: | |
| bazelisk-cache: true | |
| disk-cache: ${{ github.workflow }} | |
| repository-cache: true | |
| - name: Install Clang 19 | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang-19 | |
| sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100 | |
| sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-19 100 | |
| sudo update-alternatives --set clang++ /usr/bin/clang++-19 | |
| sudo update-alternatives --set clang /usr/bin/clang-19 | |
| - name: Verify Clang is available | |
| run: clang --version | |
| - name: Build with Bazel | |
| run: | | |
| # Build release configuration | |
| bazel build //... | |
| # Build debug configuration | |
| bazel build //... --config=debug | |
| - name: Test with Bazel | |
| run: | | |
| # Test release configuration | |
| bazel test //... --test_output=all --test_timeout=5 | |
| # Test debug configuration | |
| bazel test //... --config=debug --test_output=all --test_timeout=5 | |
| build-and-test-windows: | |
| name: Build and Test (CMake, MSVC) | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Conan | |
| uses: hankhsu1996/setup-conan@v1 | |
| with: | |
| conan-version: "2.5.0" | |
| cache-dependencies: true | |
| cache-tool: true | |
| - name: Install dependencies | |
| run: | | |
| conan profile detect --force | |
| conan install . -s compiler.cppstd=23 --build=missing | |
| conan install . -s build_type=Debug -s compiler.cppstd=23 --build=missing | |
| - name: Verify MSVC is available | |
| run: | | |
| cl.exe | |
| continue-on-error: true | |
| - name: Configure CMake and build project | |
| run: | | |
| cmake --preset release | |
| cmake --build --preset release | |
| - name: Run tests | |
| run: ctest --preset release | |
| docs: | |
| name: Generate Documentation | |
| runs-on: ubuntu-latest | |
| container: hankhsu1996/doxygen:1.11.0 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Generate Doxygen documentation | |
| run: doxygen docs/Doxyfile | |
| - name: Upload Doxygen documentation artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: doxygen-docs | |
| path: docs/generated/html | |
| deploy: | |
| name: Deploy Documentation | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: docs | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download Doxygen documentation artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: doxygen-docs | |
| path: docs/generated/html | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/generated/html | |
| publish_branch: gh-pages |