mirror of
https://github.com/SonarSource/sonarqube-scan-action.git
synced 2025-12-14 10:21:14 +00:00
192 lines
5.7 KiB
YAML
192 lines
5.7 KiB
YAML
name: QA
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
argsInputTest:
|
|
name: >
|
|
'args' input
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Run action with args
|
|
uses: ./
|
|
with:
|
|
args: -Dsonar.someArg=aValue -Dsonar.scanner.internal.dumpToFile=./output.properties
|
|
env:
|
|
SONAR_HOST_URL: http://not_actually_used
|
|
- name: Assert
|
|
run: |
|
|
./test/assertFileContains ./output.properties "sonar.someArg=aValue"
|
|
projectBaseDirInputTest:
|
|
name: >
|
|
'projectBaseDir' input
|
|
runs-on: ubuntu-latest
|
|
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_HOST_URL: http://not_actually_used
|
|
- name: Assert
|
|
run: |
|
|
./test/assertFileContains ./output.properties "sonar.projectBaseDir=.*/baseDir"
|
|
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_HOST_URL: http://not_actually_used
|
|
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_HOST_URL: http://not_actually_used
|
|
with:
|
|
projectBaseDir: ./test/gradle-project
|
|
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
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Run action on Maven project
|
|
id: runTest
|
|
uses: ./
|
|
continue-on-error: true
|
|
env:
|
|
SONAR_HOST_URL: http://not_actually_used
|
|
with:
|
|
projectBaseDir: ./test/maven-project
|
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
|
- name: Assert
|
|
run: |
|
|
./test/assertFileExists ./output.properties
|
|
runAnalysisTest:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
sonarqube:
|
|
image: sonarqube:lts-community
|
|
ports:
|
|
- 9000:9000
|
|
volumes:
|
|
- sonarqube_data:/opt/sonarqube/data
|
|
- sonarqube_logs:/opt/sonarqube/logs
|
|
- sonarqube_extensions:/opt/sonarqube/extensions
|
|
options: >-
|
|
--health-cmd "grep -Fq \"SonarQube is operational\" /opt/sonarqube/logs/sonar.log"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Run action on sample project
|
|
id: runTest
|
|
uses: ./
|
|
env:
|
|
SONAR_HOST_URL: http://sonarqube:9000
|
|
with:
|
|
args: -Dsonar.login=admin -Dsonar.password=admin
|
|
projectBaseDir: ./test/example-project
|
|
- name: Assert
|
|
run: |
|
|
./test/assertFileExists ./test/example-project/.scannerwork/report-task.txt
|
|
runnerDebugUsedTest:
|
|
name: >
|
|
'RUNNER_DEBUG' is used
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Run action with debug mode
|
|
uses: ./
|
|
with:
|
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
|
env:
|
|
RUNNER_DEBUG: 1
|
|
SONAR_HOST_URL: http://not_actually_used
|
|
- name: Assert
|
|
run: |
|
|
./test/assertFileContains ./output.properties "sonar.verbose=true"
|
|
runAnalysisWithCacheTest:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
sonarqube:
|
|
image: sonarqube:lts-community
|
|
ports:
|
|
- 9000:9000
|
|
volumes:
|
|
- sonarqube_data:/opt/sonarqube/data
|
|
- sonarqube_logs:/opt/sonarqube/logs
|
|
- sonarqube_extensions:/opt/sonarqube/extensions
|
|
options: >-
|
|
--health-cmd "grep -Fq \"SonarQube is operational\" /opt/sonarqube/logs/sonar.log"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: SonarQube Cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ github.workspace }}/.sonar/cache
|
|
key: ${{ runner.os }}-sonar
|
|
- name: Run action on sample project
|
|
id: runTest
|
|
uses: ./
|
|
env:
|
|
SONAR_HOST_URL: http://sonarqube:9000
|
|
SONAR_USER_HOME: ${{ github.workspace }}/.sonar
|
|
with:
|
|
args: -Dsonar.login=admin -Dsonar.password=admin
|
|
projectBaseDir: ./test/example-project
|
|
- name: Assert
|
|
run: |
|
|
./test/assertFileExists ./test/example-project/.scannerwork/report-task.txt
|