Skip to content

refactor(mumu): 优化注释 #167

refactor(mumu): 优化注释

refactor(mumu): 优化注释 #167

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Checkstyle
on:
push:
branches: [ "main", "develop" ]
paths:
- '**/*.java'
- '**/*.properties'
- '**/*.xml'
pull_request:
branches: [ "main", "develop" ]
paths:
- '**/*.java'
- '**/*.properties'
- '**/*.xml'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# 配置 Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
# 执行 Checkstyle 脚本
- name: Checkstyle with Gradle Wrapper
run: |
chmod +x ./checkstyle.sh
./checkstyle.sh
continue-on-error: true
# 判断是否存在 Checkstyle 报告并上传
- name: Check if Checkstyle Report exists and Upload
id: check_checkstyle_report
run: |
REPORT_PATH="$(find . -name "main.html" -path "**/build/reports/checkstyle/main.html")"
if [ -n "$REPORT_PATH" ]; then
echo "Checkstyle reports found. Uploading..."
echo "mumu_checkstyle_reports_found=true" >> $GITHUB_ENV
else
echo "No Checkstyle reports found. Skipping upload."
echo "mumu_checkstyle_reports_found=false" >> $GITHUB_ENV
fi
# 上传 Checkstyle 报告(仅在找到报告时执行)
- name: Upload Checkstyle Reports
if: env.mumu_checkstyle_reports_found == 'true'
uses: actions/upload-artifact@v4
with:
name: Checkstyle-Reports
path: '**/build/reports/checkstyle/main.html'
# 根据是否找到报告来标记任务失败或成功
- name: Mark task success or failure
if: env.mumu_checkstyle_reports_found == 'true'
run: exit 1 # 标记为失败
- name: Mark task success (if no report)
if: env.mumu_checkstyle_reports_found == 'false'
run: echo "No Checkstyle reports found, task completed successfully."