diff --git a/.github/workflows/update-badges.yaml b/.github/workflows/update-badges.yaml index 8376e6e..0cd0ddc 100644 --- a/.github/workflows/update-badges.yaml +++ b/.github/workflows/update-badges.yaml @@ -33,9 +33,23 @@ jobs: env: GH_TOKEN: ${{ steps.app-token.outputs.token }} run: | - UNIT=$(cargo nextest run --all-features -E 'not test(connects_to_public) & not test(get_block_range_supports)' 2>&1 | grep -oP '(\d+) tests run' | grep -oP '^\d+') - INT=$(cargo nextest run --all-features -E 'test(connects_to_public) | test(get_block_range_supports)' 2>&1 | grep -oP '(\d+) tests run' | grep -oP '^\d+') - DOC=$(cargo test --doc --all-features 2>&1 | grep -oP '(\d+) passed' | grep -oP '^\d+') + set +e + + UNIT_OUTPUT=$(cargo nextest run --all-features -E 'not test(connects_to_public) & not test(get_block_range_supports)' 2>&1) + UNIT=$(echo "$UNIT_OUTPUT" | grep -oP '\d+(?= tests? run)' | head -1) + UNIT=${UNIT:-0} + + INT_OUTPUT=$(cargo nextest run --all-features -E 'test(connects_to_public) | test(get_block_range_supports)' 2>&1) + INT=$(echo "$INT_OUTPUT" | grep -oP '\d+(?= tests? run)' | head -1) + INT=${INT:-0} + + DOC_OUTPUT=$(cargo test --doc --all-features 2>&1) + DOC=$(echo "$DOC_OUTPUT" | grep -oP '\d+(?= passed)' | head -1) + DOC=${DOC:-0} + + set -e + + echo "Unit: $UNIT, Doc: $DOC, Integration: $INT" echo "{\"schemaVersion\":1,\"label\":\"unit tests\",\"message\":\"$UNIT\",\"color\":\"brightgreen\"}" > /tmp/unit.json echo "{\"schemaVersion\":1,\"label\":\"doc tests\",\"message\":\"$DOC\",\"color\":\"violet\"}" > /tmp/doc.json