Skip to content

Bump codecov/codecov-action from 4.6.0 to 6.0.1 #3

Bump codecov/codecov-action from 4.6.0 to 6.0.1

Bump codecov/codecov-action from 4.6.0 to 6.0.1 #3

Workflow file for this run

name: PR Validation
on:
pull_request:
branches:
- main
- 'release/**'
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
checks: write
jobs:
validate:
name: Validate Pull Request
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Compile
run: mvn clean compile -DskipTests
- name: Run Tests
run: mvn test
- name: Generate JaCoCo Coverage Report
run: mvn jacoco:report
- name: Check Code Coverage
run: |
echo "Verifying coverage thresholds..."
mvn jacoco:check
- name: SpotBugs Analysis
run: mvn spotbugs:check
- name: PMD Analysis
run: mvn pmd:check pmd:cpd-check
- name: Checkstyle Analysis
run: mvn checkstyle:check
- name: Maven Enforcer Check
run: mvn enforcer:enforce
- name: Generate JavaDoc
run: mvn javadoc:javadoc
- name: OWASP Dependency Check
run: mvn dependency-check:check -DfailBuildOnCVSS=7
continue-on-error: true
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: target/site/jacoco/
retention-days: 7
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: target/surefire-reports/
retention-days: 7
- name: Comment PR with Results
if: always()
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs');
// Read JaCoCo summary if available
let coverageComment = '### ✅ Code Coverage\n\n';
try {
// This is a simplified version - you might want to parse the actual XML
coverageComment += 'Coverage report generated. Download artifacts to view details.\n';
} catch (e) {
coverageComment += 'Coverage report not available.\n';
}
const comment = `## PR Validation Results
${coverageComment}
### Quality Checks
- ✅ Compilation successful
- ✅ All tests passed
- ✅ Code coverage meets requirements
- ✅ SpotBugs analysis passed
- ✅ PMD analysis passed
- ✅ Checkstyle passed
- ✅ JavaDoc generation successful
**Note:** Full build artifacts are available for download.
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
- name: Fail if Quality Checks Failed
if: failure()
run: |
echo "❌ PR validation failed. Please fix the issues above."
exit 1
pr-title-check:
name: Validate PR Title
runs-on: ubuntu-latest
steps:
- name: Check PR Title Format
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const title = context.payload.pull_request.title;
const validPrefixes = ['feat:', 'fix:', 'docs:', 'style:', 'refactor:', 'test:', 'chore:'];
const isValid = validPrefixes.some(prefix => title.toLowerCase().startsWith(prefix));
if (!isValid) {
core.setFailed(`PR title must start with one of: ${validPrefixes.join(', ')}\nCurrent title: "${title}"`);
} else {
console.log('✅ PR title format is valid');
}
breaking-changes-check:
name: Check for Breaking Changes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for Breaking Changes in Commit Messages
run: |
# Look for "BREAKING CHANGE:" in commit messages
if git log origin/main..HEAD --grep="BREAKING CHANGE:" --oneline | grep -q .; then
echo "⚠️ Breaking changes detected in commits"
echo "breaking_change=true" >> $GITHUB_ENV
else
echo "✅ No breaking changes detected"
echo "breaking_change=false" >> $GITHUB_ENV
fi
- name: Comment if Breaking Changes Found
if: env.breaking_change == 'true'
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ **Breaking Changes Detected**\n\nThis PR contains breaking changes. Make sure:\n- Version is bumped to next major version\n- CHANGELOG is updated with migration guide\n- Deprecation policy is followed'
});