-
Notifications
You must be signed in to change notification settings - Fork 77
115 lines (100 loc) · 3.18 KB
/
Copy pathci_linux.yml
File metadata and controls
115 lines (100 loc) · 3.18 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
name: CI Linux
on:
pull_request:
branches:
- '**'
workflow_dispatch:
inputs:
name:
description: "Manual trigger"
schedule:
- cron: '35 17 * * 6'
permissions:
pull-requests: write
jobs:
build-test-style-cover:
name: Build, Tests, and Coverage
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Install CMake and prerequisites
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl python3-pip git uncrustify valgrind
python3 -m pip install --upgrade pip
python3 -m pip install gcovr
# CMake 3.31.8
CMAKE_VER=3.31.8
curl -L "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-x86_64.tar.gz" -o cmake-old.tgz
sudo tar -C /opt -xzf cmake-old.tgz
echo "/opt/cmake-${CMAKE_VER}-linux-x86_64/bin" >> "$GITHUB_PATH"
- name: Show cmake version
run: |
cmake --version
ctest --version
- name: Configure
run: |
mkdir -p build
cd build
cmake ../ci/linux -DCMAKE_BUILD_TYPE=Release
- name: Build
run: |
cd build
make -j"$(nproc)"
# --- Run tests with newer CTest to produce JUnit ---
- name: Run tests and export JUnit
shell: bash
run: |
ctest --test-dir build/microcdr-build \
--output-on-failure \
--no-tests=error \
--output-junit "$GITHUB_WORKSPACE/build/CTestResults.xml"
- name: Generate coverage (gcovr Cobertura XML + HTML)
shell: bash
run: |
EXCLUDES=(
'--exclude-unreachable-branches'
'--exclude' 'ci/'
'--exclude' 'test/'
'--exclude' 'build/'
)
gcovr -x -r . "${EXCLUDES[@]}" -o build/coverage.xml
gcovr --html-details -r . "${EXCLUDES[@]}" -o build/coverage.html
- name: Upload artifacts (CTest & Coverage)
uses: actions/upload-artifact@v4
with:
name: test-and-coverage
path: |
build/CTestResults.xml
build/coverage.xml
build/coverage.html
if-no-files-found: warn
- name: Publish unit test results (JUnit)
uses: EnricoMi/publish-unit-test-result-action@v2
if: (!cancelled())
with:
files: build/CTestResults.xml
check_run: false
comment_mode: failures
comment_title: "Linux Tests Results"
- name: Coverage (human-readable summary)
if: success()
shell: bash
run: |
gcovr -r . \
--exclude-unreachable-branches \
--exclude ci/ \
--exclude test/ \
--exclude build/
uncrustify:
name: Uncrustify check
runs-on: ubuntu-22.04
if: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'conflicts') }}
steps:
- name: Run Uncrustify Linter
uses: eProsima/eProsima-CI/ubuntu/uncrustify@v0