#!/bin/sh
# Runs `make check` (lint, typecheck, test — the checks `make package` and the
# publish workflow run) before every commit, so a broken tree is caught here
# rather than after a release tag is pushed.
#
# Enable once per clone with `make install-hooks`. Skip for a single commit
# with `git commit --no-verify`.
#
# The checks see the working tree as it is, not only what is staged. The tests
# read the specs from ../VoiceBlender, so keep that checkout on the release this
# SDK was generated from — a newer spec fails the stale-codegen test.
set -e

cd "$(git rev-parse --show-toplevel)"

# A commit made from an editor usually runs without the virtualenv activated.
if [ -d .venv/bin ]; then
	PATH="$PWD/.venv/bin:$PATH"
fi

exec make check
