| 1 | name: CI |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - master |
| 7 | pull_request: |
| 8 | |
| 9 | release: |
| 10 | |
| 11 | jobs: |
| 12 | build: |
| 13 | name: ${{ matrix.config.name }} |
| 14 | runs-on: ${{ matrix.config.os }} |
| 15 | strategy: |
| 16 | fail-fast: false |
| 17 | matrix: |
| 18 | config: |
| 19 | - { |
| 20 | name: "Ubuntu Latest GCC", |
| 21 | os: ubuntu-latest, |
| 22 | build_type: "Debug", |
| 23 | do_coverage: "ON", |
| 24 | } |
| 25 | - { |
| 26 | name: "macOS Latest Clang", |
| 27 | os: macos-latest, |
| 28 | build_type: "Debug", |
| 29 | do_coverage: "OFF", |
| 30 | } |
| 31 | |
| 32 | |
| 33 | steps: |
| 34 | - uses: actions/checkout@v3 |
| 35 | with: |
| 36 | fetch-depth: 25 |
| 37 | |
| 38 | - name: Print env |
| 39 | run: | |
| 40 | echo github.ref: ${{github.ref}} |
| 41 | echo github.event.action: ${{github.event.action}} |
| 42 | echo github.event_name: ${{github.event_name}} |
| 43 | echo runner.os: ${{runner.os}} |
| 44 | |
| 45 | - name: ccache |
| 46 | uses: hendrikmuhs/[email protected] |
| 47 | with: |
| 48 | key: ${{ matrix.os }}-${{ matrix.type }} |
| 49 | max-size: 1000M |
| 50 | |
| 51 | - name: Install dependencies on Ubuntu |
| 52 | if: runner.os == 'Linux' |
| 53 | run: | |
| 54 | sudo apt update |
| 55 | sudo apt install libeigen3-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev-qt5 libsuitesparse-dev lcov libspdlog-dev |
| 56 | |
| 57 | - name: Install dependencies on macOS |
| 58 | if: runner.os == 'macOS' |
| 59 | run: brew install cmake eigen |
| 60 | |
| 61 | - name: Configure ccache for macOS |
| 62 | if: runner.os == 'macOS' |
| 63 | run: | |
| 64 | # See https://github.com/hendrikmuhs/ccache-action/issues/146 |
| 65 | ccache --set-config=compiler_check=content |
| 66 | |
| 67 | - name: Configure CMake |
| 68 | run: | |
| 69 | cmake --version |
| 70 | cmake -B ${{github.workspace}}/build -DBUILD_UNITTESTS=ON -DBUILD_CODE_COVERAGE=${{matrix.config.do_coverage}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache |
| 71 | |
| 72 | - name: Build Introspection |
| 73 | shell: bash |
| 74 | run: | |
| 75 | echo "g2o config.h" |
| 76 | cat ${{github.workspace}}/build/g2o/config.h |
| 77 | echo "ENV" |
| 78 | env | sort |
| 79 | |
| 80 | - name: Build |
| 81 | run: cmake --build ${{github.workspace}}/build --config ${{matrix.config.build_type}} -j 2 |
| 82 | |
| 83 | - name: Test |
| 84 | working-directory: ${{github.workspace}}/build |
| 85 | run: ctest -C ${{matrix.config.build_type}} --extra-verbose --output-on-failure |
| 86 | |
| 87 | - name: Coverage |
| 88 | if: matrix.config.do_coverage == 'ON' |
| 89 | run: bash ${{github.workspace}}/build/codecov.sh |