diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2026-02-15 21:27:00 +0100 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2026-02-15 21:27:00 +0100 |
| commit | ce0dbf6b249956700c6a1705bf4ad85a09d53e8c (patch) | |
| tree | d7c3236807cfbf75d7f3a355eb5df5a5e2cc4ad7 /Justfile | |
| parent | 064a1d01c5c14f5ecc032fa9b8346a4a88b893f6 (diff) | |
Switch, cleanup, and status CLI commands. Persistent build state via
state.json. Post-deploy hooks on success and failure with
WITRYNA_BUILD_STATUS. Dependency diet (axum→tiny_http, clap→argh,
tracing→log). Drop built-in rate limiting. Nix flake with NixOS module.
Arch Linux PKGBUILD. Centralized version management.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'Justfile')
| -rw-r--r-- | Justfile | 67 |
1 files changed, 55 insertions, 12 deletions
@@ -1,4 +1,5 @@ # Witryna development tasks +version := `grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/'` # List available recipes default: @@ -34,7 +35,41 @@ lint-picky: cargo clippy --all-targets --all-features -- -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used -W clippy::expect_used -W clippy::panic -W clippy::indexing_slicing -W clippy::clone_on_ref_ptr -W clippy::print_stdout -W clippy::print_stderr # Run all lints -lint: lint-rust lint-yaml lint-secrets +lint: lint-rust lint-yaml lint-secrets check-version + +# --- Version --- + +# Verify all files match Cargo.toml version +check-version: + #!/usr/bin/env bash + set -euo pipefail + v="{{version}}" + # Arch pkgver: strip pre-release punctuation (0.2.0-rc.1 → 0.2.0rc1) + pkgver=$(echo "$v" | sed 's/-\([a-z]*\)\./\1/') + tag="v${v}" + ok=true + check() { grep -qF "$2" "$1" || { echo "MISMATCH: $1 missing '$2'"; ok=false; }; } + check arch/PKGBUILD "pkgver=${pkgver}" + check arch/PKGBUILD "_tag=${tag}" + check man/witryna.1 "witryna ${v}\"" + check man/witryna.1 "${tag}" + check man/witryna.toml.5 "witryna ${v}\"" + $ok && echo "All versions match Cargo.toml: ${v}" || { echo "Run 'just bump-version' to fix"; exit 1; } + +# Sync version in packaging/doc files to match Cargo.toml +bump-version: + #!/usr/bin/env bash + set -euo pipefail + v="{{version}}" + pkgver=$(echo "$v" | sed 's/-\([a-z]*\)\./\1/') + tag="v${v}" + echo "Syncing to ${v} (pkgver=${pkgver}, tag=${tag})" + sed -i "s/^pkgver=.*/pkgver=${pkgver}/" arch/PKGBUILD + sed -i "s/^_tag=.*/_tag=${tag}/" arch/PKGBUILD + sed -i "1s/\"witryna [^\"]*\"/\"witryna ${v}\"/" man/witryna.1 + sed -i "1s/\"witryna [^\"]*\"/\"witryna ${v}\"/" man/witryna.toml.5 + sed -i '/^\.SH VERSION$/,/^\.SH /{s/^v.*/'"${tag}"'/}' man/witryna.1 + echo "Done. Remaining manual updates: CHANGELOG.md, README.md" # --- Testing --- @@ -59,16 +94,6 @@ test-all: lint test test-integration build-release: cargo build --release -# --- Man pages --- - -# View witryna(1) man page (run `cargo build` first) -man-1: - man -l target/man/witryna.1 - -# View witryna.toml(5) man page -man-5: - man -l man/witryna.toml.5 - # --- Packaging --- # Build Debian package @@ -100,6 +125,24 @@ inspect-rpm: echo "" && echo "=== Config files ===" && rpm -qcp "$rpm" echo "" && echo "=== Scripts ===" && rpm -q --scripts -p "$rpm" +# Test PKGBUILD locally (requires makepkg) +build-arch: + cd arch && makepkg -sf + +# Build Nix package (requires nix with flakes) +build-nix: + nix build .#witryna + +# Show contents of built Arch package +inspect-arch: + #!/usr/bin/env bash + set -euo pipefail + pkg=$(find arch -name 'witryna-*.pkg.tar.zst' 2>/dev/null | head -1) + if [[ -z "$pkg" ]]; then echo "No .pkg.tar.zst found — run 'just build-arch' first" >&2; exit 1; fi + echo "=== Info ===" && pacman -Qip "$pkg" + echo "" && echo "=== Contents ===" && pacman -Qlp "$pkg" + echo "" && echo "=== Backup files ===" && pacman -Qip "$pkg" | grep -A99 "^Backup Files" + # --- Release --- RELEASE_HOST := "git@sandcrawler" @@ -117,7 +160,7 @@ build-tarball: build-release cp target/release/witryna "$staging/" cp examples/witryna.toml "$staging/" cp debian/witryna.service "$staging/" - cp target/man/witryna.1 "$staging/" + cp man/witryna.1 "$staging/" cp man/witryna.toml.5 "$staging/" cp README.md "$staging/" cp examples/hooks/caddy-deploy.sh "$staging/examples/hooks/" |
