Skip to content

Commit 6bb89b2

Browse files
committed
Add microtimer CI verification gates
1 parent 84991fb commit 6bb89b2

1 file changed

Lines changed: 87 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 87 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,98 @@ on:
77
branches: [master]
88

99
jobs:
10-
test:
11-
name: Build and Test (${{ matrix.cc }})
10+
linux:
1211
runs-on: ubuntu-latest
1312
strategy:
1413
fail-fast: false
1514
matrix:
16-
cc: [gcc, clang]
15+
include:
16+
- cc: gcc
17+
c_standard: 99
18+
- cc: gcc
19+
c_standard: 11
20+
- cc: clang
21+
c_standard: 99
22+
- cc: clang
23+
c_standard: 11
24+
steps:
25+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
26+
- name: Configure
27+
run: cmake -S . -B build -DMICROTIMER_BUILD_TESTS=ON -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_C_STANDARD=${{ matrix.c_standard }}
28+
- name: Build
29+
run: cmake --build build
30+
- name: Test
31+
run: ctest --test-dir build --output-on-failure
1732

33+
linux-sanitizers:
34+
runs-on: ubuntu-latest
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
sanitize:
39+
- address
40+
- undefined
41+
- address,undefined
1842
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v4
43+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
44+
- name: Configure
45+
run: cmake -S . -B build -DMICROTIMER_BUILD_TESTS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="-fsanitize=${{ matrix.sanitize }} -fno-omit-frame-pointer"
46+
- name: Build
47+
run: cmake --build build
48+
- name: Test
49+
run: ctest --test-dir build --output-on-failure
2150

22-
- name: Clone microtest dependency
23-
run: git clone --depth 1 https://github.com/Vanderhell/microtest.git ../microtest
51+
linux-analysis:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
55+
- name: Install optional tools
56+
run: sudo apt-get update && sudo apt-get install -y clang-tidy cppcheck clang-tools
57+
- name: Strict configure
58+
run: cmake -S . -B build -DMICROTIMER_BUILD_TESTS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="-Wconversion -Wsign-conversion -fshort-enums"
59+
- name: Build
60+
run: cmake --build build
61+
- name: Clang static analyzer
62+
run: scan-build --status-bugs cmake --build build
63+
- name: Clang tidy
64+
run: clang-tidy src/mtimer.c -- -Iinclude
65+
- name: Cppcheck
66+
run: cppcheck --enable=warning,style,performance --error-exitcode=1 include src tests
67+
68+
windows-msvc:
69+
runs-on: windows-latest
70+
steps:
71+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
72+
- name: Configure
73+
run: cmake -S . -B build -DMICROTIMER_BUILD_TESTS=ON -G "Visual Studio 17 2022" -A x64 -DCMAKE_C_FLAGS="/W4 /WX"
74+
- name: Build
75+
run: cmake --build build --config Release
76+
- name: Test
77+
run: ctest --test-dir build -C Release --output-on-failure
2478

25-
- name: Build and run tests
26-
run: make -C tests CC=${{ matrix.cc }}
79+
install-consumers:
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
83+
- name: Install package
84+
run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX="$PWD/stage" && cmake --build build && cmake --install build
85+
- name: find_package consumer
86+
run: cmake -S tests/find_package_consumer -B build-find -DCMAKE_PREFIX_PATH="$PWD/stage" && cmake --build build-find
87+
- name: add_subdirectory consumer
88+
run: cmake -S tests/add_subdirectory_consumer -B build-subdir && cmake --build build-subdir
89+
90+
arm-cross:
91+
runs-on: ubuntu-latest
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
cpu:
96+
- cortex-m0
97+
- cortex-m0plus
98+
- cortex-m4
99+
steps:
100+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
101+
- name: Install ARM toolchain
102+
run: sudo apt-get update && sudo apt-get install -y gcc-arm-none-eabi
103+
- name: Compile only
104+
run: arm-none-eabi-gcc -std=c99 -Wall -Wextra -Werror -mcpu=${{ matrix.cpu }} -mthumb -Iinclude -c src/mtimer.c -o mtimer-${{ matrix.cpu }}.o

0 commit comments

Comments
 (0)