From 90135510066b0efc047a8f6d797ff464c9a5661b Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Wed, 29 Nov 2023 23:02:00 +0100 Subject: [PATCH] speed up tests --- .github/workflows/testing.yml | 7 ------- scripts/check-tests-ng.sh | 4 ++-- tests.sh | 31 +++++++++++++++++++++---------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 7b6e825..489c960 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -26,13 +26,6 @@ jobs: - name: Run with 1 worker run: | ./tests.sh - env: - DOTDROP_WORKERS: 1 - - name: Run with 4 workers - run: | - ./tests.sh - env: - DOTDROP_WORKERS: 4 - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 with: diff --git a/scripts/check-tests-ng.sh b/scripts/check-tests-ng.sh index 61d0bbf..bec0757 100755 --- a/scripts/check-tests-ng.sh +++ b/scripts/check-tests-ng.sh @@ -13,8 +13,8 @@ workdir_tmp_exists="no" [ -d "${HOME}/.config/dotdrop/tmp" ] && workdir_tmp_exists="yes" # run bash tests -GH_WORKFLOW=${GITHUB_WORKFLOW:-} -if [ -z "${GH_WORKFLOW}" ]; then +in_cicd=${GITHUB_WORKFLOW:-} +if [ -z "${in_cicd}" ]; then ## local tests-ng/tests_launcher.py -s else diff --git a/tests.sh b/tests.sh index 79199ed..0efd8c3 100755 --- a/tests.sh +++ b/tests.sh @@ -6,6 +6,14 @@ set -eu -o errtrace -o pipefail cur=$(cd "$(dirname "${0}")" && pwd) +in_cicd="${GH_WORKFLOW:-}" + +# patch TERM var in ci/cd +if [ -n "${in_cicd}" ]; then + if [ -z "${TERM}" ]; then + export TERM="linux" + fi +fi # make sure both version.py and manpage dotdrop.1 are in sync dotdrop_version=$(grep version dotdrop/version.py | sed 's/^.*= .\(.*\).$/\1/g') @@ -19,14 +27,6 @@ echo "current dotdrop version ${dotdrop_version}" echo "=> python version:" python3 --version -in_cicd="${GH_WORKFLOW:-}" -if [ -n "${in_cicd}" ]; then - # in CI/CD - if [ -z "${TERM}" ]; then - export TERM="linux" - fi -fi - # test syntax echo "checking syntax..." "${cur}"/scripts/check-syntax.sh @@ -36,8 +36,19 @@ echo "unittest..." "${cur}"/scripts/check-unittests.sh # tests-ng -echo "tests-ng..." -"${cur}"/scripts/check-tests-ng.sh +if [ -n "${in_cicd}" ]; then + # in CI/CD + export DOTDROP_WORKERS=1 + echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..." + "${cur}"/scripts/check-tests-ng.sh + + export DOTDROP_WORKERS=4 + echo "tests-ng with ${DOTDROP_WORKERS} worker(s)..." + "${cur}"/scripts/check-tests-ng.sh +else + echo "tests-ng..." + "${cur}"/scripts/check-tests-ng.sh +fi # merge coverage coverage combine coverages/*