From 83e93a5b73ee34c868cb9f27e5f9f401fe422406 Mon Sep 17 00:00:00 2001 From: AnnsAnn Date: Tue, 12 Nov 2024 10:26:59 +0100 Subject: [PATCH] ci: Add tests for examples folder examples/readme: add missing entries examples: document examples with no readme --- dist/tools/ci/static_tests.sh | 2 ++ dist/tools/examples_check/check_has_readme.sh | 27 +++++++++++++++++ dist/tools/examples_check/check_in_readme.sh | 30 +++++++++++++++++++ examples/README.md | 23 ++++++++++++++ examples/gcoap_fileserver/README.md | 3 ++ examples/pio_blink/README.md | 3 ++ examples/senml_saul/README.md | 3 ++ 7 files changed, 91 insertions(+) create mode 100755 dist/tools/examples_check/check_has_readme.sh create mode 100755 dist/tools/examples_check/check_in_readme.sh create mode 100644 examples/gcoap_fileserver/README.md create mode 100644 examples/pio_blink/README.md create mode 100644 examples/senml_saul/README.md diff --git a/dist/tools/ci/static_tests.sh b/dist/tools/ci/static_tests.sh index 869b607dc6..f13dcb5e2d 100755 --- a/dist/tools/ci/static_tests.sh +++ b/dist/tools/ci/static_tests.sh @@ -129,6 +129,8 @@ run ./dist/tools/feature_resolution/check.sh run ./dist/tools/boards_supported/check.sh run ./dist/tools/codespell/check.sh run ./dist/tools/cargo-checks/check.sh +run ./dist/tools/examples_check/check_has_readme.sh +run ./dist/tools/examples_check/check_in_readme.sh if [ -z "${GITHUB_RUN_ID}" ]; then run ./dist/tools/uncrustify/uncrustify.sh --check else diff --git a/dist/tools/examples_check/check_has_readme.sh b/dist/tools/examples_check/check_has_readme.sh new file mode 100755 index 0000000000..dfd396b4cc --- /dev/null +++ b/dist/tools/examples_check/check_has_readme.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Path to the examples directory +EXAMPLES_DIR="$(dirname "$0")/../../../examples" + +# Get a list of all directories in the examples directory +directories=$(find "$EXAMPLES_DIR" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;) + +# Check each directory +missing_entries=() +for dir in $directories; do + if [ ! -f "$EXAMPLES_DIR/$dir/README.md" ]; then + missing_entries+=("$dir") + fi +done + +# Report missing entries +if [ ${#missing_entries[@]} -eq 0 ]; then + echo "All examples have a README" + exit 0 +else + echo "The following directories are missing a README:" + for entry in "${missing_entries[@]}"; do + echo "- $entry" + done + exit 1 +fi diff --git a/dist/tools/examples_check/check_in_readme.sh b/dist/tools/examples_check/check_in_readme.sh new file mode 100755 index 0000000000..6a50920af5 --- /dev/null +++ b/dist/tools/examples_check/check_in_readme.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Path to the examples directory +EXAMPLES_DIR="$(dirname "$0")/../../../examples" + +# Path to the README.md file +README_FILE="$EXAMPLES_DIR/README.md" + +# Get a list of all directories in the examples directory +directories=$(find "$EXAMPLES_DIR" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;) + +# Check each directory +missing_entries=() +for dir in $directories; do + if ! grep -q "$dir" "$README_FILE"; then + missing_entries+=("$dir") + fi +done + +# Report missing entries +if [ ${#missing_entries[@]} -eq 0 ]; then + echo "All directories are listed in the README.md file." + exit 0 +else + echo "The following directories are missing in the README.md file:" + for entry in "${missing_entries[@]}"; do + echo "- $entry" + done + exit 1 +fi diff --git a/examples/README.md b/examples/README.md index f8c6149f97..e8f7076f33 100644 --- a/examples/README.md +++ b/examples/README.md @@ -74,6 +74,8 @@ Here is a quick overview of the examples available in the RIOT: - [gcoap_fileserver](./gcoap_fileserver/README.md) - This example demonstrates the usage of the `gcoap` module to serve files over CoAP. +- [gcoap_dtls](./gcoap_dtls/README.md) + - This example demonstrates the usage of the `gcoap` module with DTLS. - [nanocoap_server](./nanocoap_server/README.md) - This example demonstrates the usage of the `nanocoap` module, a high-level API for CoAP (Constrained Application Protocol) messaging. @@ -145,6 +147,7 @@ Here is a quick overview of the examples available in the RIOT: ### Misc +<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Updated upstream - [lorawan](./lorawan/README.md) - This application shows a basic LoRaWAN use-case with RIOT. - [openthread](./openthread/README.md) @@ -163,6 +166,22 @@ Here is a quick overview of the examples available in the RIOT: - [sniffer](./sniffer/README.md) - This application is built to run together with the script `./tools/sniffer.py` as a sniffer for (wireless) data traffic. +- [benckmark_udp](./benchmark_udp/README.md) + - This example uses the `benchmark_udp` module to create a stress-test for the RIOT network stack. +==================================================================================================== +| Example | Description | +|---------|-------------| +| [lorawan](./lorawan/README.md) | This application shows a basic LoRaWAN use-case with RIOT. | +| [openthread](./openthread/README.md) | This example demonstrates the usage of the OpenThread stack in RIOT. | +| [lwm2m](./lwm2m/README.md) | Example of a LWM2M client on RIOT | +| [ccn-lite-relay](./ccn-lite-relay/README.md) | This application demonstrates how to use the Content-Centric Networking stack from [CCN-Lite](http://www.ccn-lite.net/) on RIOT | +| [telnet_server](./telnet_server/README.md) | Simple telnet server that listens on port 23 over IPv6. | +| [posix_sockets](./posix_sockets/README.md) | Showcase for RIOT's POSIX socket support | +| [spectrum-scanner](./spectrum-scanner/README.md) | This example demonstrates how to monitor energy levels on all available wireless channels | +| [sniffer](./sniffer/README.md) | This application is built to run together with the script `./tools/sniffer.py` as a sniffer for (wireless) data traffic. | +| [benckmark_udp](./benchmark_udp/README.md) | This example uses the `benchmark_udp` module to create a stress-test for the RIOT network stack. | +| [sock_tcp_echo](./sock_tcp_echo/README.md) | This is a simple TCP echo server / client that uses the SOCK API. | +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Stashed changes ## Advanced Examples @@ -188,3 +207,7 @@ Here is a quick overview of the examples available in the RIOT: - This example allows testing different two-way ranging algorithms between two boards supporting a dw1000 device. This makes use of the uwb-core pkg. +- [senml_saul](./senml_saul/README.md) + - This example demonstrates the usage of the SAUL (Sensor Actuator Uber Layer) module with the SenML (Sensor Measurement Lists) format. +- [opendsme](./opendsme/README.md) + - This example demonstrates the usage of the OpenDSME module in RIOT. diff --git a/examples/gcoap_fileserver/README.md b/examples/gcoap_fileserver/README.md new file mode 100644 index 0000000000..ecdc413fa4 --- /dev/null +++ b/examples/gcoap_fileserver/README.md @@ -0,0 +1,3 @@ +# GCoAP Fileserver + +This example demonstrates how to create a CoAP server that serves files from the filesystem. diff --git a/examples/pio_blink/README.md b/examples/pio_blink/README.md new file mode 100644 index 0000000000..309645782d --- /dev/null +++ b/examples/pio_blink/README.md @@ -0,0 +1,3 @@ +# RaspberryPi Pico PIO Blink + +This example demonstrates how to use the PIO peripheral on the RaspberryPi Pico to blink an LED. The PIO peripheral is a programmable I/O block that can be used to implement custom digital interfaces that work at extremely high speeds. diff --git a/examples/senml_saul/README.md b/examples/senml_saul/README.md new file mode 100644 index 0000000000..5ce5ccc32f --- /dev/null +++ b/examples/senml_saul/README.md @@ -0,0 +1,3 @@ +# senml_saul + +This example demonstrates the usage of the SAUL (Sensor Actuator Uber Layer) module with the SenML (Sensor Measurement Lists) format.