-
Notifications
You must be signed in to change notification settings - Fork 1.1k
99 lines (83 loc) · 2.83 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: CI
on:
push:
branches:
- master
- pymem
pull_request:
release:
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Latest GCC",
os: ubuntu-latest,
build_type: "Debug",
do_coverage: "ON",
}
- {
name: "macOS Latest Clang",
os: macos-latest,
build_type: "Debug",
do_coverage: "OFF",
}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 25
- name: Print env
run: |
echo github.ref: ${{github.ref}}
echo github.event.action: ${{github.event.action}}
echo github.event_name: ${{github.event_name}}
echo runner.os: ${{runner.os}}
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.config.os }}-${{ matrix.config.build_type }}
max-size: 2000M
- name: Install dependencies on Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install libeigen3-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev-qt5 libsuitesparse-dev lcov libspdlog-dev nlohmann-json3-dev
- name: Install dependencies on macOS
if: runner.os == 'macOS'
run: brew install cmake eigen coreutils nlohmann-json
- name: Configure ccache for macOS
if: runner.os == 'macOS'
run: |
# See https://github.com/hendrikmuhs/ccache-action/issues/146
ccache --set-config=compiler_check=content
- name: Coverage Configure Build
if: matrix.config.do_coverage == 'ON'
run: |
echo "CFLAGS=--coverage" >> $GITHUB_ENV
echo "CXXFLAGS=--coverage" >> $GITHUB_ENV
- name: Configure CMake
run: |
echo "number of cores: $(nproc) $(nproc --all)"
cmake --version
cmake -B ${{github.workspace}}/build -DBUILD_UNITTESTS=ON -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build Introspection
shell: bash
run: |
echo "g2o config.h"
cat ${{github.workspace}}/build/g2o/config.h
echo "ENV"
env | sort
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.config.build_type}} -j $(nproc)
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.config.build_type}} --extra-verbose --output-on-failure
- name: Coverage Results
if: matrix.config.do_coverage == 'ON'
uses: codecov/codecov-action@v4.2.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}