83 lines
1.9 KiB
YAML
83 lines
1.9 KiB
YAML
name: CI 测试流水线 (CI Test Pipeline)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
- 'feature/**'
|
|
paths:
|
|
- 'ljwx-boot-modules/**'
|
|
- 'ljwx-boot-common/**'
|
|
- 'pom.xml'
|
|
- '**/pom.xml'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- develop
|
|
|
|
jobs:
|
|
unit-tests:
|
|
name: 单元测试 (Unit Tests)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: 检出代码 (Checkout Code)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: 设置 Java 21 (Setup Java)
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '21'
|
|
cache: 'maven'
|
|
|
|
- name: 运行单元测试 (Run Unit Tests)
|
|
run: |
|
|
cd ljwx-boot
|
|
mvn clean test -B -V \
|
|
-Dmaven.test.failure.ignore=false \
|
|
-Dsurefire.useFile=true
|
|
env:
|
|
MAVEN_OPTS: "-Xmx2048m -Xms512m"
|
|
|
|
- name: 生成测试报告 (Generate Test Report)
|
|
if: always()
|
|
run: |
|
|
cd ljwx-boot
|
|
./run-tests.sh coverage
|
|
|
|
- name: 上传测试报告 (Upload Test Reports)
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-reports-${{ github.run_number }}
|
|
path: |
|
|
ljwx-boot/ljwx-boot-modules/target/surefire-reports/
|
|
ljwx-boot/ljwx-boot-modules/target/site/jacoco/
|
|
retention-days: 30
|
|
|
|
code-quality:
|
|
name: 代码质量检查 (Code Quality)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: 检出代码 (Checkout Code)
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 设置 Java 21 (Setup Java)
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '21'
|
|
cache: 'maven'
|
|
|
|
- name: 编译检查 (Compile Check)
|
|
run: |
|
|
cd ljwx-boot
|
|
mvn clean compile test-compile -B -V
|