commit 83cbb5291378ba0d19c0f4651b75941d790e8b1b
parent 487ddce0c04e1e9401bfedd97821e8a70c516756
Author: finwo <finwo@pm.me>
Date: Thu, 24 Sep 2026 20:35:21 +0200
Testing pipeline
Diffstat:
2 files changed, 64 insertions(+), 22 deletions(-)
diff --git a/.conductor.yml b/.conductor.yml
@@ -0,0 +1,36 @@
+version: 1
+
+defaults:
+ image: debian:bookworm-slim
+ timeout: 30m
+ env:
+ DEBIAN_FRONTEND: noninteractive
+ DEP_REF: main
+
+tasks:
+ test:
+ script:
+ - apt-get update -qq
+ - "apt-get install -y -qq --no-install-recommends build-essential binutils ca-certificates curl git libcurl4-openssl-dev openssl netcat-openbsd util-linux"
+ - curl -fsSL "https://git.finwo.net/app/dep/archives/heads/$DEP_REF.tar.gz" -o /tmp/dep.tar.gz
+ - mkdir -p /tmp/depsrc && tar -xzf /tmp/dep.tar.gz -C /tmp/depsrc --strip-components=1
+ - make -C /tmp/depsrc CC=gcc
+ - install -m0755 /tmp/depsrc/dep /usr/local/bin/dep
+ # test_plugin, test_resp and test_auth SKIP without this, so check it
+ # rather than reporting green on a run that tested almost nothing.
+ - "unshare -Urn true || { echo 'FATAL: user namespaces unavailable' >&2; exit 1; }"
+ - make
+ - ./tests/run.sh
+
+ plugin-bcm:
+ timeout: 15m
+ script:
+ - apt-get update -qq
+ - "apt-get install -y -qq --no-install-recommends build-essential binutils ca-certificates curl git libcurl4-openssl-dev"
+ - curl -fsSL "https://git.finwo.net/app/dep/archives/heads/$DEP_REF.tar.gz" -o /tmp/dep.tar.gz
+ - mkdir -p /tmp/depsrc && tar -xzf /tmp/dep.tar.gz -C /tmp/depsrc --strip-components=1
+ - make -C /tmp/depsrc CC=gcc
+ - install -m0755 /tmp/depsrc/dep /usr/local/bin/dep
+ # Linking needs an OpenBCM SDK; compiling still catches RESP breakage.
+ - cd plugins/bcm && dep install
+ - cd plugins/bcm && gcc -Wall -Wextra -Werror -Ilib/.dep/include -Isrc -c src/main.c -o /dev/null
diff --git a/tests/unit/test_ascii.sh b/tests/unit/test_ascii.sh
@@ -1,10 +1,6 @@
#!/bin/sh
-# Sources and docs stay pure ASCII.
-#
-# Typographic characters (em-dashes, curly quotes) arrive invisibly via copy
-# paste and editor autocorrect, then show up as mojibake on a serial console
-# with no locale. Checking untracked files too is deliberate: the usual way
-# this regresses is a file that has not been committed yet.
+# Sources and docs stay pure ASCII. Em-dashes and curly quotes arrive via copy
+# paste and show up as mojibake on a serial console with no locale.
set -eu
HERE=$(cd "$(dirname "$0")" && pwd)
ROOT=$(cd "${HERE}/../.." && pwd)
@@ -12,22 +8,32 @@ ROOT=$(cd "${HERE}/../.." && pwd)
echo "==> test_ascii: source and docs are pure ASCII"
cd "${ROOT}"
-check() {
- # check <label> <file-list-command>
- bad=$(eval "$2" | while read -r f; do
- [ -f "$f" ] || continue
- case "$f" in build/*|*.png|*.gz|*.img|*.bin) continue ;; esac
- if LC_ALL=C grep -nP '[^\x00-\x7F]' "$f" 2>/dev/null | head -3 | sed "s|^|${f}:|"; then :; fi
- done)
- if [ -n "${bad}" ]; then
- echo "FAIL: non-ASCII bytes in $1:" >&2
- printf '%s\n' "${bad}" | head -10 >&2
- return 1
- fi
- echo "PASS: no non-ASCII in $1"
-}
+# Walks the tree rather than asking git: CI delivers a tarball of the commit,
+# with no repository, so `git ls-files` would fail there and report nothing
+# wrong.
+files=$(find . \
+ -path ./build -prune -o \
+ -path ./.git -prune -o \
+ -name lib -prune -o \
+ -type f \( -name '*.c' -o -name '*.h' -o -name '*.sh' -o -name '*.md' \
+ -o -name 'Makefile' -o -name '*.mk' -o -name '*.cnf' \
+ -o -name '*.yml' -o -name '.dep' \) -print)
-check "tracked sources" "git ls-files"
-check "untracked sources" "git ls-files --others --exclude-standard"
+[ -n "${files}" ] || { echo "FAIL: found no files to check" >&2; exit 1; }
+echo "checking $(printf '%s\n' "${files}" | wc -l) files"
+
+bad=''
+for f in ${files}; do
+ hit=$(LC_ALL=C grep -nP '[^\x00-\x7F]' "$f" 2>/dev/null | head -3 | sed "s|^|${f}:|" || true)
+ [ -n "${hit}" ] && bad="${bad}${hit}
+"
+done
+
+if [ -n "${bad}" ]; then
+ echo "FAIL: non-ASCII bytes found:" >&2
+ printf '%s' "${bad}" | head -10 >&2
+ exit 1
+fi
+echo "PASS: no non-ASCII in sources"
echo "==> test_ascii done"