Add some static analysis to the code base. #234
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and run tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ matrix.distro.image }} | |
env: | |
LDFLAGS: ${{ matrix.linking.ldflags }} | |
CC: ${{ matrix.compiler.cc }} | |
CXX: ${{ matrix.compiler.cxx }} | |
strategy: | |
matrix: | |
distro: | |
- { image: "debian:testing", update_cmd: "apt update", install_cmd: "apt install -y", packages: "clang-tidy" } | |
- { image: "alpine:3.20", update_cmd: "true", install_cmd: "apk add --no-cache", packages: "g++ musl-dev clang18-extra-tools" } | |
- { image: "alpine:edge", update_cmd: "true", install_cmd: "apk add --no-cache", packages: "g++ musl-dev clang19-extra-tools" } | |
compiler: | |
- { cc: gcc, cxx: g++ } | |
- { cc: clang, cxx: clang++ } | |
linking: | |
- { ldflags: "" } | |
- { ldflags: "-static" } | |
options: | |
- { pcie_opt: "true" } | |
- { pcie_opt: "false" } | |
steps: | |
- name: Install dependencies | |
run: ${{ matrix.distro.update_cmd }} && ${{ matrix.distro.install_cmd }} git meson cppcheck ${{ matrix.distro.packages }} ${{ matrix.compiler.cc }} | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Configure | |
run: meson setup --buildtype release --werror -Dpcie_opt=${{ matrix.options.pcie_opt }} build || cat build/meson-logs/meson-log.txt /nonexistent | |
- name: Build | |
run: ninja -C build | |
- name: Run tests | |
run: ninja -C build test | |
- name: Provide access to compile commands | |
run: ln -s build/compile_commands.json | |
- name: Run clang-tidy | |
run: ninja -C build clang-tidy | |
- name: Run cppcheck | |
run: cppcheck --addon=threadsafety -D__unix__ -D__GNUC__ --project=build/compile_commands.json -i subprojects/ |