Skip to content

Commit

Permalink
move all CI logic to ctest2ci
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 4, 2021
1 parent 4b19ed0 commit 9cebb25
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
13 changes: 2 additions & 11 deletions .ci/config.ctest
Expand Up @@ -64,11 +64,7 @@ IF(NOT IGNORE_BUILD_FAILURES)
IF(NOT ${BUILDRES} EQUAL 0 OR NOT ${NUMERR} EQUAL 0)
ctest_submit (RETRY_COUNT 3 RETRY_DELAY 30)
MESSAGE("")
MESSAGE(" ${Yellow}Test results submitted to${ColorReset}")
MESSAGE(" ${BoldYellow}${SHORTURL}${ColorReset}")
# Github step output
MESSAGE("::set-output name=TESTS_PASS::false")
MESSAGE("::set-output name=CDASH_URL::${SHORTURL}")
MESSAGE(" ${Yellow}Test results submitted to:${ColorReset} ${SHORTURL}")
MESSAGE("")
MESSAGE( FATAL_ERROR " ${Red}Build failed. Not running tests.${ColorReset}" )
MESSAGE("")
Expand All @@ -78,11 +74,7 @@ ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL ${PARALLEL_LEVEL} R
IF(NOT ${NUMWARN} EQUAL 0 OR NOT ${TESTRES} EQUAL 0)
ctest_submit (RETRY_COUNT 3 RETRY_DELAY 30)
MESSAGE("")
MESSAGE(" ${Yellow}Test results submitted to${ColorReset}")
MESSAGE(" ${BoldYellow}${SHORTURL}${ColorReset}" )
# Github step output
MESSAGE("::set-output name=TESTS_PASS::false")
MESSAGE("::set-output name=CDASH_URL::${SHORTURL}")
MESSAGE(" ${Yellow}Test results submitted to:${ColorReset} ${SHORTURL}" )
MESSAGE("")
SET(LEVEL "")
IF(NOT ${TESTRES} EQUAL 0)
Expand All @@ -103,6 +95,5 @@ IF(NOT ${TESTRES} EQUAL 0)
MESSAGE(" ${BoldGreen}Success${ColorReset}")
MESSAGE(" ${Green}All tests passed successfully.${ColorReset}")
MESSAGE("")
MESSAGE("::set-output name=TESTS_PASS::true")
MESSAGE("")
ENDIF(NOT ${TESTRES} EQUAL 0)
4 changes: 4 additions & 0 deletions .ci/ctest2ci.py
Expand Up @@ -108,6 +108,8 @@ def start_test_fold():
in_failure = True

if not in_failing_test and re.search('[0-9]+% tests passed, [0-9]+ tests failed out of', updated_line):
tests_failing = re.match(r'([0-9]+) tests failed', updated_line).group(1)
updated_line += '\n::set-output name=TESTS_FAILING::{}'.format(tests_failing)
end_fold()

if re.search('100% tests passed', updated_line):
Expand All @@ -116,6 +118,8 @@ def start_test_fold():
if re.match('Submit files', updated_line):
start_fold('submit')
elif re.search('Test results submitted to', updated_line):
cdash_url = re.match(r'(http.*)$', updated_line).group(1)
updated_line += '\n::set-output name=CDASH_URL::{}'.format(cdash_url)
end_fold()

sys.stdout.write(updated_line)
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/run-tests.yml
Expand Up @@ -35,9 +35,9 @@ jobs:
runs-on: ubuntu-latest

outputs:
cdash_url: ${{ steps.tests.outputs.CDASH_URL }}
compile_outcome: ${{ steps.compile.outcome }}
tests_pass: ${{ steps.tests.outputs.TESTS_PASS }}
tests_failing: ${{ steps.tests.outputs.TESTS_FAILING }}
cdash_url: ${{ steps.tests.outputs.CDASH_URL }}
runners_outcome: ${{ steps.runners.outcome }}

steps:
Expand Down Expand Up @@ -193,14 +193,14 @@ jobs:
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
CDASH_URL: ${{ needs.build.outputs.cdash_url }}
COMPILE_OUTCOME: ${{ needs.build.outputs.compile_outcome }}
TESTS_PASS: ${{ needs.build.outputs.tests_pass }}
TESTS_FAILING: ${{ needs.build.outputs.tests_failing }}
RUNNERS_OUTCOME: ${{ needs.build.outputs.runners_outcome }}
run: |
echo "::set-output name=COMMENT_ID::"$([[ "${COMMENT_FOUND}" -eq "0" ]] && echo ${COMMENT_CREATED} || echo ${COMMENT_FOUND})
if [[ ${COMPILE_OUTCOME} != "success" ]]; then
echo "::set-output name=COMMENT_BODY::${COMMIT_SHA} :scream: compilation failed"
elif [[ ${TESTS_PASS} != "true" ]]; then
echo "::set-output name=COMMENT_BODY::${COMMIT_SHA} :fire: some unit-tests are failing ${CDASH_URL}"
elif [[ ${TESTS_FAILING} != "0" ]]; then
echo "::set-output name=COMMENT_BODY::${COMMIT_SHA} :fire: ${TESTS_FAILING} unit-tests are failing ${CDASH_URL}"
elif [[ ${RUNNERS_OUTCOME} != "success" ]]; then
echo "::set-output name=COMMENT_BODY::${COMMIT_SHA} :broken_heart: QGIS runners test failed"
else
Expand Down

0 comments on commit 9cebb25

Please sign in to comment.