Merge pull request 'Add Gitea Actions CI for all branches' (#2) from ci/gitea-actions into main
CI / Unit tests (push) Successful in 4s

Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
patrick committed 2026-10-15 00:53:40 +00:00
commit 02ca338eb7
2 files changed
+47

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
name: CI
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
workflow_dispatch:
jobs:
test:
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
uses: https://github.com/actions/checkout@v4
with:
persist-credentials: false
- name: Show Python version
run: python3 --version
- name: Run unit tests
run: python3 -m unittest discover -s tests -v
+16
View File
@@ -258,6 +258,22 @@ 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.
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
Configuration precedence: