nix: makes do.sh play better with nix
All checks were successful
gitea-physics/pyewjn/pipeline/pr-master This commit looks good
All checks were successful
gitea-physics/pyewjn/pipeline/pr-master This commit looks good
This commit is contained in:
parent
aae86062da
commit
34601fafbd
26
do.sh
26
do.sh
@ -4,30 +4,56 @@
|
|||||||
|
|
||||||
set -Eeuo pipefail # -e "Automatic exit from bash shell script on error" -u "Treat unset variables and parameters as errors"
|
set -Eeuo pipefail # -e "Automatic exit from bash shell script on error" -u "Treat unset variables and parameters as errors"
|
||||||
|
|
||||||
|
checknix() {
|
||||||
|
if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then
|
||||||
|
echo "In an interactive nix env."
|
||||||
|
else
|
||||||
|
echo "Using poetry as runner, no nix detected."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
echo "I am ${FUNCNAME[0]}ing"
|
echo "I am ${FUNCNAME[0]}ing"
|
||||||
poetry build
|
poetry build
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt() {
|
fmt() {
|
||||||
|
if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then
|
||||||
|
black .
|
||||||
|
else
|
||||||
poetry run black .
|
poetry run black .
|
||||||
|
fi
|
||||||
find . -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \;
|
find . -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \;
|
||||||
}
|
}
|
||||||
|
|
||||||
test() {
|
test() {
|
||||||
echo "I am ${FUNCNAME[0]}ing"
|
echo "I am ${FUNCNAME[0]}ing"
|
||||||
|
if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then
|
||||||
|
flake8 pyewjn tests
|
||||||
|
mypy pyewjn
|
||||||
|
pytest --benchmark-disable
|
||||||
|
else
|
||||||
poetry run flake8 pyewjn tests
|
poetry run flake8 pyewjn tests
|
||||||
poetry run mypy pyewjn
|
poetry run mypy pyewjn
|
||||||
poetry run pytest --benchmark-disable
|
poetry run pytest --benchmark-disable
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
benchmark() {
|
benchmark() {
|
||||||
echo "I am ${FUNCNAME[0]}ing"
|
echo "I am ${FUNCNAME[0]}ing"
|
||||||
|
if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then
|
||||||
|
pytest --benchmark-only
|
||||||
|
else
|
||||||
poetry run pytest --benchmark-only
|
poetry run pytest --benchmark-only
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
htmlcov() {
|
htmlcov() {
|
||||||
|
if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then
|
||||||
|
pytest --cov-report=html
|
||||||
|
else
|
||||||
poetry run pytest --cov-report=html
|
poetry run pytest --cov-report=html
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
release() {
|
release() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user