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.
78 lines
2.6 KiB
Makefile
78 lines
2.6 KiB
Makefile
# Deployment and development helpers. Nothing here needs any dependency beyond
|
|
# Python 3.11+ and, for the container targets, Docker.
|
|
|
|
CONFIG ?= config.json
|
|
IMAGE ?= opds-from-rss:latest
|
|
PYTHON ?= python3
|
|
|
|
.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"
|
|
@echo "make demo serve a built-in fake FreshRSS, for a smoke test"
|
|
@echo "make demo-up run the self-contained demo stack (catalogue + fake FreshRSS)"
|
|
@echo "make demo-down stop the demo stack"
|
|
@echo "make build build the container image"
|
|
@echo "make up / down start or stop the container via docker compose"
|
|
@echo "make logs follow the container logs"
|
|
@echo "make shell open a shell in the image"
|
|
@echo "make lint byte-compile and check formatting of the sources"
|
|
@echo "make clean remove caches and local configuration"
|
|
|
|
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"
|
|
|
|
run:
|
|
$(PYTHON) -m app --config $(CONFIG)
|
|
|
|
check:
|
|
$(PYTHON) -m app --config $(CONFIG) --check-config
|
|
|
|
hash-password:
|
|
@$(PYTHON) -c "import getpass, hashlib; print(hashlib.sha256(getpass.getpass('Password: ').encode()).hexdigest())"
|
|
|
|
demo:
|
|
$(PYTHON) tools/fake-freshrss.py
|
|
|
|
# The self-contained stack: builds, starts, and prints where to point a reader.
|
|
demo-up:
|
|
docker compose -f docker-compose.demo.yaml up -d --build
|
|
@echo ""
|
|
@echo "catalogue: http://127.0.0.1:8088/opds (sign in as demo / demo)"
|
|
@echo "logs: make demo-down | docker compose -f docker-compose.demo.yaml logs -f"
|
|
|
|
demo-down:
|
|
docker compose -f docker-compose.demo.yaml down
|
|
|
|
build:
|
|
docker build -t $(IMAGE) .
|
|
|
|
up:
|
|
@test -f config.json || { echo "config.json is missing: cp config.example.json config.json, then edit it"; exit 1; }
|
|
docker compose up -d --build
|
|
|
|
down:
|
|
docker compose down
|
|
|
|
logs:
|
|
docker compose logs -f
|
|
|
|
shell:
|
|
docker run --rm -it --entrypoint /bin/sh $(IMAGE)
|
|
|
|
clean:
|
|
rm -rf app/__pycache__ tests/__pycache__ tools/__pycache__ .env config.json
|