add exercise #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dart Tests | |
on: | |
push: # Run tests on every push | |
branches: [ master ] # Change 'main' to your branch if needed | |
pull_request: # Run tests on PRs | |
jobs: | |
test: | |
runs-on: ubuntu-latest # Use the latest Ubuntu environment | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 # Get the latest code | |
- name: Setup Dart | |
uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: stable # Use stable Dart SDK | |
- name: Install dependencies | |
run: dart pub get | |
- name: Run tests and capture output | |
run: | | |
dart test -n "Other Exercises" --reporter json > test_results.json || true | |
- name: Count passed and failed tests | |
run: | | |
PASSED_TESTS=$(grep -o '"result":"success"' test_results.json | wc -l) | |
FAILED_TESTS=$(grep -o '"result":"failure"' test_results.json | wc -l) | |
TOTAL_TESTS=$((PASSED_TESTS + FAILED_TESTS)) | |
echo "✅ Passed tests: $PASSED_TESTS" >> $GITHUB_STEP_SUMMARY | |
echo "❌ Failed tests: $FAILED_TESTS" >> $GITHUB_STEP_SUMMARY | |
echo "📊 Total tests: $TOTAL_TESTS" >> $GITHUB_STEP_SUMMARY |