|
| 1 | +name: C++ API |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + pull_request: |
| 7 | + branches: ["main"] |
| 8 | + |
| 9 | +env: |
| 10 | + BUILD_TYPE: Release |
| 11 | + |
| 12 | +jobs: |
| 13 | + cpp_api: |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + os: [ubuntu-24.04, ubuntu-22.04, windows-2022] # TODO(hlim): Support Mac macos-14, macos-15] |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + - name: Setup cmake |
| 21 | + uses: jwlawson/actions-setup-cmake@v1.13 |
| 22 | + with: |
| 23 | + cmake-version: "3.25.x" |
| 24 | + - name: Configure CMake |
| 25 | + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/cpp/ |
| 26 | + - name: Build |
| 27 | + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} |
| 28 | + |
| 29 | + # As the previous job will always install the dependencies from cmake, and this is guaranteed to |
| 30 | + # work, we also want to support dev sandboxes where the main dependencies are already |
| 31 | + # pre-installed in the system. For now, we only support dev machines under a GNU/Linux |
| 32 | + # environmnets. If you are reading this and need the same functionallity in Windows/macOS please |
| 33 | + # open a ticket. |
| 34 | + cpp_api_dev: |
| 35 | + runs-on: ${{ matrix.os }} |
| 36 | + strategy: |
| 37 | + matrix: |
| 38 | + os: [ubuntu-24.04, ubuntu-22.04] |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v3 |
| 42 | + - name: Cache dependencies |
| 43 | + uses: actions/cache@v4 |
| 44 | + with: |
| 45 | + path: ~/.apt/cache |
| 46 | + key: ${{ runner.os }}-apt-${{ hashFiles('**/ubuntu_dependencies.yml') }} |
| 47 | + restore-keys: | |
| 48 | + ${{ runner.os }}-apt- |
| 49 | + - name: Install dependencies |
| 50 | + run: | |
| 51 | + sudo apt-get update |
| 52 | + sudo apt-get install -y build-essential cmake git libeigen3-dev libtbb-dev g++ |
| 53 | + - name: Configure CMake |
| 54 | + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/cpp/ |
| 55 | + - name: Build |
| 56 | + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} |
0 commit comments