fix:code check plugin(Checkstyle +PMD+SpotBugs) #46
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: Checkstyle Code Quality | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| branches: | |
| - develop | |
| jobs: | |
| checkstyle: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # 必须拉取完整历史,才能比较分支差异 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| # 缓存 Maven 依赖,加速构建 | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| # 直接运行 Checkstyle 检查(不执行完整的 package) | |
| - name: Run Checkstyle | |
| run: bash .github/scripts/checkstyle-pr.sh | |
| env: | |
| GITHUB_BASE_REF: ${{ github.base_ref }} | |
| - name: Debug - list all checkstyle reports | |
| run: | | |
| echo "当前工作目录: $(pwd)" | |
| echo "=== 列出所有 target 目录 ===" | |
| find . -type d -name "target" -exec echo "目录: {}" \; -exec ls -la {}/ \; | |
| echo "=== 查找 checkstyle 文件 ===" | |
| find . -name "checkstyle*.xml" -o -name "checkstyle*.html" | while read f; do echo "找到: $f"; done | |
| # 如果检查失败,仍然上传报告供查看 | |
| - name: Upload Checkstyle report | |
| if: always() # 即使失败也上传报告 | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: checkstyle-report | |
| path: | | |
| **/target/checkstyle-result.xml | |
| **/target/site/checkstyle.html | |
| if-no-files-found: warn |