From 14714a8055a68b699107fa0b2b51bc3d76c40b46 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Wed, 16 Sep 2020 09:56:12 +0100 Subject: [PATCH 1/3] Travis: remove status functionality Unfortunately, we need to remove status functionality as it exposes an information it should rather not. There is no other way we can do it in the pull request coming from forks (most of our PRs are from forks). It is better if we use pass/failure what Travis provides. The information are in the logs. It should always print the status info at the very end. A test should have "echo Failed with a reason...." --- .travis.yml | 48 +----------------------------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/.travis.yml b/.travis.yml index cda8aae9d9..b2c2fa16b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,13 +33,6 @@ cache: before_install: - source tools/test/travis-ci/functions.sh - - set_status "pending" "Test started." - -after_success: - - set_status "success" "Success!" - -after_failure: - - set_status "failure" "Test failed." matrix: @@ -86,8 +79,6 @@ matrix: | while read file; do cp --parents "${file}" SCANCODE_NEW_FILES; done - scancode -l --json-pp scancode_new_files.json SCANCODE_NEW_FILES - python ./tools/test/travis-ci/scancode-evaluate.py -f scancode_new_files.json || true - after_success: - - python ./tools/test/travis-ci/scancode-evaluate.py -f scancode.json - cat scancode-evaluate.log - COUNT=$(cat scancode-evaluate.log | grep 'File:' | wc -l) - python ./tools/test/travis-ci/scancode-evaluate.py -f scancode_new_files.json @@ -96,22 +87,13 @@ matrix: - | if [ $COUNT == 0 ] && [ $COUNT_NEW_FILES == 0 ]; then echo "License check OK"; - STATUSM="All licenses OK"; - set_status "success" "$STATUSM"; elif [ $COUNT_NEW_FILES != 0 ]; then - echo "License check failed, files with the license issues found"; - STATUSM="Needs review, license issues in modified files: ${COUNT}, new files: ${COUNT_NEW_FILES}"; - set_status "failure" "$STATUSM"; + echo "License check failed, new files with the license issues found"; false; else echo "License check failed, please review license issues found in modified files"; - STATUSM="Needs review, ${COUNT} license issues found"; - set_status "success" "$STATUSM"; - false; fi - - - <<: *basic-vm name: "include check" env: NAME=include_check @@ -305,20 +287,6 @@ matrix: # Run profiling tests - make -C ${EVENTS}/tests/unit prof | tee prof - ccache -s - after_success: - # Update status, comparing with master if possible. - - | - CURR=$(grep -o '[0-9]\+ cycles' prof | awk '{sum += $1} END {print sum}') - PREV=$(curl -u "${MBED_BOT}" https://api.github.com/repos/${TRAVIS_REPO_SLUG}/status/master \ - | jq -re "select(.sha != \"${TRAVIS_COMMIT}\") - | .statuses[] | select(.context == \"travis-ci/${NAME}\").description - | capture(\"runtime is (?[0-9]+)\").runtime" \ - || echo 0) - - delta="" - [ "${PREV}" -ne 0 ] && delta="($(printf "%+d" "$(( ${CURR} - ${PREV} ))" cycles)" - - set_status "success" "Success! Runtime is ${CURR} cycles. ${delta}" - <<: *extended-vm name: "littlefs" @@ -379,17 +347,3 @@ matrix: CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR" | tee sizes - ccache -s - after_success: - # Update status, comparing with master if possible. - - | - CURR=$(tail -n1 sizes | awk '{print $1}') - PREV=$(curl -u "${MBED_BOT}" https://api.github.com/repos/${TRAVIS_REPO_SLUG}/status/master \ - | jq -re "select(.sha != \"${TRAVIS_COMMIT}\") - | .statuses[] | select(.context == \"travis-ci/${NAME}\").description - | capture(\"code size is (?[0-9]+)\").size" \ - || echo 0) - - delta="" - [ "${PREV}" -ne 0 ] && delta="($(printf "%+0.2f%%" "$(<<< "100 * ((${CURR} - ${PREV})/${PREV})" bc -l)"))" - - set_status "success" "Success! Code size is ${CURR}B. ${delta}" From 85233e066a1d5d5b7a84fe646d986bbb046b4145 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Wed, 23 Sep 2020 16:04:49 +0100 Subject: [PATCH 2/3] travis: fix license ok, return true --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index b2c2fa16b9..ba4c189af2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,11 +87,13 @@ matrix: - | if [ $COUNT == 0 ] && [ $COUNT_NEW_FILES == 0 ]; then echo "License check OK"; + true; elif [ $COUNT_NEW_FILES != 0 ]; then echo "License check failed, new files with the license issues found"; false; else echo "License check failed, please review license issues found in modified files"; + false; fi - <<: *basic-vm From 96740b6bb3e700b908d2c69940903e9b21d96005 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Wed, 30 Sep 2020 10:32:57 +0100 Subject: [PATCH 3/3] travis: count always with true, status return later --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ba4c189af2..8507365e51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -80,10 +80,10 @@ matrix: - scancode -l --json-pp scancode_new_files.json SCANCODE_NEW_FILES - python ./tools/test/travis-ci/scancode-evaluate.py -f scancode_new_files.json || true - cat scancode-evaluate.log - - COUNT=$(cat scancode-evaluate.log | grep 'File:' | wc -l) + - COUNT=$(cat scancode-evaluate.log | grep 'File:' | wc -l) || true - python ./tools/test/travis-ci/scancode-evaluate.py -f scancode_new_files.json - cat scancode-evaluate.log - - COUNT_NEW_FILES=$(cat scancode-evaluate.log | grep 'File:' | wc -l) + - COUNT_NEW_FILES=$(cat scancode-evaluate.log | grep 'File:' | wc -l) || true - | if [ $COUNT == 0 ] && [ $COUNT_NEW_FILES == 0 ]; then echo "License check OK";