chore: 初始化仓库,排除二进制文件和覆盖率文件
This commit is contained in:
43
.gitea/workflows/sonarqube.yml
Normal file
43
.gitea/workflows/sonarqube.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
name: SonarQube Analysis
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
sonarqube:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for better analysis
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Download and extract SonarQube Scanner
|
||||
run: |
|
||||
export SONAR_SCANNER_VERSION=7.2.0.5079
|
||||
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
|
||||
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip
|
||||
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
|
||||
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
|
||||
echo "SONAR_SCANNER_HOME=$SONAR_SCANNER_HOME" >> $GITHUB_ENV
|
||||
echo "$SONAR_SCANNER_HOME/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Run SonarQube Scanner
|
||||
env:
|
||||
SONAR_TOKEN: sqp_b8a64837bd9e967b6876166e9ba27f0bc88626ed
|
||||
run: |
|
||||
export SONAR_SCANNER_VERSION=7.2.0.5079
|
||||
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
|
||||
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=CarrotSkin \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.host.url=https://sonar.littlelan.cn
|
||||
|
||||
Reference in New Issue
Block a user