From f5997b47d9809896ed8cf122186454fbfeb408d1 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 15 Jul 2026 01:10:59 +0200 Subject: [PATCH] Add Gitea CI workflow --- .gitea/workflows/ci.yml | 74 +++++++++++++++++++++++++++++++++++++++++ AGENTS.md | 8 +++++ README.md | 21 ++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..11ddf6b --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,74 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + backend: + name: Backend tests + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: pip + cache-dependency-path: backend/requirements.txt + + - name: Install backend dependencies + working-directory: backend + run: | + python -m venv .venv + . .venv/bin/activate + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run backend tests + working-directory: backend + run: | + . .venv/bin/activate + pytest + + frontend: + name: Frontend build + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install frontend dependencies + working-directory: frontend + run: npm ci + + - name: Build frontend + working-directory: frontend + run: npm run build + + scripts: + name: Script syntax + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Check shell scripts + run: bash -n scripts/*.sh diff --git a/AGENTS.md b/AGENTS.md index b522565..2ace3c4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -159,6 +159,14 @@ journalctl -u pve-cloud-backup-web.service -u pve-cloud-backup-worker.service -- ## Validation commands +CI workflow: + +```text +.gitea/workflows/ci.yml +``` + +The workflow is for Gitea Actions and runs backend tests, frontend build, and shell script syntax checks. It uses setup-action package caching for pip and npm, keyed from `backend/requirements.txt` and `frontend/package-lock.json`. + Backend tests: ```bash diff --git a/README.md b/README.md index 69d4a3c..3a0c0f7 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,27 @@ Optional environment variables: The script creates a disabled backup job and, by default, queues it once. Only run it when you intentionally want a real Proxmox backup and rclone upload. +## CI + +Gitea Actions workflow: + +```text +.gitea/workflows/ci.yml +``` + +It runs on pushes and pull requests to `main` and can also be started manually. The workflow checks: + +- backend dependency install and pytest; +- frontend dependency install and production build; +- shell script syntax. + +Package caches are enabled through the Gitea Actions cache-compatible setup actions: + +- Python/pip cache keyed by `backend/requirements.txt`; +- npm cache keyed by `frontend/package-lock.json`. + +The Gitea runner must have action cache support configured for cache restore/save to work. + ## Updates After pulling new code, apply it with: