@@ -27,67 +27,76 @@ jobs:
2727 fail-fast : false
2828 matrix :
2929 os : [ ubuntu-latest ]
30- build_cfg : [
31- { "name": "gcc-no-math",
32- " flags " :
33- ' { "QMAKESPEC": "linux-gcc-no-math",
34- "EVAL": "export CXX=false && touch math.h float.h",
35- "CFLAGS": "-ffreestanding -DCBOR_NO_FLOATING_POINT -Os",
36- "LDFLAGS": "-Wl,--no-undefined",
37- "LDLIBS": ""
38- }' ,
39- },
40- { "name": "gcc-freestanding",
41- " flags " :
42- ' { "QMAKESPEC": "linux-gcc-freestanding",
43- "EVAL": "export CXX=false",
44- "CFLAGS": "-ffreestanding -Os",
45- "LDFLAGS": "-Wl,--no-undefined -lm"
46- }' ,
47- },
48- { "name": "clang",
49- " flags " :
50- ' { "QMAKESPEC": "linux-clang",
51- "EVAL": "export CC=clang && export CXX=clang++",
52- "CFLAGS": "-Oz",
53- "LDFLAGS": "-Wl,--no-undefined -lm",
54- "QMAKEFLAGS": "-config release",
55- "MAKEFLAGS": "-s",
56- "TESTARGS": "-silent"
57- }' ,
58- },
59- { "name": "linux-g++",
60- " flags " :
61- ' { "QMAKESPEC": "linux-g++",
62- "EVAL": "export CC=gcc && export CXX=g++",
63- "CFLAGS": "-Os",
64- "LDFLAGS": "-Wl,--no-undefined -lm",
65- "QMAKEFLAGS": "-config release",
66- "QT_NO_CPU_FEATURE": "rdrnd"
67- }'
68- }
69- ]
30+ build_cfg :
31+ - name : gcc-no-math
32+ cmakeflags : >-
33+ -DCMAKE_C_FLAGS="-Os -Werror"
34+ -DWITH_FLOATING_POINT=OFF
35+ -DWITH_FREESTANDING=ON
36+ - name : gcc-freestanding
37+ cmakeflags : >-
38+ -DCMAKE_C_FLAGS="-Os -Werror"
39+ -DWITH_FREESTANDING=ON
40+ - name : gcc-small
41+ cmakeflags : >-
42+ -DBUILD_TESTING=OFF
43+ -DCMAKE_C_FLAGS="-Os -Werror"
44+ - name : clang-small
45+ cmakeflags : >-
46+ -DBUILD_TESTING=OFF
47+ -DCMAKE_C_COMPILER=clang
48+ -DCMAKE_C_FLAGS="-Oz -g -Werror"
49+ - name : clang
50+ cmakeflags : >-
51+ -DBUILD_EXAMPLES=ON
52+ -DBUILD_SHARED_LIBS=ON
53+ -DCMAKE_BUILD_TYPE=Debug
54+ -DCMAKE_C_COMPILER=clang
55+ -DCMAKE_C_FLAGS_DEBUG="-Werror"
56+ -DCMAKE_CXX_COMPILER=clang++
57+ -DCMAKE_CXX_FLAGS_DEBUG="-Werror"
58+ - name : linux-g++
59+ cmakeflags : >-
60+ -DBUILD_EXAMPLES=ON
61+ -DBUILD_SHARED_LIBS=ON
62+ -DCMAKE_BUILD_TYPE=Debug
63+ -DCMAKE_C_COMPILER=gcc
64+ -DCMAKE_C_FLAGS_DEBUG="-Werror"
65+ -DCMAKE_CXX_COMPILER=g++
66+ -DCMAKE_CXX_FLAGS_DEBUG="-Werror"
7067 include :
71- - os : macos-13
72- build_cfg : { "name": "clang",
73- " flags " :
74- ' { "QMAKESPEC": "macx-clang",
75- "EVAL": "export CC=clang && export CXX=clang++",
76- "CFLAGS": "-Oz",
77- "QMAKEFLAGS": "-config debug",
78- "MAKEFLAGS": "-s",
79- "TESTARGS": "-silent",
80- "PATH": "/usr/local/opt/qt/bin:$PATH"
81- }'
82- }
68+ - os : macos-latest
69+ build_cfg :
70+ name : clang-small
71+ cmakeflags : >-
72+ -DBUILD_TESTING=OFF
73+ -DBUILD_TOOLS=OFF
74+ -DCMAKE_C_COMPILER=clang
75+ -DCMAKE_C_FLAGS="-Oz -g -Werror"
76+ -DCMAKE_CXX_COMPILER=clang++
77+ -DCMAKE_CXX_FLAGS="-O2 -g -Werror"
78+ - os : macos-15-intel
79+ build_cfg :
80+ name : clang
81+ cmakeflags : >-
82+ -DBUILD_EXAMPLES=ON
83+ -DBUILD_SHARED_LIBS=ON
84+ -DCMAKE_BUILD_TYPE=Debug
85+ -DCMAKE_C_COMPILER=clang
86+ -DCMAKE_C_FLAGS_DEBUG="-Werror -fsanitize=address"
87+ -DCMAKE_CXX_COMPILER=clang++
88+ -DCMAKE_CXX_FLAGS_DEBUG="-Werror -fsanitize=address"
89+ -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address"
90+ -DCMAKE_MODULE_LINKER_FLAGS="-fsanitize=address"
91+
8392
8493 # Default job name is too long to be visible in the "Checks" tab.
8594 name : ${{ matrix.os }}/${{ matrix.build_cfg.name }}
8695 # The type of runner that the job will run on
8796 runs-on : ${{ matrix.os }}
8897 steps :
8998 - name : Clone tinycbor
90- uses : actions/checkout@v4
99+ uses : actions/checkout@v6
91100
92101 - name : install Linux software
93102 if : matrix.os == 'ubuntu-latest'
@@ -97,44 +106,36 @@ jobs:
97106 sudo apt-get update
98107 sudo apt-get install -y --no-install-recommends \
99108 doxygen \
100- jq \
109+ cmake \
101110 libc6-dbg \
102111 libcjson-dev \
103112 libfuntools-dev \
104- qtbase5-dev
113+ ninja-build \
114+ qt6-base-dev
105115
106116 - name : install macOS software
107117 if : runner.os == 'macOS'
108118 run : |
109- # Doxygen 1.9.7 is broken with ifdefs again, install 1.9.4 which works.
110- wget https://raw.githubusercontent.com/Homebrew/homebrew-core/41828ee36b96e35b63b2a4c8cfc2df2c3728944a/Formula/doxygen.rb
111- brew install doxygen.rb
112- rm doxygen.rb
113- brew install qt cjson
119+ brew install -q \
120+ cjson \
121+ cmake \
122+ ninja \
123+ qt
114124
115- - name : Execute tests
125+ - name : Compile
116126 run : |
117127 set -x
118- PATH=`echo /opt/qt*/bin`:$PATH
119- eval $(echo '${{ matrix.build_cfg.flags }}' | jq -r 'to_entries[] | "\(.key)=\"\(.value)\""')
120- eval "$EVAL"
121- # FIXME: remove -Wno-error-line below.
122- export CFLAGS="$CFLAGS -Wno-error=implicit-function-declaration"
123- make OUT=.config V=1 -s -f Makefile.configure configure && cat .config
124- make -k \
125- CFLAGS="$CFLAGS -march=native -g1 -Wall -Wextra -Werror" \
126- CPPFLAGS="-DNDEBUG -DCBOR_ENCODER_WRITER_CONTROL=-1 -DCBOR_PARSER_READER_CONTROL=-1" \
127- lib/libtinycbor.a
128- size lib/libtinycbor.a | tee sizes
129- make -s clean
130- make -k \
131- CFLAGS="$CFLAGS -O0 -g" \
132- LDFLAGS="$LDFLAGS" ${LDLIBS+LDLIBS="$LDLIBS"}
133- grep -q freestanding-pass .config || make \
134- QMAKEFLAGS="$QMAKEFLAGS QMAKE_CXX=$CXX" \
135- tests/Makefile
136- grep -q freestanding-pass .config || \
137- (cd tests && make TESTARGS=-silent check -k \
138- TESTRUNNER=`which valgrind 2>/dev/null`)
139- make -s clean
140- ! [ $BUILD_DOCS ] || ./scripts/update-docs.sh
128+ cmake -S. -Bbuild -GNinja -DBUILD_TESTING=ON \
129+ ${{ matrix.build_cfg.cmakeflags }}
130+ ninja -C build -v
131+ if [[ -f build/libtinycbor.a ]]; then
132+ size build/libtinycbor.a | tee sizes
133+ fi
134+
135+ - name : Execute tests
136+ run : |
137+ ctest --output-on-failure --test-dir build
138+
139+ - name : Build docs
140+ if : matrix.build_cfg.docs
141+ run : ./scripts/update-docs.sh
0 commit comments