fix: CI _preflight, swap tea→fgj, add ci-logs helper

- 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 <noreply@anthropic.com>
This commit is contained in:
Thomas SharedInbox
2026-05-13 06:05:55 +02:00
co-authored by Claude Sonnet 4.6
parent d58ed9ebc4
commit 76278d6f69
3 changed files with 48 additions and 2 deletions
+6 -1
View File
@@ -34,7 +34,7 @@ tasks:
run: once run: once
deps: [_nix-check] deps: [_nix-check]
preconditions: preconditions:
- sh: test "${DIRENV_DIR#-}" = "{{.TASKFILE_DIR}}" - sh: test -n "${IN_NIX_SHELL}"
msg: "Not in nix dev shell. Run: nix develop" msg: "Not in nix dev shell. Run: nix develop"
cmds: cmds:
- scripts/silent_on_success.sh pre-commit install - scripts/silent_on_success.sh pre-commit install
@@ -368,6 +368,11 @@ tasks:
- task: integration - task: integration
- task: integration-ui - 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: check:
desc: Full check suite — unit tests first, then integration (merges coverage), then gate desc: Full check suite — unit tests first, then integration (merges coverage), then gate
deps: [analyze, build-linux, test] deps: [analyze, build-linux, test]
+18 -1
View File
@@ -28,6 +28,20 @@
gdk-pixbuf gdk-pixbuf
harfbuzz 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 { in {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
@@ -68,10 +82,13 @@
jq jq
sqlite sqlite
python3 # used by stalwart-dev/start to pick random ports python3 # used by stalwart-dev/start to pick random ports
tea # Gitea CLI fgj # Codeberg/Forgejo CLI (like gh for GitHub)
]); ]);
shellHook = '' 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 # Disable Flutter telemetry inside dev shell
export FLUTTER_SUPPRESS_ANALYTICS=true export FLUTTER_SUPPRESS_ANALYTICS=true
+24
View File
@@ -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"