forked from intel/tinycbor
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (147 loc) · 5.53 KB
/
build.yml
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main, ci-test ]
# 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:
Contiki-NG:
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",
"flags":
'{ "QMAKESPEC": "linux-gcc-no-math",
"EVAL": "CXX=false && touch src/math.h src/float.h",
"CFLAGS": "-ffreestanding -DCBOR_NO_FLOATING_POINT -Os",
"LDFLAGS": "-Wl,--no-undefined",
"LDLIBS": ""
}',
},
{ "name": "gcc-freestanding",
"flags":
'{ "QMAKESPEC": "linux-gcc-freestanding",
"EVAL": "CXX=false",
"CFLAGS": "-ffreestanding -Os",
"LDFLAGS": "-Wl,--no-undefined -lm"
}',
},
{ "name": "clang",
"flags":
'{ "QMAKESPEC": "linux-clang",
"EVAL": "CC=clang && CXX=clang++",
"CFLAGS": "-Oz",
"LDFLAGS: "-Wl,--no-undefined -lm",
"QMAKEFLAGS="-config release",
"MAKEFLAGS": "-s",
"TESTARGS": "-silent"
}',
},
{ "name": "linux-g++",
"flags":
'{ "QMAKESPEC": "linux-g++",
"EVAL": "CC=gcc && CXX=g++",
"CFLAGS": "-Os",
"LDFLAGS": "-Wl,--no-undefined -lm",
"QMAKEFLAGS": "-config release",
"QT_NO_CPU_FEATURE":"rdrnd"
}'
}
]
include:
- os: macos-latest
build_cfg: { "name": "clang",
"flags":
'{ "QMAKESPEC": "macx-clang",
"CFLAGS": "-Oz",
"QMAKEFLAGS": "-config debug",
"MAKEFLAGS": "-s",
"TESTARGS": "-silent",
"PATH": "/usr/local/opt/qt5/bin:$PATH"
}'
}
# 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@v4
- name: install Linux software
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
doxygen \
jq \
libfuntools-dev \
libqt5core5a \
valgrind \
qt5-qmake-bin
- name: install macOS software
if: matrix.os == 'macos-latest'
run: |
# Doxygen 1.9.7 is broken with ifdefs again, install 1.9.4 which works.
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/41828ee36b96e35b63b2a4c8cfc2df2c3728944a/Formula/doxygen.rb
brew install doxygen.rb
rm doxygen.rb
brew install jq qt5
# Valgrind takes a long time to build, so put in a separate step
# to make it easy to disable.
- name: install macOS valgrind
if: matrix.os == 'macos-latest'
run: |
# 3 cores on CI runners, so use make -j6 for homebrew.
export HOMEBREW_MAKE_JOBS=6
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
# Install in /usr/bin so the ccache action gets the expected environment.
- name: install ccache
if: matrix.os == 'ubuntu-latest'
run: |
wget -nv https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3-linux-x86_64.tar.xz
sudo tar xf ccache-4.8.3-linux-x86_64.tar.xz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.8.3-linux-x86_64/ccache
rm -f ccache-*-linux-x86_64.tar.xz
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.10
with:
key: compilation-${{ matrix.os }}-${{ matrix.build_cfg.QMAKESPEC }}
max-size: 160M
- name: Execute tests
run: |
set -x
PATH=`echo /opt/qt*/bin`:$PATH
export PATH=/usr/lib/qt5/bin:$PATH
eval $(echo '${{ matrix.build_cfg.flags }}' | jq -r 'to_entries[] | "\(.key)=\"\(.value)\""')
eval "$EVAL"
make OUT=outfile.txt -s -f Makefile.configure configure | tee .config
make -k \
CFLAGS="$CFLAGS -march=native -g1 -Wall -Wextra -Werror" \
CPPFLAGS="-DNDEBUG -DCBOR_ENCODER_WRITER_CONTROL=-1 -DCBOR_PARSER_READER_CONTROL=-1" \
lib/libtinycbor.a
size lib/libtinycbor.a | tee sizes
make -s clean
make -k \
CFLAGS="$CFLAGS -O0 -g" \
LDFLAGS="$LDFLAGS" ${LDLIBS+LDLIBS="$LDLIBS"}
grep -q freestanding-pass .config || make \
QMAKEFLAGS="$QMAKEFLAGS QMAKE_CXX=$CXX" \
tests/Makefile
grep -q freestanding-pass .config || \
(cd tests && make TESTARGS=-silent check -k \
TESTRUNNER=`which valgrind 2>/dev/null`)
make -s clean
! [ $BUILD_DOCS ] || ./scripts/update-docs.sh