Files
claude-config/ci.sh

15 lines
979 B
Bash
Executable File

#!/bin/sh
# Runs the test suite on the committed HEAD as CI does: in a pinned Python container, as the caller's uid, so the tests that skip under root still run.
# It is sh, not Python, since it runs on the CI runner's host, which needs only git and docker.
# The repo goes in as a git bundle rather than a bind mount, so the script works whether the CI runner shares the docker daemon's filesystem or not.
set -eu
cd "$(dirname "$0")"
git bundle create - HEAD | docker run --rm -i --memory 4g --memory-swap 4g --user "$(id -u):$(id -g)" -e HOME=/tmp python:3.14.8 sh -euc '
cat >/tmp/head.bundle
git -c init.defaultBranch=main -c advice.detachedHead=false clone --quiet /tmp/head.bundle /tmp/repo
cd /tmp/repo
python3 -m pip install --quiet --disable-pip-version-check --user uv==0.12.23
# On a failure, the CI log shows the whole pytest output, which run-tests saved to its log file.
PATH="$HOME/.local/bin:$PATH" bin/run-tests || { cat /tmp/run-tests-*.log; exit 1; }
'