mirror of
https://gitee.com/jzsw-it/yexuejc-base.git
synced 2026-10-25 17:20:19 +08:00
- Gitea ci.yaml: 改用 ./mvnw,修复 gitea.event_name 变量,去掉硬编码项目名 - Gitea package.yaml: 修复 GITEA_REF_NAME/GITEA_ENV,去掉硬编码项目名 - GitHub ci.yaml: 按分支自动检测 JDK 版本(避免跨版本编译失败),release 仅 tag 触发 - GitLab ci.yml: 简化 only 规则,修正缩进 - Gitee: 删除错误的 gitee.yml(混用语法),新增 .gitee-ci.yml(GitLab CI 兼容格式)
85 lines
1.7 KiB
YAML
85 lines
1.7 KiB
YAML
name: CI - Build and Quality Check
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- jre8
|
|
- jre11
|
|
- jre17
|
|
- jre21
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- jre8
|
|
- jre11
|
|
- jre17
|
|
- jre21
|
|
|
|
env:
|
|
MAVEN_OPTS: -Xmx512m
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container: maven:3.9-eclipse-temurin-21
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Compile
|
|
run: ./mvnw clean compile
|
|
|
|
- name: Run tests
|
|
run: ./mvnw test
|
|
|
|
- name: Quality check (Checkstyle + PMD)
|
|
run: ./mvnw verify -DskipTests
|
|
|
|
- name: JaCoCo report
|
|
run: ./mvnw jacoco:report
|
|
continue-on-error: true
|
|
|
|
- name: Package
|
|
run: ./mvnw package -DskipTests
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: build-artifacts
|
|
path: target/*.jar
|
|
retention-days: 7
|
|
|
|
security-check:
|
|
runs-on: ubuntu-latest
|
|
container: maven:3.9-eclipse-temurin-21
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: OWASP dependency check
|
|
run: ./mvnw org.owasp:dependency-check-maven:check
|
|
continue-on-error: true
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
container: maven:3.9-eclipse-temurin-21
|
|
needs: [build]
|
|
|
|
if: >-
|
|
gitea.event_name == 'push' && (
|
|
gitea.ref == 'refs/heads/master' ||
|
|
gitea.ref == 'refs/heads/jre21'
|
|
)
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Prepare release
|
|
run: |
|
|
VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
|
|
echo "Releasing version: $VERSION"
|