Repository navigation
166 lines (134 loc) · 4.74 KB
/
Copy pathcmake_ubuntu.yml
File metadata and controls
166 lines (134 loc) · 4.74 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: cmake Ubuntu
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v7
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: Create default profile
run: conan profile detect
- name: Install conan dependencies
run: conan install conanfile.py -s build_type=${{env.BUILD_TYPE}} --build=missing
- name: Normalize build type
shell: bash
run: echo "BUILD_TYPE_LOWERCASE=$(echo "${BUILD_TYPE}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Configure CMake
shell: bash
run: cmake --preset conan-${{ env.BUILD_TYPE_LOWERCASE }}
- name: Build
shell: bash
run: cmake --build --preset conan-${{ env.BUILD_TYPE_LOWERCASE }}
- name: run test (Linux)
run: ctest --test-dir build/${{env.BUILD_TYPE}}
- name: Check generated schemas are up to date
run: |
./build/${{env.BUILD_TYPE}}/tools/bt4_generate_xsd > /tmp/bt4.xsd
./build/${{env.BUILD_TYPE}}/tools/bt4_generate_schematron > /tmp/bt4.sch
fail=0
diff tools/generated/bt4.xsd /tmp/bt4.xsd || \
{ echo "XSD is stale - regenerate: ./build/Release/tools/bt4_generate_xsd > tools/generated/bt4.xsd"; fail=1; }
diff tools/generated/bt4.sch /tmp/bt4.sch || \
{ echo "Schematron is stale - regenerate: ./build/Release/tools/bt4_generate_schematron > tools/generated/bt4.sch"; fail=1; }
exit $fail
# USE_VENDORED_JSON=OFF, with the oldest supported nlohmann_json (3.10.5 on 22.04)
system-json:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v7
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y nlohmann-json3-dev libzmq3-dev libsqlite3-dev libgtest-dev
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_VENDORED_JSON=OFF
- name: Build
run: cmake --build build --parallel $(nproc)
- name: run test
run: ctest --test-dir build --output-on-failure
coverage:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # Full history needed by SonarCloud
- name: Install lcov
run: sudo apt-get update && sudo apt-get install -y lcov
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: Create default profile
run: conan profile detect
- name: Install conan dependencies
run: conan install conanfile.py -s build_type=Debug --build=missing
- name: Configure CMake with coverage
shell: bash
run: |
cmake --preset conan-debug \
-DCMAKE_C_FLAGS="--coverage -fprofile-update=atomic" \
-DCMAKE_CXX_FLAGS="--coverage -fprofile-update=atomic"
- name: Build
shell: bash
run: cmake --build --preset conan-debug
- name: Run tests
run: ctest --test-dir build/Debug --output-on-failure
- name: Collect coverage
run: |
lcov --capture --directory build/Debug \
--output-file coverage.info \
--ignore-errors mismatch,mismatch \
--ignore-errors negative,negative \
--ignore-errors gcov,gcov
lcov --extract coverage.info \
'*/BehaviorTree.CPP/include/*' \
'*/BehaviorTree.CPP/src/*' \
--output-file coverage.info \
--ignore-errors unused
lcov --remove coverage.info \
'*/contrib/*' \
--output-file coverage.info \
--ignore-errors unused
lcov --list coverage.info
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v5
# continue-on-error: true
# with:
# files: coverage.info
# flags: unittests
# disable_search: true
# disable_file_fixes: false
# plugins: noop
# network_filter: >-
# include/behaviortree_cpp/,src/
# token: ${{ secrets.CODECOV_TOKEN }}
# --- Coveralls ---
- name: Upload to Coveralls
uses: coverallsapp/github-action@v2
continue-on-error: true
with:
file: coverage.info
format: lcov
github-token: ${{ secrets.GITHUB_TOKEN }}
# --- SonarCloud ---
- name: Run SonarCloud analysis
uses: SonarSource/sonarcloud-github-action@v5
continue-on-error: true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}