Add Gitea Actions CI: tests on Python 3.10-3.13 and shellcheck
CI / tests (Python 3.10) (pull_request) Failing after 4s
CI / tests (Python 3.11) (pull_request) Failing after 4s
CI / tests (Python 3.12) (pull_request) Failing after 3s
CI / tests (Python 3.13) (pull_request) Failing after 3s
CI / lint (pull_request) Successful in 4s

The matrix covers the Python versions on Ubuntu 22.04/24.04 and Debian
12/13. make lint now includes deploy.sh, and its token check is
rewritten as an if statement to satisfy shellcheck SC2015.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Opus 5.5 committed 2026-10-17 15:26:50 -04:00
1 parent c0b3ff991c
commit 792161edaa
4 files changed
+47 -3

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
name: tests (Python ${{ matrix.python }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Ubuntu 22.04, Debian 12, Ubuntu 24.04, Debian 13
python: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: python3 --version
- run: make test
lint:
runs-on: ubuntu-latest
env:
SHELLCHECK_VERSION: v0.10.0
steps:
- uses: actions/checkout@v4
- name: Install shellcheck
run: |
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" \
| tar -xJ -C /tmp
echo "/tmp/shellcheck-${SHELLCHECK_VERSION}" >> "$GITHUB_PATH"
- run: shellcheck --version
- run: make lint
+1 -1
View File
@@ -4,4 +4,4 @@ test:
python3 -m unittest discover -s tests python3 -m unittest discover -s tests
lint: lint:
shellcheck agent/kernelwatch-agent agent/install.sh server/install.sh server/kernelwatch.sh shellcheck agent/kernelwatch-agent agent/install.sh agent/deploy.sh server/install.sh server/kernelwatch.sh
+4
View File
@@ -393,6 +393,10 @@ make test # unit + integration tests (stdlib unittest)
make lint # shellcheck, if available make lint # shellcheck, if available
``` ```
Gitea Actions (`.gitea/workflows/ci.yml`) runs both on every push to `main`
and every pull request: the tests on Python 3.10–3.13 (the versions on the
supported Ubuntu and Debian releases) and shellcheck on the shell scripts.
The tests run a real server on an ephemeral port. They also run the real agent The tests run a real server on an ephemeral port. They also run the real agent
script against stubbed `dpkg-query`/`apt-get`/`needrestart`/`uname` and a fake script against stubbed `dpkg-query`/`apt-get`/`needrestart`/`uname` and a fake
filesystem root (`KERNELWATCH_ROOT`), including one end-to-end agent → server filesystem root (`KERNELWATCH_ROOT`), including one end-to-end agent → server
+5 -2
View File
@@ -126,8 +126,11 @@ deploy_one() {
if [[ $mode != upgrade ]]; then if [[ $mode != upgrade ]]; then
# 2. Get a token from the dashboard and hand it over on stdin, never argv. # 2. Get a token from the dashboard and hand it over on stdin, never argv.
say " $mode $name on $DASHBOARD" say " $mode $name on $DASHBOARD"
token=$(fetch_token "$name" | tr -d '[:space:]') && [[ -n $token ]] || if ! token=$(fetch_token "$name" | tr -d '[:space:]') || [[ -z $token ]]; then
{ echo " could not get a token for $name" >&2; cleanup; return 1; } echo " could not get a token for $name" >&2
cleanup
return 1
fi
printf '%s\n' "$token" | ssh -T "$target" "umask 077 && cat > '$dir/token'" || printf '%s\n' "$token" | ssh -T "$target" "umask 077 && cat > '$dir/token'" ||
{ cleanup; return 1; } { cleanup; return 1; }
install+=(--server "$SERVER_URL" --token-file "$dir/token") install+=(--server "$SERVER_URL" --token-file "$dir/token")