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

View file

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