From 74c9347bba7df546abe763c920881bd8f5eacc09 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sun, 24 Nov 2024 23:05:37 +0100 Subject: [PATCH] ci/circle: speed up tests / coverage Instead of running the testsuite twice when coverage is need, only run it once (without filtering out `nocov` tests): with `cluacov` installed, it's only 50% slower than a normal run. --- .ci/after_success.sh | 8 +++----- .ci/test.sh | 10 +++++++++- .circleci/config.yml | 8 ++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.ci/after_success.sh b/.ci/after_success.sh index d51869a61..5e8b2df12 100755 --- a/.ci/after_success.sh +++ b/.ci/after_success.sh @@ -7,11 +7,9 @@ source "${CI_DIR}/common.sh" set +e if [ -z "${CIRCLE_PULL_REQUEST}" ] && [ "${CIRCLE_BRANCH}" = 'master' ]; then - travis_retry make --assume-old=all coverage - pushd install/koreader && { + echo -e "\\n${ANSI_GREEN}Uploading coverage." + cd install/koreader && { # see https://github.com/codecov/example-lua bash <(curl -s https://codecov.io/bash) - } && popd || exit -else - echo -e "\\n${ANSI_GREEN}Not on official master branch. Skipping coverage." + } fi diff --git a/.ci/test.sh b/.ci/test.sh index de3559e10..051411146 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -4,6 +4,14 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=/dev/null source "${CI_DIR}/common.sh" -make testfront --assume-old=all T="-o '${PWD}/test-results.xml'" +if [[ -z "${CIRCLE_PULL_REQUEST}" ]] && [[ "${CIRCLE_BRANCH}" == 'master' ]]; then + # We're on master: do a full testsuite run with coverage. + target='coverage' +else + # Pull request / not on master: do a regular testsuite run. + target='testfront' +fi + +make "${target}" --assume-old=all T="-o '${PWD}/test-results.xml'" # vim: sw=4 diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b909b3e2..b0e5eaf72 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,11 +103,11 @@ jobs: - run: name: Test command: .ci/test.sh - # Docs, coverage, and test timing (can we use two outputs at once?); master branch only. + # Upload coverage statistics (master branch only). - run: - name: Coverage + name: Uploading coverage command: .ci/after_success.sh - # By storing the test results CircleCI automatically distributes tests based on execution time. + # Store test results for better feedback / insights. - store_test_results: path: &TESTS_XML test-results.xml # CircleCI doesn't make the test results available as artifacts (October 2017). @@ -129,7 +129,7 @@ jobs: - run: name: fetch command: .ci/fetch.sh - # docs, coverage, and test timing (can we use two outputs at once?); master branch only + # Docs & translations (master branch only). - run: name: docs-and-translation command: .ci/after_success_docs_translation.sh