|
# Gitea CI Setup — Nimcheck
|
|
|
|
This repo runs CI through **Gitea Actions** (compatible with GitHub Actions workflow syntax). Workflows live in `.gitea/workflows/`.
|
|
|
|
---
|
|
|
|
## Repository settings
|
|
|
|
| Setting | Value |
|
|
|---------|-------|
|
|
| **Default branch** | `master` |
|
|
| **Remote URL** | `https://retoor.molodetz.nl/retoor/nimcheck.git` |
|
|
| **Workflow file** | `.gitea/workflows/ci.yml` |
|
|
|
|
If you create the repo fresh on Gitea, set **Default Branch** to `master` under **Settings → Repository → Default Branch**. The CI workflow already triggers on `master`; `main` and `develop` are also accepted for compatibility.
|
|
|
|
---
|
|
|
|
## Required: act_runner
|
|
|
|
CI jobs use `runs-on: ubuntu-latest`. You need a Gitea **act_runner** registered to your instance with that label.
|
|
|
|
### 1. Install act_runner (on a Linux host)
|
|
|
|
Follow [Gitea act_runner docs](https://docs.gitea.com/usage/actions/act-runner):
|
|
|
|
```bash
|
|
# Example: download release binary, register with your instance
|
|
./act_runner register --instance https://retoor.molodetz.nl --token <REGISTRATION_TOKEN>
|
|
./act_runner daemon
|
|
```
|
|
|
|
Get the registration token from: **Site Administration → Actions → Runners** (or repo-level if enabled).
|
|
|
|
### 2. Verify runner labels
|
|
|
|
The runner must expose `ubuntu-latest` (default for many setups). Check in Gitea UI: **Settings → Actions → Runners**.
|
|
|
|
### 3. Enable Actions on the repo
|
|
|
|
**Repository → Settings → Actions** — ensure workflows are enabled.
|
|
|
|
---
|
|
|
|
## Pipeline overview
|
|
|
|
```
|
|
push/PR to master (or main/develop)
|
|
│
|
|
▼
|
|
┌───────┐
|
|
│ lint │ nim c --hints:on --warnings:on
|
|
└───┬───┘
|
|
▼
|
|
┌───────┐
|
|
│ test │ matrix: Nim 2.0.8 + stable
|
|
└───┬───┘
|
|
▼
|
|
┌───────┐
|
|
│ build │ release binary → artifact (7 days)
|
|
└───────┘
|
|
|
|
┌──────────┐
|
|
│ coverage │ manual / master only (optional)
|
|
└──────────┘
|
|
```
|
|
|
|
| Job | Trigger | What it does |
|
|
|-----|---------|--------------|
|
|
| `lint` | Every push/PR | Compile with all hints/warnings (`make lint`) |
|
|
| `test` | After lint | Full suite on Nim 2.0.8 and stable (`make test`) |
|
|
| `build` | After lint+test | Release build, upload `bin/nimcheck` artifact |
|
|
| `coverage` | Manual dispatch or push to `master` | Instrumented tests (optional, needs nimcoverage) |
|
|
|
|
Concurrency: one run per branch; newer pushes cancel in-progress runs.
|
|
|
|
---
|
|
|
|
## Branch policy
|
|
|
|
| Branch | Role |
|
|
|--------|------|
|
|
| `master` | **Production default** — merge here; CI must be green |
|
|
| `develop` | Optional integration branch (CI runs) |
|
|
| `main` | Alias support in CI only; not the repo default today |
|
|
|
|
### Typical workflow
|
|
|
|
```bash
|
|
git checkout master
|
|
git pull origin master
|
|
# ... work ...
|
|
git checkout -b feature/my-change
|
|
# commit, push
|
|
# Open PR → master on Gitea
|
|
# Merge when CI green
|
|
```
|
|
|
|
---
|
|
|
|
## Caching
|
|
|
|
CI caches:
|
|
|
|
- `~/.choosenim` — Nim toolchain per version
|
|
- `~/.nimble` — nimble packages (keyed on `nimcheck.nimble`)
|
|
|
|
First run is slower; subsequent runs reuse caches.
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
| Problem | Fix |
|
|
|---------|-----|
|
|
| Workflow never starts | Enable Actions; check act_runner is online |
|
|
| `runs-on: ubuntu-latest` no runner | Register runner with that label |
|
|
| `make: command not found` | Runner image must include `make` (ubuntu images do) |
|
|
| choosenim download fails | Runner needs outbound HTTPS to nim-lang.org |
|
|
| Tests timeout | Full suite ~15s; increase job timeout if runner is slow |
|
|
| Coverage job fails | Expected if `nimcoverage` unavailable — job uses `\|\| true` |
|
|
|
|
### Re-run CI manually
|
|
|
|
**Actions → CI → Run workflow** (workflow_dispatch).
|
|
|
|
---
|
|
|
|
## Local parity with CI
|
|
|
|
```bash
|
|
make lint
|
|
make test
|
|
make build
|
|
```
|
|
|
|
If these pass locally, CI should pass on `ubuntu-latest` with Nim stable.
|
|
|
|
---
|
|
|
|
## Artifacts
|
|
|
|
The `build` job uploads `nimcheck-<os>-<sha>` containing `bin/nimcheck`. Download from the workflow run page in Gitea (retention: 7 days). |