mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-15 04:57:42 +08:00
ci: 更新 GitHub Action 脚本
This commit is contained in:
28
.github/workflows/build.yml
vendored
Normal file
28
.github/workflows/build.yml
vendored
Normal 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
|
@@ -1,26 +1,31 @@
|
|||||||
name: Analysis Code Quality
|
name: Scan
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# 推送时执行
|
|
||||||
push:
|
push:
|
||||||
branches: [dev]
|
branches:
|
||||||
# 可手动执行
|
- dev
|
||||||
workflow_dispatch:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Sonar 扫描
|
|
||||||
sonar-scan:
|
sonar-scan:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
jdk-version:
|
||||||
|
- 17
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- 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: ${{ matrix.jdk-version }}
|
||||||
|
cache: "maven"
|
||||||
- name: Cache SonarCloud packages
|
- name: Cache SonarCloud packages
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
@@ -34,7 +39,10 @@ jobs:
|
|||||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
restore-keys: ${{ runner.os }}-m2
|
restore-keys: ${{ runner.os }}-m2
|
||||||
- name: Analyze
|
- name: Analyze
|
||||||
run: mvn -B verify -Psonar
|
run: |
|
||||||
|
sed -i.bak '/<repositories>/,/<\/repositories>/d' pom.xml
|
||||||
|
sed -i.bak '/<pluginRepositories>/,/<\/pluginRepositories>/d' pom.xml
|
||||||
|
mvn -B verify -Psonar
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
Reference in New Issue
Block a user