Simplified run_ci_tests.sh to run within a Gitlab runner context

This commit is contained in:
Fabio Manganiello 2021-09-19 23:28:05 +02:00
parent 994eee677e
commit 9be456a4ef
1 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
BASE_DIR="$(mktemp -d)"
BASE_DIR="$(mktemp -d '/tmp/platypush-ci-tests-XXXXX')"
VENV_DIR="$BASE_DIR/venv"
REPO_DIR="$BASE_DIR/repo"
TEST_LOG="$BASE_DIR/test.log"
@ -16,19 +16,18 @@ prepare_venv() {
python -m venv "$VENV_DIR"
cd "$VENV_DIR"
source ./bin/activate
cd -
}
install_repo() {
echo "Installing latest version of the repository"
git clone "$REPO_URL" "$REPO_DIR"
cd "$REPO_DIR"
pip install '.[http]'
}
run_tests() {
echo "Running tests"
cd "$REPO_DIR"
pytest 2>&1 | tee "$TEST_LOG"
grep -e '^FAILED ' "$TEST_LOG"
if [[ $? == 0 ]]; then
return 2 # FAILURE