-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·57 lines (47 loc) · 1.14 KB
/
run
File metadata and controls
executable file
·57 lines (47 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -o errexit
set -o pipefail
TIMEFORMAT="Task completed in %3lR"
BIN="./venv/bin"
function help {
echo "Options:"
echo " init: Setup dev environment"
echo " lint: Linter"
echo " check: Formatting checks"
echo " format: Run formatter"
echo " test: Execute tests"
echo " coverage: Run tests with code coverage"
echo " clean: Remove dev, test, and build artifacts"
}
function init {
python3 -m venv --prompt castaway venv
"${BIN}/python" -m pip install -e ".[django,test]"
}
function lint {
"${BIN}/ruff" check castaway.py tests
}
function check {
"${BIN}/ruff" format --check --diff src/castaway tests
}
function format {
"${BIN}/ruff" format src/castaway tests
}
function test {
"${BIN}/pytest" -s -Werror tests "$@"
}
function clean {
rm -rf .ruff_cache .tox htmlcov .coverage dist pytest_cache src/castaway.egg-info
}
function coverage {
"${BIN}/pytest" \
--cov-report html \
--cov-report term \
--cov=castaway
}
if [ -z "$1" ]; then
help
else
what=$1
shift
time ${what:-help} "$@"
fi