Merge pull request #374 from Mere-Solace/feat/umbral-lifecycle-keyfra… #168
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 Checks | |
| on: | |
| push: | |
| branches: [ main, dev, gig-dev ] | |
| pull_request: | |
| branches: [ main, dev ] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-check: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'microsoft' | |
| cache: 'gradle' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew build --no-daemon | |
| - name: Run Checkstyle | |
| run: ./gradlew checkstyleMain --no-daemon | |
| continue-on-error: true | |
| - name: Check code formatting with Spotless | |
| run: ./gradlew spotlessCheck --no-daemon | |
| continue-on-error: true | |
| - name: Lint markdown files | |
| uses: DavidAnson/markdownlint-cli2-action@v18 | |
| with: | |
| globs: '**/*.md' | |
| continue-on-error: true | |
| - name: Generate Javadoc | |
| run: ./gradlew javadoc --no-daemon | |
| continue-on-error: true | |
| - name: Check Javadoc coverage | |
| run: ./gradlew javadocCoverage --no-daemon | |
| continue-on-error: true | |
| - name: Verify config.yaml exists in JAR | |
| run: | | |
| ./gradlew build --no-daemon | |
| jar tf build/libs/Sword-1.0-SNAPSHOT.jar | grep -q "config.yaml" && echo "✓ config.yaml found in JAR" || (echo "✗ config.yaml missing from JAR" && exit 1) | |
| - name: Upload Checkstyle report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: checkstyle-report | |
| path: build/reports/checkstyle/ | |
| - name: Upload Javadoc report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: javadoc-report | |
| path: build/docs/javadoc/ | |
| - name: Comment PR with quality check results | |
| if: failure() && github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| let message = '## Code Quality Issues Detected\n\n'; | |
| message += '### Formatting\n'; | |
| message += '**Fix:** Run `./gradlew spotlessApply` to auto-fix code formatting.\n\n'; | |
| message += '### Markdown\n'; | |
| message += 'Check markdown files for:\n'; | |
| message += '- Missing language specs on fenced code blocks (\\`\\`\\`java, \\`\\`\\`yaml, etc.)\n'; | |
| message += '- Missing blank lines around code fences\n\n'; | |
| message += '### Documentation\n'; | |
| message += 'Review Javadoc coverage report in artifacts.\n\n'; | |
| message += '### Config Validation\n'; | |
| message += 'Ensure `config.yaml` is properly packaged in JAR.\n\n'; | |
| message += '_See workflow artifacts for detailed reports._'; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: message | |
| }) |