Add Gitea Actions pipeline that builds and publishes the image
Some checks failed
build / container (push) Failing after 14s
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:
8
Makefile
8
Makefile
@@ -5,10 +5,11 @@ CONFIG ?= config.json
|
||||
IMAGE ?= opds-from-rss:latest
|
||||
PYTHON ?= python3
|
||||
|
||||
.PHONY: help test run check demo demo-up demo-down build up down logs shell hash-password lint clean
|
||||
.PHONY: help test test-docker run check demo demo-up demo-down build up down logs shell hash-password lint clean
|
||||
|
||||
help:
|
||||
@echo "make test run the test suite (no dependencies needed)"
|
||||
@echo "make test-docker run the suite inside the build (what CI gates on)"
|
||||
@echo "make run run the server locally with $(CONFIG)"
|
||||
@echo "make check validate $(CONFIG) and print the effective settings"
|
||||
@echo "make hash-password print the sha256 digest for auth.users[].password_sha256"
|
||||
@@ -25,6 +26,11 @@ help:
|
||||
test:
|
||||
$(PYTHON) -m unittest discover -s tests -t . -v
|
||||
|
||||
# The same suite, run the way the CI pipeline runs it. The Dockerfile's
|
||||
# test stage is what gates the published image, so this checks that gate.
|
||||
test-docker:
|
||||
docker build --target test .
|
||||
|
||||
lint:
|
||||
$(PYTHON) -m compileall -q app tests tools
|
||||
@echo "sources compile cleanly"
|
||||
|
||||
Reference in New Issue
Block a user