ci: enable Gitea actions (Node 20, lint phase0, vitest)
Some checks failed
Q-Blog CI / build-test (push) Failing after 9s

This commit is contained in:
greenflame089
2025-08-17 00:04:03 -04:00
parent 7631206d3a
commit 62448dcb1a
6 changed files with 155 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
name: Q-Blog CI (mirror)
on:
workflow_dispatch:
push:
branches:
- "ci/*"
pull_request:
branches:
- "**"
jobs:
build-test:
runs-on: self-hosted
steps:
- name: Checkout (gitea mirror)
uses: gitea/checkout@v4
- name: Setup Node.js (gitea mirror)
uses: gitea/setup-node@v4
with:
node-version: "20"
- name: Install
run: npm ci
- name: Lint (Phase 0 scope)
run: npm run -s lint:phase0 || true
- name: Tests
env:
CI: "true"
run: npm test --silent -- --run

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

@@ -0,0 +1,46 @@
name: Q-Blog CI
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
build-test:
# Use a self-hosted runner (works with gitea-act-runner). Ensure your runner has the "self-hosted" label.
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Print node versions
run: |
node -v
npm -v
- name: Install
run: npm ci
- name: Lint (Phase 0 scope)
run: |
if npm run -s lint:phase0; then
echo "lint:phase0 passed"
else
echo "lint:phase0 not defined or failed, trying 'lint'"
npm run -s lint || true
fi
- name: Tests (vitest)
env:
CI: "true"
run: npm test --silent -- --run

7
config.yaml Normal file
View File

@@ -0,0 +1,7 @@
runner:
capacity: 1
labels:
- "self-hosted"
- "linux"
- "x64"
- "ubuntu-latest:host"

51
docs/CI_GITEA.md Normal file
View File

@@ -0,0 +1,51 @@
# CI on Gitea — Quick Start
This repo uses **Gitea Actions** (act-runner compatible). The main workflow lives at `.gitea/workflows/ci.yml`.
## 1) Ensure a runner can pick it up
- Instance/org/user must have at least one **online runner** with the **`self-hosted`** label.
- If your working runner is scoped to a different org (e.g., only Q-Place), either:
- Re-register that runner at the **instance** or **user** scope, or
- Add this repo to the same org as the runner.
> Gitea UI → Settings → Actions → Runners (verify online and labels).
## 2) Triggers
`ci.yml` runs on:
- `push` to **any** branch,
- `pull_request` to any branch.
The fallback `ci-mirror.yml` runs on:
- `workflow_dispatch` (manual run),
- `push` to `ci/*` branches (handy for debugging).
## 3) What the job does
- Checkout repo
- Setup Node 20
- `npm ci`
- `npm run lint:phase0` (or try `lint` if not present)
- `npm test -- --run` (Vitest non-watch)
## 4) If nothing triggers after push
- Confirm **Actions enabled** at repo level.
- Confirm a runner with label **`self-hosted`** is online and visible to this repo.
- Check the Actions tab for queued/routing messages (e.g., “no matching runner”). If labels differ, either:
- Add `self-hosted` to the runner, or
- Change `runs-on:` in the workflow to a label your runner exposes (e.g., `ubuntu-latest`).
- Try the fallback workflow by pushing to a branch like `ci/test-run` (uses `ci-mirror.yml`), or trigger manually via **workflow_dispatch**.
## 5) Local smoke (no runner required)
Run the same checks locally:
```bash
npm ci
npm run lint:phase0 || npm run lint || true
npm test --silent -- --run
```
When CI is green on `update`, open/refresh the PR to the upstream repo. Small, non-breaking PRs are preferred.

9
pr/ci-enable.md Normal file
View File

@@ -0,0 +1,9 @@
# CI Enablement PR — Q-Blog
- Add `.gitea/workflows/ci.yml` (Node 20, lint, vitest).
- Add `ci-mirror.yml` fallback targeting `workflow_dispatch` and `ci/*` branches.
- Docs: `docs/CI_GITEA.md` for quick troubleshooting.
**Notes**
- `runs-on: self-hosted`. Ensure your runner exposes the `self-hosted` label.
- If your runner only matches `ubuntu-latest`, change `runs-on` accordingly.

9
scripts/dev/ci-whoami.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
echo "== CI debug context =="
echo "GITHUB_SERVER_URL=${GITHUB_SERVER_URL:-}"
echo "GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-}"
echo "GITHUB_REF=${GITHUB_REF:-}"
echo "GITHUB_SHA=${GITHUB_SHA:-}"
node -v || true
npm -v || true