101 lines
3.3 KiB
YAML
101 lines
3.3 KiB
YAML
name: QA
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
argsInputTest:
|
|
name: >
|
|
'args' input
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
runs-on: ${{ matrix.os }}
|
|
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_TOKEN: FAKE_TOKEN
|
|
- name: Assert
|
|
run: |
|
|
./test/assertFileContains ./output.properties "sonar.someArg=aValue"
|
|
projectBaseDirInputTest:
|
|
name: >
|
|
'projectBaseDir' input
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
runs-on: ${{ matrix.os }}
|
|
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: FAKE_TOKEN
|
|
- name: Assert
|
|
run: |
|
|
./test/assertFileContains ./output.properties "sonar.projectBaseDir=.*/baseDir"
|
|
scannerVersionTest:
|
|
name: >
|
|
'scannerVersion' input
|
|
runs-on: github-ubuntu-latest-s # assumes default RUNNER_ARCH for linux is X64
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Run action with scannerVersion
|
|
uses: ./
|
|
with:
|
|
scannerVersion: 6.1.0.4477
|
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
|
env:
|
|
NO_CACHE: true # force install-sonar-scanner-cli.sh execution
|
|
SONAR_HOST_URL: http://not_actually_used
|
|
SONAR_SCANNER_JSON_PARAMS: '{"sonar.scanner.internal.dumpToFile": "./output.properties"}'
|
|
- name: Assert
|
|
run: |
|
|
./test/assertFileExists "$RUNNER_TEMP/sonarscanner/sonar-scanner-cli-6.1.0.4477-linux-x64.zip"
|
|
scannerBinariesUrlTest:
|
|
name: >
|
|
'scannerBinariesUrl' input with invalid URL
|
|
runs-on: github-ubuntu-latest-s # assumes default RUNNER_ARCH for linux is X64
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Run action with scannerBinariesUrl
|
|
id: runTest
|
|
uses: ./
|
|
continue-on-error: true
|
|
with:
|
|
scannerVersion: 6.2.1.4610
|
|
scannerBinariesUrl: https://invalid_uri/Distribution/sonar-scanner-cli
|
|
env:
|
|
NO_CACHE: true # force install-sonar-scanner-cli.sh execution
|
|
SONAR_HOST_URL: http://not_actually_used
|
|
SONAR_SCANNER_JSON_PARAMS: '{"sonar.scanner.internal.dumpToFile": "./output.properties"}'
|
|
- name: Fail if action succeeded
|
|
if: steps.runTest.outcome == 'success'
|
|
run: exit 1
|
|
- name: Assert Sonar Scanner CLI was not downloaded
|
|
run: |
|
|
./test/assertFileDoesntExist "$RUNNER_TEMP/sonarscanner/sonar-scanner-cli-6.2.1.4610-linux-x64.zip"
|
|
- name: Assert Sonar Scanner CLI was not executed
|
|
run: |
|
|
./test/assertFileDoesntExist ./output.properties
|