From aac1ed4b76fec617e808993bf21e49115bf32a7a Mon Sep 17 00:00:00 2001 From: charlestian23 Date: Tue, 10 Oct 2023 13:58:20 -0400 Subject: [PATCH] Added print messages --- .github/workflows/run-tests.yml | 40 ++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1a22769f7..d81bafc36 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -29,9 +29,19 @@ jobs: - name: Build with Gradle run: ./gradlew build -x test - - name: Run JUnit Tests on Linux + - name: Run JUnit Tests run: | - ./gradlew test + test_output=$(./gradlew test --quiet | grep -E "tests? passed|tests? failed") + echo "$test_output" + tests_run=$(echo "$test_output" | grep -Eo "[0-9]+" | head -n 1) + tests_passed=$(echo "$test_output" | grep -Eo "[0-9]+" | tail -n 1) + tests_failed=$((tests_run - tests_passed)) + echo "Tests Run: $tests_run" + echo "Tests Passed: $tests_passed" + echo "Tests Failed: $tests_failed" + if [[ $tests_failed -gt 0 ]]; then + exit 1 + fi test-macos: runs-on: macos-latest @@ -53,7 +63,17 @@ jobs: - name: Run JUnit Tests on macOS run: | - ./gradlew test + test_output=$(./gradlew test --quiet | grep -E "tests? passed|tests? failed") + echo "$test_output" + tests_run=$(echo "$test_output" | grep -Eo "[0-9]+" | head -n 1) + tests_passed=$(echo "$test_output" | grep -Eo "[0-9]+" | tail -n 1) + tests_failed=$((tests_run - tests_passed)) + echo "Tests Run: $tests_run" + echo "Tests Passed: $tests_passed" + echo "Tests Failed: $tests_failed" + if [[ $tests_failed -gt 0 ]]; then + exit 1 + fi test-windows: runs-on: windows-latest @@ -66,8 +86,18 @@ jobs: uses: actions/setup-java@v2 with: java-version: 11 - distribution: 'adopt' # Specify the distribution, e.g., 'adopt', 'adopt@1.11', etc. + distribution: 'adopt' - name: Run JUnit Tests on Windows run: | - .\gradlew.bat test \ No newline at end of file + test_output=$(./gradlew.bat test --quiet | grep -E "tests? passed|tests? failed") + echo "$test_output" + tests_run=$(echo "$test_output" | grep -Eo "[0-9]+" | head -n 1) + tests_passed=$(echo "$test_output" | grep -Eo "[0-9]+" | tail -n 1) + tests_failed=$((tests_run - tests_passed)) + echo "Tests Run: $tests_run" + echo "Tests Passed: $tests_passed" + echo "Tests Failed: $tests_failed" + if [[ $tests_failed -gt 0 ]]; then + exit 1 + fi \ No newline at end of file