From 76278d6f69e52740598cb9b3e6f6024ab12e6d6c Mon Sep 17 00:00:00 2001 From: Thomas SharedInbox Date: Wed, 13 May 2026 06:05:55 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20CI=20=5Fpreflight,=20swap=20tea=E2=86=92?= =?UTF-8?q?fgj,=20add=20ci-logs=20helper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - flake.nix: replace tea with fgj (fetchurl of v0.4.0 linux_amd64 binary) - flake.nix shellHook: export IN_NIX_SHELL=1 so that nix develop --command sets the variable that _preflight checks (nix develop does not set it automatically, unlike the old nix-shell) - Taskfile.yml _preflight: use IN_NIX_SHELL check instead of DIRENV_DIR, which never worked in CI - scripts/ci_logs.sh + task ci-logs: fetch raw Codeberg Actions job logs from the web-UI endpoint (API endpoint not available on Codeberg 15.0.0) Co-Authored-By: Claude Sonnet 4.6 --- Taskfile.yml | 7 ++++++- flake.nix | 19 ++++++++++++++++++- scripts/ci_logs.sh | 24 ++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100755 scripts/ci_logs.sh diff --git a/Taskfile.yml b/Taskfile.yml index e5a3e63..0b8f328 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -34,7 +34,7 @@ tasks: run: once deps: [_nix-check] preconditions: - - sh: test "${DIRENV_DIR#-}" = "{{.TASKFILE_DIR}}" + - sh: test -n "${IN_NIX_SHELL}" msg: "Not in nix dev shell. Run: nix develop" cmds: - scripts/silent_on_success.sh pre-commit install @@ -368,6 +368,11 @@ tasks: - task: integration - task: integration-ui + ci-logs: + desc: "Fetch latest CI job logs from Codeberg. Usage: task ci-logs [RUN=8] [JOB=0]" + cmds: + - scripts/ci_logs.sh "{{.RUN}}" "{{.JOB}}" + check: desc: Full check suite — unit tests first, then integration (merges coverage), then gate deps: [analyze, build-linux, test] diff --git a/flake.nix b/flake.nix index d4ec6af..b093a96 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,20 @@ gdk-pixbuf harfbuzz ]; + fgj = pkgs.stdenv.mkDerivation { + pname = "fgj"; + version = "0.4.0"; + src = pkgs.fetchurl { + url = "https://codeberg.org/romaintb/fgj/releases/download/v0.4.0/fgj_linux_amd64"; + sha256 = "07pia03facvvxq9i1dgl7p47ccv1iqj4drpkp45gvw26d4afkbj7"; + }; + dontUnpack = true; + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/fgj + chmod +x $out/bin/fgj + ''; + }; in { devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ @@ -68,10 +82,13 @@ jq sqlite python3 # used by stalwart-dev/start to pick random ports - tea # Gitea CLI + fgj # Codeberg/Forgejo CLI (like gh for GitHub) ]); shellHook = '' + # nix develop --command does not set IN_NIX_SHELL; set it so _preflight passes in CI + export IN_NIX_SHELL=1 + # Disable Flutter telemetry inside dev shell export FLUTTER_SUPPRESS_ANALYTICS=true diff --git a/scripts/ci_logs.sh b/scripts/ci_logs.sh new file mode 100755 index 0000000..8069036 --- /dev/null +++ b/scripts/ci_logs.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO="guettli/sharedinbox" +RUN="${1:-}" +JOB="${2:-0}" + +if [ -z "$RUN" ]; then + RUN=$(curl -sf "https://codeberg.org/api/v1/repos/$REPO/actions/tasks?limit=10" \ + | python3 -c " +import json, sys +data = json.load(sys.stdin) +for r in data.get('workflow_runs', []): + if r['status'] != 'skipped': + print(r['run_number']) + break +") + echo "Latest non-skipped run: #$RUN" >&2 +fi + +URL="https://codeberg.org/$REPO/actions/runs/$RUN/jobs/$JOB/attempt/1/logs" +echo "Fetching: $URL" >&2 +echo "---" >&2 +curl -sf "$URL"