ci/post_receive_tests.sh
2# Run the post-receive tests for a repository, which means:
4# 1. Cloning the repo to a scratch directory
5# 2. Setting up a virtualenv/dependencies
6# 3. Running the test suite through `ts`
8# TODO: Support running tests on the non-main branch.
14 echo "Usage: $0 REPO_NAME" >
&2
18# Print a command in blue, then run the command
20 echo -e
"\033[34m-> $@\033[0m"
26# REPO_NAME is the name of the repository to run tests for
29# REMOTES_ROOT is the directory where I keep all my remote repos
30REMOTES_ROOT="/Volumes/Media (Speedwell)/repos"
32# SCRATCH_ROOT is the directory where I have checked-out versions for
33# running post-receive tests
34SCRATCH_ROOT="$REMOTES_ROOT/.working"
36export REPO_DIR="$REMOTES_ROOT/$REPO_NAME"
37export SCRATCH_DIR="$SCRATCH_ROOT/$REPO_NAME"
41# Clone the Git repo to the directory if it doesn't exist yet, or update
43if [ ! -d
"$SCRATCH_DIR/.git" ]; then
44 run_command
'git clone "$REPO_DIR" "$SCRATCH_DIR"'
46 run_command
'cd "$SCRATCH_DIR"'
50 run_command
'cd "$SCRATCH_DIR"'
54 run_command
'git pull origin main --rebase'
57# If there's a requirements.txt file in the repo, then this is a Python repo.
59if [ -f
"$SCRATCH_DIR/requirements.txt" ] || [ -f
"$SCRATCH_DIR/dev_requirements.txt" ]; then
60 run_command
'uv venv --quiet --allow-existing .venv --python 3.14'
61 echo "$SCRATCH_DIR/.venv" >> ~/.venv_registry
62 run_command
'source .venv/bin/activate'
63 source .venv/bin/activate