-
Notifications
You must be signed in to change notification settings - Fork 0
217 lines (176 loc) · 7.04 KB
/
Copy pathci.yml
File metadata and controls
217 lines (176 loc) · 7.04 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
permissions:
contents: read
env:
STRICT_C_FLAGS: >-
-Wall -Wextra -Wpedantic -Werror -Wconversion -Wsign-conversion
-Wshadow -Wformat=2 -Wundef -Wmissing-prototypes -Wstrict-prototypes
jobs:
python-tests:
name: Python decoder tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install pytest
run: python -m pip install pytest
- name: Run decoder tests
run: python -m pytest tests/host_format_tests -v --tb=short
host-strict:
name: Host strict build (${{ matrix.compiler }}, ${{ matrix.build_type }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [ gcc, clang ]
build_type: [ Debug, Release ]
steps:
- uses: actions/checkout@v4
- name: Install Clang
if: matrix.compiler == 'clang'
run: sudo apt-get update && sudo apt-get install -y clang
- name: Configure host build
run: >
cmake -S . -B build-${{ matrix.compiler }}-${{ matrix.build_type }}
-DPANICDUMP_BUILD_TESTS=ON
-DPANICDUMP_PORT=host
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_C_COMPILER=${{ matrix.compiler }}
-DCMAKE_C_FLAGS="${STRICT_C_FLAGS}"
- name: Build host targets
run: cmake --build build-${{ matrix.compiler }}-${{ matrix.build_type }} --parallel
- name: Run CTest
run: ctest --test-dir build-${{ matrix.compiler }}-${{ matrix.build_type }} --output-on-failure
package-consumer:
name: Package install and consumer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure host build
run: >
cmake -S . -B build
-DPANICDUMP_BUILD_TESTS=ON
-DPANICDUMP_PORT=host
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_FLAGS="${STRICT_C_FLAGS}"
- name: Build host targets
run: cmake --build build --parallel
- name: Run CTest
run: ctest --test-dir build -C Release --output-on-failure
- name: Install package
run: cmake --install build --prefix .install
- name: Configure external consumer
run: cmake -S tests/package_consumer -B build-consumer -DCMAKE_PREFIX_PATH=$PWD/.install
- name: Build external consumer
run: cmake --build build-consumer --config Release
- name: Run external consumer
run: ./build-consumer/panicdump_consumer
sanitizers:
name: Sanitizer build (${{ matrix.sanitizer }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- sanitizer: asan
cflags: -fsanitize=address -fno-omit-frame-pointer
ldflags: -fsanitize=address
- sanitizer: ubsan
cflags: -fsanitize=undefined -fno-omit-frame-pointer
ldflags: -fsanitize=undefined
- sanitizer: lsan
cflags: -fsanitize=leak -fno-omit-frame-pointer
ldflags: -fsanitize=leak
steps:
- uses: actions/checkout@v4
- name: Install Clang
run: sudo apt-get update && sudo apt-get install -y clang
- name: Configure sanitizer build
run: >
cmake -S . -B build-${{ matrix.sanitizer }}
-DPANICDUMP_BUILD_TESTS=ON
-DPANICDUMP_PORT=host
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=clang
-DCMAKE_C_FLAGS="${STRICT_C_FLAGS} ${{ matrix.cflags }}"
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.ldflags }}"
- name: Build sanitizer targets
run: cmake --build build-${{ matrix.sanitizer }} --parallel
- name: Run CTest
run: ctest --test-dir build-${{ matrix.sanitizer }} --output-on-failure
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install analysis tools
run: sudo apt-get update && sudo apt-get install -y clang clang-tidy cppcheck
- name: clang --analyze
run: >
clang --analyze -std=c11
-Wall -Wextra -Wpedantic -Werror -Wconversion -Wsign-conversion
-Wshadow -Wformat=2 -Wundef -Wmissing-prototypes -Wstrict-prototypes
-DPANICDUMP_HOST_BUILD -I include -I src
src/panicdump.c src/panicdump_port_host.c tests/panicdump_core_test.c
- name: clang-tidy
run: >
clang-tidy src/panicdump.c src/panicdump_port_host.c tests/panicdump_core_test.c
--checks=clang-analyzer-*
--header-filter=.*
--warnings-as-errors=*
--
-std=c11
-DPANICDUMP_HOST_BUILD -I include -I src
- name: cppcheck
run: >
cppcheck --enable=warning,style,performance,portability
--error-exitcode=1 --std=c11
-I include -I src -DPANICDUMP_HOST_BUILD
src/panicdump.c src/panicdump_port_host.c tests/panicdump_core_test.c
arm-verification:
name: ARM verification (${{ matrix.cpu }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- cpu: cortex-m3
cflags: -mcpu=cortex-m3 -mthumb
ldflags: -mcpu=cortex-m3 -mthumb
- cpu: cortex-m4
cflags: -mcpu=cortex-m4 -mthumb -mfloat-abi=soft
ldflags: -mcpu=cortex-m4 -mthumb -mfloat-abi=soft
steps:
- uses: actions/checkout@v4
- name: Install ARM toolchain
run: sudo apt-get update && sudo apt-get install -y gcc-arm-none-eabi binutils-arm-none-eabi
- name: Compile core and Cortex-M port
run: |
mkdir -p build-arm-${{ matrix.cpu }}
arm-none-eabi-gcc ${{ matrix.cflags }} -ffreestanding -fstack-usage -Wall -Wextra -Werror \
-DPANICDUMP_RAM_BASE=0x20000000 -DPANICDUMP_RAM_END=0x20020000 \
-I include -I src -c src/panicdump.c -o build-arm-${{ matrix.cpu }}/panicdump.o
arm-none-eabi-gcc ${{ matrix.cflags }} -ffreestanding -fstack-usage -Wall -Wextra -Werror \
-DPANICDUMP_RAM_BASE=0x20000000 -DPANICDUMP_RAM_END=0x20020000 \
-I include -I src -c src/panicdump_port_cortexm.c -o build-arm-${{ matrix.cpu }}/panicdump_port_cortexm.o
- name: Link freestanding ELF
run: >
arm-none-eabi-gcc ${{ matrix.ldflags }} -ffreestanding -nostdlib
-Wl,-Map=build-arm-${{ matrix.cpu }}/panicdump.map
-Wl,-e,panicdump_fault_handler_c
build-arm-${{ matrix.cpu }}/panicdump.o
build-arm-${{ matrix.cpu }}/panicdump_port_cortexm.o
-o build-arm-${{ matrix.cpu }}/panicdump.elf
- name: Inspect ARM link
run: |
arm-none-eabi-size build-arm-${{ matrix.cpu }}/panicdump.elf
arm-none-eabi-objdump -t build-arm-${{ matrix.cpu }}/panicdump.elf | grep 'panicdump_port_cortexm\|panicdump_fault_handler_c\|panicdump_commit_snapshot'
find build-arm-${{ matrix.cpu }} -name '*.su' -print -exec cat {} \;