Skip to content

Commit

Permalink
build: add pr check
Browse files Browse the repository at this point in the history
  • Loading branch information
m01i0ng authored and Charles7c committed May 24, 2024
1 parent cf18c10 commit c34e703
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 40 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
43 changes: 8 additions & 35 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ jobs:
steps:
# 1、检出源码
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v4
# 2、安装 Java 环境
- name: Setup Java
uses: actions/setup-java@master
uses: actions/setup-java@v4
with:
distribution: 'adopt'
distribution: "adopt"
java-version: 17
cache: 'maven'
cache: "maven"
# 3、打包
- 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、拷贝到服务器
- name: Copy
uses: garygrossgarten/github-action-scp@release
Expand All @@ -46,33 +49,3 @@ jobs:
cd /docker
docker-compose up --force-recreate --build -d continew-admin-server
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 }}
4 changes: 2 additions & 2 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0.0
- "v*" # Push events to matching v*, i.e. v1.0.0

jobs:
release:
Expand All @@ -20,4 +20,4 @@ jobs:
with:
tag_name: ${{ github.ref }}
body: |
详情请参阅 [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/dev/CHANGELOG.md) 。
详情请参阅 [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/dev/CHANGELOG.md) 。
48 changes: 48 additions & 0 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
@@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ public enum FormTypeEnum implements IBaseEnum<Integer> {
/**
* 树形选择
*/
TREE_SELECT(11, "树选择"),
;

TREE_SELECT(11, "树选择"),;

private final Integer value;
private final String description;
}

0 comments on commit c34e703

Please sign in to comment.