build: add pr check

This commit is contained in:
maliang
2024-05-24 17:47:16 +08:00
committed by Charles7c
parent cf18c1046b
commit c34e703fd3
5 changed files with 88 additions and 40 deletions

28
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Build
on:
pull_request:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
jdk-version:
- 17
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "adopt"
java-version: ${{ matrix.jdk-version }}
cache: "maven"
- name: Compile
run: |
sed -i.bak '/<repositories>/,/<\/repositories>/d' pom.xml
sed -i.bak '/<pluginRepositories>/,/<\/pluginRepositories>/d' pom.xml
mvn -B compile --file pom.xml

View File

@@ -13,17 +13,20 @@ jobs:
steps: steps:
# 1、检出源码 # 1、检出源码
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@v4
# 2、安装 Java 环境 # 2、安装 Java 环境
- name: Setup Java - name: Setup Java
uses: actions/setup-java@master uses: actions/setup-java@v4
with: with:
distribution: 'adopt' distribution: "adopt"
java-version: 17 java-version: 17
cache: 'maven' cache: "maven"
# 3、打包 # 3、打包
- name: Build - name: Build
run: mvn -B package --file pom.xml run: |
sed -i.bak '/<repositories>/,/<\/repositories>/d' pom.xml
sed -i.bak '/<pluginRepositories>/,/<\/pluginRepositories>/d' pom.xml
mvn -B package --file pom.xml
# 4、拷贝到服务器 # 4、拷贝到服务器
- name: Copy - name: Copy
uses: garygrossgarten/github-action-scp@release uses: garygrossgarten/github-action-scp@release
@@ -46,33 +49,3 @@ jobs:
cd /docker cd /docker
docker-compose up --force-recreate --build -d continew-admin-server docker-compose up --force-recreate --build -d continew-admin-server
docker images | grep none | awk '{print $3}' | xargs docker rmi docker images | grep none | awk '{print $3}' | xargs docker rmi
# Sonar 扫描
sonar-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@master
with:
distribution: 'adopt'
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Analyze
run: mvn -B verify -Psonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

View File

@@ -3,7 +3,7 @@ name: Release
on: on:
push: push:
tags: tags:
- 'v*' # Push events to matching v*, i.e. v1.0.0 - "v*" # Push events to matching v*, i.e. v1.0.0
jobs: jobs:
release: release:

48
.github/workflows/scan.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: Scan
on:
push:
branches:
- dev
pull_request:
branches:
- dev
jobs:
sonar-scan:
runs-on: ubuntu-latest
strategy:
matrix:
jdk-version:
- 17
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "adopt"
java-version: ${{ matrix.jdk-version }}
cache: "maven"
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Analyze
run: |
sed -i.bak '/<repositories>/,/<\/repositories>/d' pom.xml
sed -i.bak '/<pluginRepositories>/,/<\/pluginRepositories>/d' pom.xml
mvn -B verify -Psonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

View File

@@ -84,8 +84,7 @@ public enum FormTypeEnum implements IBaseEnum<Integer> {
/** /**
* 树形选择 * 树形选择
*/ */
TREE_SELECT(11, "树选择"), TREE_SELECT(11, "树选择"),;
;
private final Integer value; private final Integer value;
private final String description; private final String description;