121 lines
4.3 KiB
YAML
121 lines
4.3 KiB
YAML
name: Quality Checks
|
||
|
||
on:
|
||
push:
|
||
branches: [ main, development, 'feature/**' ]
|
||
pull_request:
|
||
branches: [ main, development ]
|
||
|
||
jobs:
|
||
backend-quality:
|
||
name: Backend (Go)
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||
|
||
- name: Set up Go
|
||
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
|
||
with:
|
||
go-version: '1.25.4'
|
||
cache-dependency-path: backend/go.sum
|
||
|
||
- name: Run Go tests
|
||
id: go-tests
|
||
working-directory: backend
|
||
run: |
|
||
go test -v -coverprofile=coverage.out ./... 2>&1 | tee test-output.txt
|
||
exit ${PIPESTATUS[0]}
|
||
|
||
- name: Go Test Summary
|
||
if: always()
|
||
working-directory: backend
|
||
run: |
|
||
echo "## 🔧 Backend Test Results" >> $GITHUB_STEP_SUMMARY
|
||
if [ "${{ steps.go-tests.outcome }}" == "success" ]; then
|
||
echo "✅ **All tests passed**" >> $GITHUB_STEP_SUMMARY
|
||
PASS_COUNT=$(grep -c "^--- PASS" test-output.txt || echo "0")
|
||
echo "- Tests passed: $PASS_COUNT" >> $GITHUB_STEP_SUMMARY
|
||
else
|
||
echo "❌ **Tests failed**" >> $GITHUB_STEP_SUMMARY
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "### Failed Tests:" >> $GITHUB_STEP_SUMMARY
|
||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||
grep -E "^--- FAIL|FAIL\s+github" test-output.txt || echo "See logs for details"
|
||
grep -E "^--- FAIL|FAIL\s+github" test-output.txt >> $GITHUB_STEP_SUMMARY || echo "See logs for details" >> $GITHUB_STEP_SUMMARY
|
||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||
fi
|
||
|
||
- name: Upload coverage to Codecov
|
||
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
|
||
with:
|
||
token: ${{ secrets.CODECOV_TOKEN }}
|
||
files: ./backend/coverage.out
|
||
flags: backend
|
||
fail_ci_if_error: true
|
||
|
||
- name: Run golangci-lint
|
||
uses: golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9.1.0
|
||
with:
|
||
version: latest
|
||
working-directory: backend
|
||
args: --timeout=5m
|
||
continue-on-error: true
|
||
|
||
frontend-quality:
|
||
name: Frontend (React)
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||
|
||
- name: Set up Node.js
|
||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
||
with:
|
||
node-version: '24.11.1'
|
||
cache: 'npm'
|
||
cache-dependency-path: frontend/package-lock.json
|
||
|
||
- name: Install dependencies
|
||
working-directory: frontend
|
||
run: npm ci
|
||
|
||
- name: Run frontend tests
|
||
id: frontend-tests
|
||
working-directory: frontend
|
||
run: |
|
||
npm run test:coverage 2>&1 | tee test-output.txt
|
||
exit ${PIPESTATUS[0]}
|
||
|
||
- name: Frontend Test Summary
|
||
if: always()
|
||
working-directory: frontend
|
||
run: |
|
||
echo "## ⚛️ Frontend Test Results" >> $GITHUB_STEP_SUMMARY
|
||
if [ "${{ steps.frontend-tests.outcome }}" == "success" ]; then
|
||
echo "✅ **All tests passed**" >> $GITHUB_STEP_SUMMARY
|
||
# Extract test counts from vitest output
|
||
if grep -q "Tests:" test-output.txt; then
|
||
grep "Tests:" test-output.txt | tail -1 >> $GITHUB_STEP_SUMMARY
|
||
fi
|
||
else
|
||
echo "❌ **Tests failed**" >> $GITHUB_STEP_SUMMARY
|
||
echo "" >> $GITHUB_STEP_SUMMARY
|
||
echo "### Failed Tests:" >> $GITHUB_STEP_SUMMARY
|
||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||
# Extract failed test info from vitest output
|
||
grep -E "FAIL|✕|×|AssertionError|Error:" test-output.txt | head -30 >> $GITHUB_STEP_SUMMARY || echo "See logs for details" >> $GITHUB_STEP_SUMMARY
|
||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||
fi
|
||
|
||
- name: Upload coverage to Codecov
|
||
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
|
||
with:
|
||
token: ${{ secrets.CODECOV_TOKEN }}
|
||
directory: ./frontend/coverage
|
||
flags: frontend
|
||
fail_ci_if_error: true
|
||
|
||
- name: Run frontend lint
|
||
working-directory: frontend
|
||
run: npm run lint
|
||
continue-on-error: true
|