Skip to content

Commit

Permalink
ci: update eslint and prettier rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ZL-Asica committed Nov 5, 2024
1 parent 5406579 commit a5b74d4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 20 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/firebase-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ jobs:
- name: ๐Ÿ“‚ Install Packages
run: npm ci

# ๐Ÿšจ Run Lint check
- name: ๐Ÿšจ Run Lint
run: npm run lint:fix | tee lint-results.txt

# ๐ŸŽจ Run Prettier format check
- name: ๐ŸŽจ Run Prettier
run: npm run format | tee prettier-results.txt

- name: ๐Ÿงช Run Tests with Vitest
run: npm run test:ci

Expand Down
61 changes: 41 additions & 20 deletions .github/workflows/firebase-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,40 +29,61 @@ jobs:
- name: ๐Ÿ”จ Build the app
run: npm run build

# ๐Ÿšจ Run Lint check
- name: ๐Ÿšจ Run Lint
run: npm run lint:fix | tee lint-results.txt

# ๐ŸŽจ Run Prettier format check
- name: ๐ŸŽจ Run Prettier
run: npm run format | tee prettier-results.txt

- name: ๐Ÿงช Test the app with Vitest
run: npm run test:ci | tee test-results.txt
# ๐Ÿšฎ Clean up all results for comment
- name: ๐Ÿšฎ Clean up results
run: |
sed -i 's/\x1b\[[0-9;]*m//g' prettier-results.txt
sed -i 's/\x1b\[[0-9;]*m//g' lint-results.txt
sed -i 's/\x1b\[[0-9;]*m//g' test-results.txt
# ๐Ÿšฎ Clean up test results for comment
- name: ๐Ÿšฎ Clean up test results
run: sed -i 's/\x1b\[[0-9;]*m//g' test-results.txt # Removes ANSI color codes

# ๐Ÿ“„ Format test results for better readability
- name: ๐Ÿ“„ Format test results
# ๐Ÿ“„ Format all results for better readability
- name: ๐Ÿ“„ Format all results
run: |
{
echo "### ๐Ÿงช Test Results"
echo ""
if grep -q "failed" test-results.txt; then
# Extract failed test details if any
echo "โŒ **Some tests failed**:"
echo '```'
grep -E "Test Files|Tests|Duration|failed" test-results.txt
echo '```'
echo ""
echo "๐Ÿ’ฅ Please review the failed tests above."
else
# Format output for passing tests
grep -E "(Test Files|Tests|Duration)" test-results.txt | while read -r line; do
if [[ $line == *"Test Files"* ]]; then
echo "๐Ÿ—‚ **Test Summary**: $line"
elif [[ $line == *"Tests"* ]]; then
echo "โœ… **Tests Passed**: $line"
elif [[ $line == *"Duration"* ]]; then
echo "โฑ๏ธ **Total Duration**: $line"
fi
done
echo ""
echo "๐ŸŽ‰ All tests passed successfully!"
echo "โœ… **Tests Passed**: All tests passed successfully!"
fi
echo ""
echo "---"
echo ""
echo "### ๐ŸŽจ Prettier Format Check"
echo ""
if grep -q "(changed)" prettier-results.txt; then
echo "โš ๏ธ **Prettier Issues Found** - Some format issues are fixed automatically by Prettier:"
echo '```'
grep -E "\s+\(changed\)" prettier-results.txt || true
echo '```'
else
echo "โœ… **Prettier**: No formatting issues found!"
fi
echo ""
echo "### ๐ŸŽจ Lint Check"
echo ""
if grep -qE "^[^0]* problems" lint-results.txt; then
echo "โš ๏ธ **Lint Issues Found** - PLEASE FIX THEM!"
echo '```'
cat lint-results.txt
echo '```'
else
echo "โœ… **Lint**: No linting issues found!"
fi
} > formatted-results.txt
Expand Down

0 comments on commit a5b74d4

Please sign in to comment.