Skip to content

Commit

Permalink
Added print messages
Browse files Browse the repository at this point in the history
  • Loading branch information
charlestian23 committed Oct 10, 2023
1 parent 57532c4 commit aac1ed4
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -66,8 +86,18 @@ jobs:
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'adopt' # Specify the distribution, e.g., 'adopt', '[email protected]', etc.
distribution: 'adopt'

- name: Run JUnit Tests on Windows
run: |
.\gradlew.bat test
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

0 comments on commit aac1ed4

Please sign in to comment.