This commit is contained in:
@@ -6,39 +6,31 @@ on: [push]
|
||||
jobs:
|
||||
class-change-check:
|
||||
if: ${{ gitea.ref != 'refs/heads/pre' && gitea.ref != 'refs/heads/dev' && gitea.ref != 'refs/heads/master-2.0' }}
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: jdk11
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
run: |
|
||||
git config --global http.sslVerify false
|
||||
git clone "https://${{ gitea.token }}@git.niujiekeji.com/${{ gitea.repository }}.git" .
|
||||
git clone --depth=2 \
|
||||
"http://oauth2:${{ gitea.token }}@host.docker.internal:3000/${{ gitea.repository }}.git" \
|
||||
.
|
||||
git checkout ${{ gitea.sha }}
|
||||
echo "当前提交: $(git rev-parse HEAD)"
|
||||
echo "上一提交: $(git rev-parse HEAD~1 2>/dev/null || echo '无')"
|
||||
|
||||
- name: 检查配置文件
|
||||
- name: 检查配置文件与预编译 jar
|
||||
run: |
|
||||
if [ ! -f .gitea/config.yaml ]; then
|
||||
echo "错误: 缺少 .gitea/config.yaml"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f .gitea/workflows/class-checker.jar ]; then
|
||||
echo "错误: 缺少 .gitea/workflows/class-checker.jar"
|
||||
echo "请本地执行: powershell -File scripts/build-class-checker.ps1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 安装 JDK 和 Maven
|
||||
- name: 验证 JDK
|
||||
run: |
|
||||
if ! command -v java >/dev/null 2>&1; then
|
||||
apt-get update -qq
|
||||
apt-get install -y openjdk-11-jdk
|
||||
fi
|
||||
if ! command -v mvn >/dev/null 2>&1; then
|
||||
apt-get update -qq
|
||||
apt-get install -y maven
|
||||
fi
|
||||
echo "Java: $(java -version 2>&1 | head -1)"
|
||||
echo "Maven: $(mvn -version 2>&1 | head -1)"
|
||||
|
||||
- name: 编译检测工具
|
||||
run: mvn -q -f .gitea/class-checker/pom.xml package -DskipTests
|
||||
|
||||
- name: 执行类变更检测
|
||||
run: |
|
||||
@@ -48,7 +40,7 @@ jobs:
|
||||
exit 0
|
||||
fi
|
||||
COMMIT_TIME=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S')
|
||||
java -jar .gitea/class-checker/target/class-checker.jar \
|
||||
java -jar .gitea/workflows/class-checker.jar \
|
||||
--config .gitea/config.yaml \
|
||||
--repo-root . \
|
||||
--old-sha "$OLD_SHA" \
|
||||
|
||||
Reference in New Issue
Block a user