Claude/refactor reduce boilerplate #1
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: Code Quality | |
| on: | |
| push: | |
| branches: [ "main", "develop" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| test-and-coverage: | |
| name: Unit Tests & Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history for better analysis | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Run tests with coverage | |
| run: mvn -B clean test jacoco:report | |
| - name: Generate coverage report | |
| run: mvn jacoco:report | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./target/site/jacoco/jacoco.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| verbose: true | |
| - name: Archive coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: target/site/jacoco/ | |
| retention-days: 30 | |
| - name: Comment coverage on PR | |
| if: github.event_name == 'pull_request' | |
| uses: madrapps/[email protected] | |
| with: | |
| paths: ${{ github.workspace }}/target/site/jacoco/jacoco.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| min-coverage-overall: 50 | |
| min-coverage-changed-files: 60 | |
| title: '📊 Code Coverage Report' | |
| update-comment: true | |
| code-analysis: | |
| name: Static Code Analysis | |
| runs-on: ubuntu-latest | |
| needs: test-and-coverage | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Compile project | |
| run: mvn -B compile test-compile | |
| - name: Run Maven verify | |
| run: mvn -B verify -DskipTests | |
| build-quality: | |
| name: Build Quality Check | |
| runs-on: ubuntu-latest | |
| needs: [test-and-coverage, code-analysis] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Full build with all checks | |
| run: mvn -B clean package | |
| - name: Archive artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| target/*.jar | |
| target/site/jacoco/ | |
| retention-days: 7 |