Update analyzer build/testing script to download necessary Python packages

This commit is contained in:
Wes Lambert
2022-05-09 20:06:39 +00:00
parent 32adba6141
commit 555ca2e277

View File

@@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
COMMAND=$1
function ci() {
HOME_DIR=$(dirname "$0") HOME_DIR=$(dirname "$0")
TARGET_DIR=${1:-.} TARGET_DIR=${1:-.}
@@ -13,3 +16,20 @@ fi
flake8 "$TARGET_DIR" "--config=${HOME_DIR}/pytest.ini" flake8 "$TARGET_DIR" "--config=${HOME_DIR}/pytest.ini"
pytest "$TARGET_DIR" "--cov-config=${HOME_DIR}/pytest.ini" "--cov=$TARGET_DIR" --doctest-modules --cov-report=term --cov-fail-under=100 pytest "$TARGET_DIR" "--cov-config=${HOME_DIR}/pytest.ini" "--cov=$TARGET_DIR" --doctest-modules --cov-report=term --cov-fail-under=100
}
function download() {
ANALYZERS=$1
if [[ $ANALYZERS = "all" ]]; then
ANALYZERS="*/"
fi
for ANALYZER in $ANALYZERS; do
docker exec -it so-sensoroni pip download -r /opt/sensoroni/analyzers/$ANALYZER/requirements.txt -d /opt/sensoroni/analyzers/$ANALYZER/source-packages
done
}
if [[ "$COMMAND" == "download" ]]; then
download "$2"
else
ci
fi