File tree Expand file tree Collapse file tree 4 files changed +116
-0
lines changed
Expand file tree Collapse file tree 4 files changed +116
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Book examples
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+
10+ jobs :
11+ check-format :
12+ name : Check coding conventions
13+ runs-on : ubuntu-latest
14+ container :
15+ image : ghcr.io/cheriot-platform/devcontainer:latest
16+ options : --user 1001
17+ steps :
18+ - name : Checkout repository and submodules
19+ uses : actions/checkout@v4
20+ with :
21+ submodules : recursive
22+ - name : Generate compiler_commands.json files
23+ run : ./scripts/generate_compile_commands.sh
24+ - name : Run clang-format
25+ run : ./scripts/run_clang_format.sh /cheriot-tools/bin
26+
27+ build-test :
28+ name : Build-test examples
29+ runs-on : ubuntu-latest
30+ container :
31+ image : ghcr.io/cheriot-platform/devcontainer:latest
32+ options : --user 1001
33+ steps :
34+ - name : Checkout repository and submodules
35+ uses : actions/checkout@v4
36+ with :
37+ submodules : recursive
38+ - name : Build examples
39+ run : |
40+ set -e
41+ for example_dir in $PWD/examples/*/; do
42+ if [ -f $example_dir/xmake.lua ] ; then
43+ cd $example_dir
44+ echo Building $example_dir
45+ xmake f --sdk=/cheriot-tools/
46+ xmake
47+ fi
48+ done
49+
50+ all-checks :
51+ needs : [run-tests, check-format]
52+ runs-on : ubuntu-latest
53+ steps :
54+ - name : Dummy step
55+ run : true
Original file line number Diff line number Diff line change 1+ .xmake
2+ build /
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Generate compile commands files for all known projects in this repo
4+
5+
6+ . " $( dirname $0 ) " /../cheriot-rtos/scripts/common.sh
7+
8+ find_sdk $1
9+
10+ echo " Using SDK=$SDK "
11+
12+ # Generate compile_commands.json for all of the extra tests and examples.
13+ for dir in examples/* ; do
14+ if [ -f " $dir /xmake.lua" ] ; then
15+ echo Generating compile_commands.json for $dir
16+ (cd $dir && xmake f --sdk=" ${SDK} " && xmake project -k compile_commands)
17+ fi
18+ done
19+
20+ # Generate the top-level compile-commands.json
21+ cd cheriot-rtos/tests && xmake f --sdk=" ${SDK} " && xmake project -k compile_commands ..
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -eo pipefail
3+ if [ ! -d examples ] ; then
4+ echo Please run this script from the root of the CHERIoT book-examples repository.
5+ exit 1
6+ fi
7+ CLANG_TIDY=/cheriot-tools/bin/clang-tidy
8+ CLANG_FORMAT=/cheriot-tools/bin/clang-format
9+ if [ -n " $1 " ] ; then
10+ CLANG_TIDY=$1 /clang-tidy
11+ CLANG_FORMAT=$1 /clang-format
12+ fi
13+ if [ ! -x ${CLANG_TIDY} ] ; then
14+ echo Usage: $0 path/to/cheriot/tools/bin
15+ echo clang-tidy not found at ${CLANG_TIDY}
16+ exit 1
17+ fi
18+ if [ ! -x ${CLANG_FORMAT} ] ; then
19+ echo Usage: $0 path/to/cheriot/tools/bin
20+ echo clang-format not found at ${CLANG_FORMAT}
21+ exit 1
22+ fi
23+
24+ if which nproc ; then
25+ PARALLEL_JOBS=$( nproc)
26+ else
27+ PARALLEL_JOBS=$( sysctl -n kern.smp.cpus)
28+ fi
29+
30+
31+ # Exclude the two files generated by BearSSL from formatting.
32+ FILES=$( find examples -name ' *.h' -or -name ' *.hh' -or -name ' *.cc' -or -name ' *.c' | grep -v ' DigiCertGlobalRootG2' | grep -v mosquitto.org.h)
33+
34+ ${CLANG_FORMAT} -i ${FILES}
35+ if ! git diff --exit-code ${HEADERS} ${SOURCES} ; then
36+ echo clang-format applied changes
37+ exit 1
38+ fi
You can’t perform that action at this time.
0 commit comments