Skip to content

Commit

Permalink
Update coverage-tests.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Aug 2, 2024
1 parent a558ffc commit 3940d8d
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions .github/workflows/coverage-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,64 @@ jobs:
cp -R src unit_tests
cp -R src feature_tests
- name: Create custom output formatter
run: |
cat << EOF > formatter.sh
#!/bin/bash
unit_progress=""
feature_progress=""
update_progress() {
local suite=\$1
local result=\$2
if [ "\$suite" = "unit" ]; then
unit_progress+="\$result"
else
feature_progress+="\$result"
fi
echo -ne "\rUnit: \$unit_progress"
echo -ne "\nFeature: \$feature_progress"
echo -ne "\033[1A" # Move cursor up one line
}
while IFS= read -r line; do
if [[ \$line == *"[x]"* ]]; then
update_progress "\$1" "X"
elif [[ \$line == *"[✓]"* ]]; then
update_progress "\$1" "O"
fi
done
echo # Print a newline at the end
EOF
chmod +x formatter.sh
- name: Execute Tests in Parallel
run: |
mkdir -p coverage
# Start unit tests in the background
(
cd unit_tests
vendor/bin/pest --coverage-php=../coverage/unit.cov --testsuite=UnitFramework
vendor/bin/pest --coverage-php=../coverage/unit.cov --testsuite=UnitFramework | tee unit_output.log | ../formatter.sh unit
) &
# Start feature tests in the background
(
cd feature_tests
vendor/bin/pest --coverage-php=../coverage/feature.cov --testsuite=FeatureHyde,FeatureFramework,Publications,"Realtime Compiler"
vendor/bin/pest --coverage-php=../coverage/feature.cov --testsuite=FeatureHyde,FeatureFramework,Publications,"Realtime Compiler" | tee feature_output.log | ../formatter.sh feature
) &
# Wait for both background processes to finish
wait
- name: Print Unit Test Output
if: always()
run: cat unit_tests/unit_output.log

- name: Print Feature Test Output
if: always()
run: cat feature_tests/feature_output.log

- name: Download phpcov
run: wget https://phar.phpunit.de/phpcov.phar

Expand Down

0 comments on commit 3940d8d

Please sign in to comment.