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
|
name: CI
permissions: read-all
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
# When a PR is updated, cancel the jobs from the previous version. Merges
# do not define head_ref, so use run_id to never cancel those jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
TinyCBOR:
timeout-minutes: 45
# Common environment variables
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_ANALYTICS: 1
strategy:
# Always run all jobs in the matrix, even if one fails.
fail-fast: false
matrix:
os: [ ubuntu-latest ]
build_cfg:
- name: gcc-no-math
cmakeflags: >-
-DCMAKE_C_FLAGS="-Os -Werror"
-DWITH_FLOATING_POINT=OFF
-DWITH_FREESTANDING=ON
- name: gcc-freestanding
cmakeflags: >-
-DCMAKE_C_FLAGS="-Os -Werror"
-DWITH_FREESTANDING=ON
- name: gcc-small
cmakeflags: >-
-DBUILD_TESTING=OFF
-DCMAKE_C_FLAGS="-Os -Werror"
- name: clang-small
cmakeflags: >-
-DBUILD_TESTING=OFF
-DCMAKE_C_COMPILER=clang
-DCMAKE_C_FLAGS="-Oz -g -Werror"
- name: clang
cmakeflags: >-
-DBUILD_EXAMPLES=ON
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=clang
-DCMAKE_C_FLAGS_DEBUG="-Werror"
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_FLAGS_DEBUG="-Werror"
- name: linux-g++
cmakeflags: >-
-DBUILD_EXAMPLES=ON
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=gcc
-DCMAKE_C_FLAGS_DEBUG="-Werror"
-DCMAKE_CXX_COMPILER=g++
-DCMAKE_CXX_FLAGS_DEBUG="-Werror"
include:
- os: macos-latest
build_cfg:
name: clang-small
cmakeflags: >-
-DBUILD_TESTING=OFF
-DBUILD_TOOLS=OFF
-DCMAKE_C_COMPILER=clang
-DCMAKE_C_FLAGS="-Oz -g -Werror"
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_FLAGS="-O2 -g -Werror"
- os: macos-15-intel
build_cfg:
name: clang
cmakeflags: >-
-DBUILD_EXAMPLES=ON
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=clang
-DCMAKE_C_FLAGS_DEBUG="-Werror -fsanitize=address"
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_FLAGS_DEBUG="-Werror -fsanitize=address"
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address"
-DCMAKE_MODULE_LINKER_FLAGS="-fsanitize=address"
# Default job name is too long to be visible in the "Checks" tab.
name: ${{ matrix.os }}/${{ matrix.build_cfg.name }}
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
steps:
- name: Clone tinycbor
uses: actions/checkout@v6
- name: install Linux software
if: matrix.os == 'ubuntu-latest'
run: |
# Need a recent Valgrind, otherwise debug info cannot be read.
sudo snap install valgrind --classic
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
doxygen \
cmake \
libc6-dbg \
libcjson-dev \
libfuntools-dev \
ninja-build \
qt6-base-dev
- name: install macOS software
if: runner.os == 'macOS'
run: |
brew install -q \
cjson \
cmake \
ninja \
qt
- name: Compile
run: |
set -x
cmake -S. -Bbuild -GNinja -DBUILD_TESTING=ON \
${{ matrix.build_cfg.cmakeflags }}
ninja -C build -v
if [[ -f build/libtinycbor.a ]]; then
size build/libtinycbor.a | tee sizes
fi
- name: Execute tests
run: |
ctest --output-on-failure --test-dir build
- name: Build docs
if: matrix.build_cfg.docs
run: ./scripts/update-docs.sh
|