diff --git a/script/bootstrap b/script/bootstrap index ad26fe47..ab370b86 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -9,13 +9,24 @@ set -e # Ensure we are in the app root directory (not the /script directory) cd "$(dirname "${0}")/.." +if [ -z "${CIBUILD+xxxx}" ]; then + CMD_PREFIX='pipenv run ' +fi +PIP_CMD="${CMD_PREFIX}pip" +WEBASSETS_CMD="${CMD_PREFIX}webassets" + +PIPENV_INSTALL_FLAGS='--dev' +if ${CIBUILD}; then + PIPENV_INSTALL_FLAGS+=' --system --ignore-pipfile' +fi + # Install Python dependencies pipenv --python 3.6 -pipenv run pip install --upgrade pip -pipenv install --dev +${PIP_CMD} install --upgrade pip +pipenv install ${PIPENV_INSTALL_FLAGS} # Install uswds node module and dependencies npm install # Precompile assets for deployment -pipenv run webassets -m atst.assets build +${WEBASSETS_CMD} -m atst.assets build diff --git a/script/server b/script/server index cd9fb452..fa78012d 100755 --- a/script/server +++ b/script/server @@ -14,8 +14,13 @@ set -e # Ensure we are in the app root directory (not the /script directory) cd "$(dirname "${0}")/.." +if [ -z "${SKIP_PIPENV+xxxx}" ]; then + CMD_PREFIX='pipenv run ' +fi +PYTHON_CMD="${CMD_PREFIX}python" + # Launch the app -pipenv run python app.py ${@} & +${PYTHON_CMD} app.py ${@} & child=$! wait $child diff --git a/script/test b/script/test index de405886..fe2d7ecb 100755 --- a/script/test +++ b/script/test @@ -1,12 +1,23 @@ #!/bin/bash +# script/test: Run static code checks and unit tests + # If a command fails, exit the script set -e # Ensure we are in the app root directory (not the /script directory) cd "$(dirname "${0}")/.." -pipenv run pylint app.py atst/ tests/ +if [ -z "${SKIP_PIPENV+xxxx}" ]; then + CMD_PREFIX='pipenv run ' +fi +PYLINT_CMD="${CMD_PREFIX}pylint" +PYTHON_CMD="${CMD_PREFIX}python" + +# Run lint check +echo "Running lint..." +${PYLINT_CMD} app.py atst/ tests/ # Run unit tests -pipenv run python -m pytest -s $* +echo "Running unit tests..." +${PYTHON_CMD} -m pytest -s $*