From b236611044bc3a31ea7930a421576aee442f6aa7 Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 14 Oct 2026 20:49:25 -0400 Subject: [PATCH 1/2] Add Gitea Actions CI for all branches --- .gitea/workflows/ci.yaml | 30 ++++++++++++++++++++++++++++++ README.md | 14 ++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .gitea/workflows/ci.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..5768a88 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: + - "**" + pull_request: + branches: + - "**" + workflow_dispatch: + +jobs: + test: + name: Unit tests + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Check out repository + uses: https://github.com/actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Python + uses: https://github.com/actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Run unit tests + run: python3 -m unittest discover -s tests -v diff --git a/README.md b/README.md index f8e0604..05451c0 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,20 @@ python3 agent.py --doctor --- +## Tests + +Run the unit tests from the repository root: + +```bash +python3 -m unittest discover -s tests -v +``` + +The tests use Python's standard library and mock external system commands. They do not require CrowdSec, `nftables`, elevated privileges, or additional Python packages. + +[Gitea Actions](.gitea/workflows/ci.yaml) runs the same command with Python 3.12 on an `ubuntu-latest` runner for pushes to any branch, pull requests targeting any branch, and manual runs. Repository Actions must be enabled and a runner with that label must be available. + +--- + ## Configuration Configuration precedence: -- 2.54.1 From 73d5112afe5402fcf49a42736106d4aa496fd9fc Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 14 Oct 2026 20:52:20 -0400 Subject: [PATCH 2/2] Fix CI Python setup with an explicit Ubuntu job image --- .gitea/workflows/ci.yaml | 9 +++++---- README.md | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 5768a88..8377722 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -14,6 +14,9 @@ jobs: name: Unit tests runs-on: ubuntu-latest timeout-minutes: 10 + # Runner labels do not guarantee the job's OS or installed tools in Gitea. + container: + image: ghcr.io/catthehacker/ubuntu:act-24.04 steps: - name: Check out repository @@ -21,10 +24,8 @@ jobs: with: persist-credentials: false - - name: Set up Python - uses: https://github.com/actions/setup-python@v5 - with: - python-version: "3.12" + - name: Show Python version + run: python3 --version - name: Run unit tests run: python3 -m unittest discover -s tests -v diff --git a/README.md b/README.md index 05451c0..a04ce3f 100644 --- a/README.md +++ b/README.md @@ -270,6 +270,8 @@ The tests use Python's standard library and mock external system commands. They [Gitea Actions](.gitea/workflows/ci.yaml) runs the same command with Python 3.12 on an `ubuntu-latest` runner for pushes to any branch, pull requests targeting any branch, and manual runs. Repository Actions must be enabled and a runner with that label must be available. +The job uses the `ghcr.io/catthehacker/ubuntu:act-24.04` container image, which includes Python 3.12 and Node.js for the checkout action. This makes the job environment independent of the image configured for the runner label and avoids downloading Python builds intended for GitHub-hosted runners. + --- ## Configuration -- 2.54.1