mirror of
https://github.com/Kevsl/crypto-exchange-api.git
synced 2025-07-09 14:00:12 +02:00
added sonar
This commit is contained in:
parent
ae07d2aaae
commit
977f7ceb6c
157
.github/workflows/ci.yml
vendored
157
.github/workflows/ci.yml
vendored
@ -1,36 +1,141 @@
|
|||||||
|
name: QA
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
types: [opened, synchronize, reopened]
|
||||||
- main
|
|
||||||
jobs:
|
jobs:
|
||||||
sonarqube-analysis:
|
argsInputTest:
|
||||||
|
name: >
|
||||||
|
'args' input
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Run action with args
|
||||||
- name: Set up Java 17
|
uses: ./
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin' # Distribution de Java (par ex: 'temurin')
|
args: -Dsonar.someArg=aValue -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
java-version: '17'
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
- name: Install dependencies
|
- name: Assert
|
||||||
run: npm install
|
|
||||||
|
|
||||||
- name: Run SonarQube scan
|
|
||||||
run: |
|
run: |
|
||||||
npx sonar-scanner \
|
./test/assertFileContains ./output.properties "sonar.someArg=aValue"
|
||||||
-Dsonar.projectKey=your_project_key \
|
projectBaseDirInputTest:
|
||||||
-Dsonar.sources=. \
|
name: >
|
||||||
-Dsonar.host.url=http://localhost:9000 \
|
'projectBaseDir' input
|
||||||
-Dsonar.login=admin \
|
runs-on: ubuntu-latest
|
||||||
-Dsonar.password=admin
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- run: |
|
||||||
|
mkdir -p ./baseDir
|
||||||
|
- name: Run action with projectBaseDir
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
|
projectBaseDir: ./baseDir
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
- name: Assert
|
||||||
|
run: |
|
||||||
|
./test/assertFileContains ./output.properties "sonar.projectBaseDir=.*/baseDir"
|
||||||
|
sonarTokenRequiredTest:
|
||||||
|
name: >
|
||||||
|
'SONAR_TOKEN' env var required
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Run action without SONAR_TOKEN
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Previous should have failed
|
||||||
|
if: ${{ steps.runTest.outcome == 'success'}}
|
||||||
|
run: |
|
||||||
|
echo "Expected previous step to fail"
|
||||||
|
exit 1
|
||||||
|
dontFailGradleTest:
|
||||||
|
name: >
|
||||||
|
Don't fail on Gradle project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Run action on Gradle project
|
||||||
|
id: runTest
|
||||||
|
uses: ./
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
with:
|
||||||
|
projectBaseDir: ./test/gradle-project
|
||||||
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
|
- name: Assert
|
||||||
|
run: |
|
||||||
|
./test/assertFileExists ./output.properties
|
||||||
|
dontFailGradleKotlinTest:
|
||||||
|
name: >
|
||||||
|
Don't fail on Kotlin Gradle project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Run action on Kotlin Gradle project
|
||||||
|
id: runTest
|
||||||
|
uses: ./
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
with:
|
||||||
|
projectBaseDir: ./test/gradle-project-kotlin
|
||||||
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
|
- name: Assert
|
||||||
|
run: |
|
||||||
|
./test/assertFileExists ./output.properties
|
||||||
|
dontFailMavenTest:
|
||||||
|
name: >
|
||||||
|
Don't fail on Maven project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run action on Maven project
|
||||||
|
id: runTest
|
||||||
|
uses: ./
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
with:
|
||||||
|
projectBaseDir: ./test/maven-project
|
||||||
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
|
- name: Assert
|
||||||
|
run: |
|
||||||
|
./test/assertFileExists ./output.properties
|
||||||
|
runnerDebugUsedTest:
|
||||||
|
name: >
|
||||||
|
'RUNNER_DEBUG' is used
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run action with debug mode
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
|
env:
|
||||||
|
RUNNER_DEBUG: 1
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
- name: Assert
|
||||||
|
run: |
|
||||||
|
./test/assertFileContains ./output.properties "sonar.verbose=true"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user