Skip to content

fix:code check plugin(Checkstyle +PMD+SpotBugs) #24

fix:code check plugin(Checkstyle +PMD+SpotBugs)

fix:code check plugin(Checkstyle +PMD+SpotBugs) #24

Workflow file for this run

name: Checkstyle Code Quality
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
checkstyle:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# 缓存 Maven 依赖,加速构建
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# 直接运行 Checkstyle 检查(不执行完整的 package)
- name: Run Checkstyle
run: mvn checkstyle:check
# 如果检查失败,仍然上传报告供查看
- name: Upload Checkstyle report
if: always() # 即使失败也上传报告
uses: actions/upload-artifact@v4
with:
name: checkstyle-report
path: target/checkstyle-result.xml