-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathrun
executable file
·53 lines (44 loc) · 1.03 KB
/
run
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
#!/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"
}
function init {
python3 -m venv --prompt sw venv
"${BIN}/python" -m pip install -e ".[dev,test,docs]"
}
function lint {
"${BIN}/ruff" check swingtime demo tests
}
function check {
"${BIN}/ruff" format --check swingtime demo tests
}
function format {
"${BIN}/ruff" format swingtime demo tests
}
function test {
PYTHONPATH=. "${BIN}/pytest" -s -Werror tests "$@"
}
function coverage {
PYTHONPATH=. "${BIN}/pytest" \
--cov-config .coveragerc \
--cov-report html \
--cov-report term \
--cov=swingtime
}
if [ -z "$1" ]; then
help
else
what=$1
shift
time ${what:-help} "$@"
fi