You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
778 B
Bash
33 lines
778 B
Bash
#!/usr/bin/env bash
|
|
|
|
# setting -e to exit immediately on a command failure.
|
|
# setting -o pipefail sets the exit code of a pipeline to that of the rightmost command to exit with a non-zero status, or to zero if all commands of the pipeline exit successfully.
|
|
set -eo pipefail
|
|
|
|
function _setup_env() {
|
|
# build a virtual env and install
|
|
if [ -z $VIRTUAL_ENV ]; then
|
|
python3 -m venv env
|
|
source env/bin/activate
|
|
fi
|
|
|
|
if [ "${DRONE}" == "true" ]; then
|
|
_setup_env
|
|
|
|
fi
|
|
|
|
if [ -z "${VIRTUAL_ENV}" ]; then
|
|
echo "warning: you are not in a virtualenv"
|
|
exit 1
|
|
fi
|
|
|
|
pip install -U pip pip-tools
|
|
pip-compile requirements.in
|
|
pip-compile dev-requirements.in
|
|
pip-sync requirements.txt dev-requirements.txt
|
|
|
|
if [ ! -d ".git" ]; then
|
|
git init
|
|
pre-commit install
|
|
fi
|