Example change that will fail checks #34
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: Continuous Integration | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
check_style_etc: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt -q install clang-format | |
- uses: actions/checkout@v4 | |
- name: Check formatting | |
run: | | |
clang-format -i */*.[ch] | |
if git diff | grep ""; then | |
(echo "Formatting errors detected by clang-format."; | |
echo "Please run `make format`."; | |
echo) >> $GITHUB_STEP_SUMMARY | |
false | |
fi | |
- name: Check C89 compliance | |
env: | |
CFLAGS: "-O0 -Werror -std=c89 -pedantic -Isrc" | |
run: | | |
if ! gcc $CFLAGS -c */*.c; then | |
(echo "Code should be ANSI C. Make sure you are not using features"; | |
echo "from later standards, including C++-style // comments."; | |
echo) >> $GITHUB_STEP_SUMMARY | |
false | |
fi | |
- name: Check value types can be redefined | |
env: | |
CFLAGS: "-O0 -Werror -DTEST_ALTERNATE_VALUE_TYPES" | |
run: | | |
if ! gcc $CFLAGS -c src/*.c | |
(echo "Key/value types cannot be redefined to something other than a" | |
echo "void pointer. Compile with -DTEST_ALTERNATE_VALUE_TYPES to see" | |
echo "the compile error." | |
echo) >> $GITHUB_STEP_SUMMARY | |
false | |
fi | |
build_and_coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt -q install doxygen | |
- uses: actions/checkout@v4 | |
- name: configure | |
run: | | |
LDFLAGS="$CFLAGS" ./autogen.sh \ | |
--enable-coverage | |
- name: make | |
run: make -j | |
- name: make check | |
run: | | |
make -j check || (cat test/test-suite.log; false) | |
- name: Generate coverage reports | |
run: | | |
mkdir artifacts | |
tar cf - src/*.gcov | tar -C artifacts -xf - | |
- name: Upload coverage-annotated source files | |
uses: actions/upload-artifact@v4 | |
with: | |
path: "artifacts" | |
name: coverage_reports | |
- name: make dist | |
run: | | |
make distcheck | |
make dist | |
- name: Make documentation zip | |
uses: actions/upload-artifact@v4 | |
with: | |
path: "doc/html" | |
name: documentation | |
valgrind_build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt -q install valgrind | |
- uses: actions/checkout@v4 | |
- name: configure | |
run: | | |
LDFLAGS="$CFLAGS" ./autogen.sh \ | |
--enable-valgrind | |
- name: make | |
run: make -j | |
- name: make check | |
run: | | |
make -j check || (cat test/test-suite.log; false) | |
ubsan_build: | |
runs-on: ubuntu-latest | |
env: | |
CC: clang | |
# TODO: Add -fsanitize=address and memory too. | |
CFLAGS: "-fsanitize=undefined | |
-fno-omit-frame-pointer | |
-fno-sanitize-recover=all | |
-fno-sanitize=shift-base" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: configure | |
run: | | |
LDFLAGS="$CFLAGS" ./autogen.sh | |
- name: make check | |
run: | | |
make -j check || (cat test/test-suite.log; false) |