Add Gitea Actions pipeline that builds and publishes the image
Some checks failed
build / container (push) Failing after 14s

Runs on pushes to master, tag pushes and pull requests:

  * the Dockerfile's new `test` stage runs the whole suite, so a failing
    test stops the image from being built or pushed at all
  * the image builds with plain docker rather than the buildx and login
    actions, so a job never has to reach the internet to fetch third-party
    actions -- the most common way a self-hosted runner fails
  * it pushes to this instance's registry, deriving the host from
    github.server_url instead of hardcoding it

Tags published: `latest` and the branch or tag name (only master moves
`latest`), plus an immutable sha-<short> so an image can be traced back to
its commit.  Pull requests build but never push, so a fork cannot publish
into the registry.

Two things the gate caught once it ran inside a container:

  * the suite reads config.example.json from the repository root, a hidden
    dependency that would have failed the first pipeline run
  * `[ "$ref_name" = "$DEFAULT_BRANCH" ]` under `set -u` would have aborted
    every branch build if that env key were ever renamed; it now has an
    inline fallback

`make test-docker` runs the same gate locally, and README.md documents what
the runner needs: docker reachable from the job, and a token allowed to
write packages.

Also untrack .pi/, which holds pi session task output rather than project
files, and ignore it.
This commit is contained in:
2026-11-15 18:20:36 -05:00
parent b76aea2899
commit 577b29db39
7 changed files with 261 additions and 106 deletions

View File

@@ -191,6 +191,63 @@ that on a network you trust.
service is directly reachable, so a spoofed `Host` header cannot shape the links
in the catalog.
## Continuous integration
`.gitea/workflows/build.yaml` runs on every push to `master`, on tags, and on
pull requests. It does three things:
1. **Gates on the test suite.** The Dockerfile's first stage runs all 276 tests, so
a failing test stops the image from being built or pushed at all.
2. **Builds with plain `docker`** rather than the buildx and login actions, so a
job never has to reach the internet to fetch third-party actions.
3. **Pushes to this Gitea instance's registry**, which lives on the same host as the
web UI:
```sh
docker pull git.clortox.com/tyler/rss-to-opds:latest
```
Tags published are `latest`, the branch or git tag name (only `master` moves
`latest`), and an immutable `sha-<short>` on every build, so any image can be traced
back to its commit. Pull requests build but never push, so a fork cannot publish
into the registry.
The same gate runs locally:
```sh
make test-docker # docker build --target test .
make test # the same suite, without docker
```
### Runner requirements
* **Docker must be usable from the job.** For a typical `act_runner` that means
giving the job container the host socket, in the runner's `config.yaml`:
```yaml
runner:
container:
options: "-v /var/run/docker.sock:/var/run/docker.sock"
```
Without it, the workflow's guard step fails with that instruction rather than a
confusing `docker: not found`.
* **The token must be allowed to write packages.** Gitea's automatic token usually
is. If a push is refused for permissions, create a personal access token with the
`write:package` scope and save it as the `REGISTRY_TOKEN` repository secret — the
workflow prefers that secret whenever it is set.
Two deliberate choices worth knowing about. The registry host is derived from
`github.server_url` instead of being hardcoded, so the workflow survives the
instance moving or the repository being forked; set a `CONTAINER_REGISTRY`
repository variable to point at a different registry. And `actions/checkout` is
referenced by tag rather than pinned to a commit SHA, which is the usual
convenience-for-reproducibility trade-off on a self-hosted runner. To pin it:
```sh
git ls-remote https://github.com/actions/checkout refs/tags/v4
```
## Development
```sh