Files
tkmind_go/justfile
T

127 lines
3.3 KiB
Makefile
Raw Normal View History

2024-10-18 13:53:49 -07:00
# list all tasks
2024-08-23 16:39:04 -07:00
default:
2024-10-29 16:00:35 -07:00
@just --list
2024-08-23 16:39:04 -07:00
2024-10-18 13:53:49 -07:00
# run tests
2024-08-23 16:39:04 -07:00
test *FLAGS:
2024-10-29 16:00:35 -07:00
@uv run pytest .github/workflows/ tests/ -m "not integration" {{ FLAGS }}
2024-08-23 16:39:04 -07:00
2024-10-18 13:53:49 -07:00
# run integration tests
2024-08-23 16:39:04 -07:00
integration *FLAGS:
2024-10-29 16:00:35 -07:00
@uv run pytest tests/ -m integration {{ FLAGS }}
2024-08-23 16:39:04 -07:00
2024-10-25 17:23:33 -07:00
# check licenses
2024-11-03 15:04:17 -08:00
check-licenses force="":
#!/usr/bin/env bash
mapfile -t license_files < <(find . -type f -name 'pyproject.toml')
total=${#license_files[@]}
for ((i=0; i<total; i++)); do
license="${license_files[i]}"
remaining=$((total - i - 1))
if ! git diff --quiet "$license" || [ "{{ force }}" == "--force" ]; then
echo "checking licenses for: $license"
uv run .github/workflows/scripts/check_licenses.py "$license"
if [ $remaining -gt 0 ]; then
echo ""
fi
fi
done
# list supported licenses
list-licenses:
@uv run .github/workflows/scripts/check_licenses.py --supported-licenses
2024-10-25 17:23:33 -07:00
2024-10-18 13:53:49 -07:00
# format code
2024-08-23 16:39:04 -07:00
format:
2024-10-18 13:53:49 -07:00
#!/usr/bin/env bash
UVX_PATH="$(which uvx)"
2024-10-18 13:53:49 -07:00
if [ -z "$UVX_PATH" ]; then
echo "[error]: unable to find uvx"
exit 1
fi
eval "$UVX_PATH ruff format ."
eval "$UVX_PATH ruff check . --fix"
2024-10-18 13:53:49 -07:00
just --unstable --fmt
2024-08-23 16:39:04 -07:00
2024-10-18 13:53:49 -07:00
# run tests with coverage
2024-08-23 16:39:04 -07:00
coverage *FLAGS:
2024-10-29 16:00:35 -07:00
@uv run coverage run -m pytest tests/ -m "not integration" {{ FLAGS }}
@uv run coverage report
@uv run coverage lcov -o lcov.info
2024-09-17 17:08:38 -04:00
2024-10-18 13:53:49 -07:00
# build docs
2024-09-17 17:08:38 -04:00
docs:
2024-10-29 16:00:35 -07:00
@uv sync && uv run mkdocs serve
2024-09-25 14:20:49 -04:00
2024-10-18 13:53:49 -07:00
# install pre-commit hooks
install-hooks:
2024-10-18 13:53:49 -07:00
#!/usr/bin/env bash
HOOKS_DIR="$(git rev-parse --git-path hooks)"
2024-10-18 13:53:49 -07:00
if [ ! -d "$HOOKS_DIR" ]; then
mkdir -p "$HOOKS_DIR"
fi
2024-10-18 13:53:49 -07:00
cat > "$HOOKS_DIR/pre-commit" <<EOF
#!/usr/bin/env bash
2024-10-18 13:53:49 -07:00
just format
2024-10-25 17:23:33 -07:00
just check-licenses
2024-10-18 13:53:49 -07:00
EOF
2024-10-18 13:53:49 -07:00
if [ ! -f "$HOOKS_DIR/pre-commit" ]; then
echo "[error]: failed to create pre-commit hook at $HOOKS_DIR/pre-commit"
exit 1
fi
echo "installed pre-commit hook to $HOOKS_DIR"
chmod +x "$HOOKS_DIR/pre-commit"
2024-10-18 13:53:49 -07:00
# get latest ai-exchange version from pypi
ai-exchange-version:
2024-10-18 13:53:49 -07:00
#!/usr/bin/env bash
curl --silent https://pypi.org/pypi/ai-exchange/json |
jq --raw-output ".info.version"
2024-10-18 13:53:49 -07:00
# bump goose and ai-exchange version
release version:
2024-10-18 13:53:49 -07:00
#!/usr/bin/env bash
if [[ ! "{{ version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
echo "[error]: invalid version '{{ version }}'."
echo " expected: semver format major.minor.patch or major.minor.patch-<suffix>"
exit 1
fi
uvx --from=toml-cli toml set --toml-path=pyproject.toml "project.version" {{ version }}
git checkout -b "release-{{ version }}"
git add pyproject.toml
git commit --message "chore(release): release version {{ version }}"
# extract tag from pyproject.toml
get-tag-version:
2024-10-29 16:00:35 -07:00
@uvx --from=toml-cli toml get --toml-path=pyproject.toml "project.version"
2024-10-18 13:53:49 -07:00
# create tag from pyproject.toml
tag:
2024-10-18 13:53:49 -07:00
#!/usr/bin/env bash
git tag v$(just get-tag-version)
2024-10-18 13:53:49 -07:00
# create tag and push to origin (use this when release branch is merged to main)
tag-push: tag
#!/usr/bin/env bash
# this will kick of ci for release
git push origin tag v$(just get-tag-version)
2024-10-10 19:10:08 -04:00
2024-10-18 13:53:49 -07:00
# create release notes latest tag..HEAD
2024-10-10 19:10:08 -04:00
release-notes:
2024-10-18 13:53:49 -07:00
#!/usr/bin/env bash
git log --pretty=format:"- %s" v$(just get-tag-version)..HEAD
2024-10-18 13:53:49 -07:00
# setup langfuse server
langfuse-server:
2024-10-18 13:53:49 -07:00
#!/usr/bin/env bash
./scripts/setup_langfuse.sh