diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..a94ba445 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,15 @@ +kind: pipeline +type: docker +name: default + +steps: +- name: run-tests + image: python:3.11-alpine + commands: + - apk add --update --no-cache redis + - apk add --update --no-cache --virtual build-base g++ rust + - pip install -U pip + - pip install . + - pip install -r requirements-tests.txt + - apk del build-base g++ rust + - pytest tests diff --git a/.gitlab/rebuild_docs.sh b/.gitlab/rebuild_docs.sh deleted file mode 100755 index 4e843a8b..00000000 --- a/.gitlab/rebuild_docs.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -LOGFILE="./docs.log" -STATUS_IMG_PATH="./docs-status.svg" - -build_docs() { - cd ./docs || exit 1 - make html 2>&1 | tee "../$LOGFILE" - ret=$? - cd .. || exit 1 - return $? -} - -######## -# MAIN # -######## - -build_docs -ret=$? - -log_base_path="$(date +/opt/tests/platypush/logs/docs/%Y-%m-%dT%H:%M:%S.%m)" -if [[ $ret == 0 ]]; then - wget -O "$STATUS_IMG_PATH" https://ci.platypush.tech/docs/passed.svg - cp "$LOGFILE" "${log_base_path}_PASSED.log" -else - wget -O "$STATUS_IMG_PATH" https://ci.platypush.tech/docs/failed.svg - cp "$LOGFILE" "${log_base_path}_FAILED.log" -fi - -mv "$STATUS_IMG_PATH" /opt/tests/platypush/logs/docs/ -mv "$LOGFILE" /opt/tests/platypush/logs/latest.log -cp -r docs/build/html /opt/repos/platypush/docs/build/ -exit $ret diff --git a/.gitlab/run_ci_tests.sh b/.gitlab/run_ci_tests.sh deleted file mode 100755 index c4aee443..00000000 --- a/.gitlab/run_ci_tests.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -BASE_DIR="$(mktemp -d '/tmp/platypush-ci-tests-XXXXX')" -VENV_DIR="$BASE_DIR/venv" -TEST_LOG="./test.log" -STATUS_IMG_PATH="./status.svg" - -cleanup() { - echo "Cleaning up environment" - rm -rf "$BASE_DIR" -} - -prepare_venv() { - echo "Preparing virtual environment" - python -m venv "$VENV_DIR" - cd "$VENV_DIR" || exit 1 - source ./bin/activate - cd - || exit 1 -} - -install_repo() { - echo "Installing latest version of the repository" - pip install '.[http]' -} - -run_tests() { - echo "Running tests" - pytest 2>&1 | tee "$TEST_LOG" - deactivate - - if grep -e '^FAILED ' "$TEST_LOG"; then - return 2 - fi - - return 0 # PASSED -} - -######## -# MAIN # -######## - -cleanup -prepare_venv -install_repo -run_tests -ret=$? -cleanup - -log_base_path="$(date +/opt/tests/platypush/logs/%Y-%m-%dT%H:%M:%S.%m)" -if [[ $ret == 0 ]]; then - wget -O "$STATUS_IMG_PATH" https://ci.platypush.tech/passed.svg - cp "$TEST_LOG" "${log_base_path}_PASSED.log" -else - wget -O "$STATUS_IMG_PATH" https://ci.platypush.tech/failed.svg - cp "$TEST_LOG" "${log_base_path}_FAILED.log" -fi - -mv "$STATUS_IMG_PATH" /opt/tests/platypush/logs/status.svg -mv "$TEST_LOG" /opt/tests/platypush/logs/latest.log -exit $ret diff --git a/requirements-tests.txt b/requirements-tests.txt new file mode 100644 index 00000000..e079f8a6 --- /dev/null +++ b/requirements-tests.txt @@ -0,0 +1 @@ +pytest