Feature/create project v0 #93
Workflow file for this run
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: Build and Test | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master, develop ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| security-events: write # For CodeQL | |
| pull-requests: write # For PR comments | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Shallow clones should be disabled for better analysis | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build with Maven | |
| run: ./mvnw clean verify -B | |
| - name: Generate test report | |
| if: always() | |
| run: ./mvnw surefire-report:report-only -B | |
| - name: Generate JaCoCo coverage report | |
| run: ./mvnw jacoco:report -B | |
| # - name: Run SpotBugs (Static Analysis) | |
| # run: ./mvnw spotbugs:check -B | |
| # continue-on-error: true | |
| # - name: Run Checkstyle (Code Style) | |
| # run: ./mvnw checkstyle:checkstyle -B | |
| # continue-on-error: true | |
| # - name: Run PMD (Code Quality) | |
| # run: ./mvnw pmd:check -B | |
| # continue-on-error: true | |
| - name: Generate aggregate reports | |
| if: always() | |
| run: | | |
| ./mvnw site -DskipTests -B || true | |
| # ./mvnw spotbugs:spotbugs -B || true | |
| # ./mvnw pmd:pmd -B || true | |
| - name: Upload static analysis results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: static-analysis-reports | |
| path: | | |
| **/target/site/ | |
| # **/target/spotbugsXml.xml | |
| # **/target/checkstyle-result.xml | |
| # **/target/pmd.xml | |
| retention-days: 30 | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: | | |
| **/target/surefire-reports/ | |
| **/target/site/jacoco/ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| **/target/*.jar | |
| !**/target/*-sources.jar | |
| !**/target/*-javadoc.jar | |
| retention-days: 7 | |
| - name: Package application | |
| run: ./mvnw package -DskipTests -B | |
| - name: Upload JAR artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jar-artifacts | |
| path: | | |
| docker/*.jar | |
| **/target/*.jar | |
| retention-days: 30 | |
| - name: Comment PR with analysis summary | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| continue-on-error: true | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| let comment = '## 📊 Static Analysis Summary\n\n'; | |
| // Check for SpotBugs results | |
| comment += '### 🔍 Code Quality Checks\n'; | |
| comment += '- ✅ JaCoCo coverage report generated\n\n'; | |
| comment += '📦 Download detailed reports from the workflow artifacts.\n'; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: comment | |
| }); |