gitea support

This commit is contained in:
lehel 2025-10-01 17:03:09 +02:00
parent b55decb633
commit 3c3e3b7ae4
No known key found for this signature in database
GPG Key ID: 9C4F9D6111EE5CFA
3 changed files with 68 additions and 19 deletions

43
.gitea/workflows/ci.yml Normal file
View File

@ -0,0 +1,43 @@
name: CI
on:
push:
branches:
- main
- master
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
OPENAI_API_KEY: dummy
OPENAI_BASE_URL: http://localhost:11434/api/chat
OPENAI_MODEL: qwen3:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Go Env
run: go env
- name: Vet
run: go vet ./...
- name: Test
run: go test -count=1 ./...
- name: Build
run: go build -v ./...
- name: Display Go version
run: go version

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,7 @@ Lightweight veterinary visit reasoning helper with LLM-assisted keyword extracti
- Structured JSON outputs enforced using provider-supported response formats (Ollama `format`, OpenAI/OpenRouter `response_format: { type: json_object }`). - Structured JSON outputs enforced using provider-supported response formats (Ollama `format`, OpenAI/OpenRouter `response_format: { type: json_object }`).
- Integration tests using mock LLM & DB (no network dependency). - Integration tests using mock LLM & DB (no network dependency).
- GitHub Actions CI (vet, test, build). - GitHub Actions CI (vet, test, build).
- Gitea Actions CI parity (same steps mirrored under `.gitea/workflows/ci.yml`).
## Quick Start ## Quick Start
### 1. Clone & build ### 1. Clone & build
@ -77,6 +78,30 @@ All tests mock the LLM so no network is required.
## CI ## CI
GitHub Actions workflow at `.github/workflows/ci.yml` runs vet, tests, build on push/PR. GitHub Actions workflow at `.github/workflows/ci.yml` runs vet, tests, build on push/PR.
### Gitea Actions Support
A mirrored workflow exists at `.gitea/workflows/ci.yml` so self-hosted Gitea instances (with Actions/`act_runner`) execute the same pipeline:
- Triggers: push to `main` / `master`, pull requests, manual dispatch.
- Steps: checkout, Go setup (from `go-version-file`), vet, test, build.
- Default dummy env vars (override with repository secrets if needed).
To add real secrets in Gitea (names should match those used in code):
1. In the repository UI: Settings → Secrets → Actions (menu names may differ slightly by Gitea version).
2. Add `OPENAI_API_KEY` (optional for OpenRouter usage).
3. (Optional) Add `OPENAI_MODEL` / `OPENAI_BASE_URL` overrides if you want CI integration tests against a live endpoint (currently tests are mocked and do not require network access).
If you later add integration tests that call a real provider, modify the workflow:
```yaml
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_BASE_URL: https://openrouter.ai/api/v1/chat/completions
OPENAI_MODEL: meta-llama/llama-3.1-70b-instruct
```
Make sure rate limits and billing are acceptable before enabling real calls.
Runner notes:
- Ensure your Gitea Actions runner image includes Git and Go toolchain or relies on `actions/setup-go` (supported in newer Gitea releases with remote action fetching).
- If remote action fetching is restricted, vendor the actions by mirroring their repositories or replace with inline shell steps (fallback approach).
## Troubleshooting ## Troubleshooting
| Symptom | Cause | Fix | | Symptom | Cause | Fix |
|---------|-------|-----| |---------|-------|-----|
@ -102,4 +127,3 @@ If some models wrap JSON in text, a post-processor could strip code fences and r
## License ## License
(Choose and add a LICENSE file if planning to open source.) (Choose and add a LICENSE file if planning to open source.)