Add Gitea CI workflow
This commit is contained in:
@@ -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
|
||||||
@@ -159,6 +159,14 @@ journalctl -u pve-cloud-backup-web.service -u pve-cloud-backup-worker.service --
|
|||||||
|
|
||||||
## Validation commands
|
## 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:
|
Backend tests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -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.
|
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
|
## Updates
|
||||||
|
|
||||||
After pulling new code, apply it with:
|
After pulling new code, apply it with:
|
||||||
|
|||||||
Reference in New Issue
Block a user