Skip to content

SQ startup

SQ startup #140

Workflow file for this run

name: QA
on: [push, pull_request]
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.dumpToFile=./output.properties
env:
SONAR_HOST_URL: http://not_actually_used
- name: Assert
run: |
if [ ! -f ./output.properties ]; then
echo "File ./output.properties not found"
exit 1
fi
if ! grep -q "sonar.someArg=aValue" ./output.properties; then
echo "Property sonar.someArg=aValue not found in ./output.properties"
exit 1
fi
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.dumpToFile=./output.properties
projectBaseDir: ./baseDir
env:
SONAR_HOST_URL: http://not_actually_used
- name: Assert
run: |
if [ ! -f ./output.properties ]; then
echo "File ./output.properties not found"
exit 1
fi
if ! grep -q "sonar.projectBaseDir=.*/baseDir" ./output.properties; then
echo "Property sonar.projectBaseDir=.*/baseDir not found in ./output.properties"
exit 1
fi
sonarHostUrlRequiredTest:
name: >
'SONAR_HOST_URL' is required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run action without SONAR_HOST_URL
id: runTest
uses: ./
continue-on-error: true
- name: Previous should have failed
if: ${{ steps.runTest.outcome == 'success'}}
run: |
echo "Expected previous step to fail"
exit 1
failFastGradleTest:
name: >
Fail fast 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
- name: Previous should have failed
if: ${{ steps.runTest.outcome == 'success'}}
run: |
echo "Expected previous step to fail"
exit 1
failFastMavenTest:
name: >
Fail fast 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
- name: Previous should have failed
if: ${{ steps.runTest.outcome == 'success'}}
run: |
echo "Expected previous step to fail"
exit 1
runAnalysisTest:
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
volumes:
- sonarqube_data:/tmp/sonarqube_data
- sonarqube_logs:/tmp/sonarqube_logs
- sonarqube_extensions:/tmp/sonarqube_extensions
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 "curl --fail --user admin:admin http://127.0.0.1:9000/api/system/status"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 10
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- run: apt-get update && apt-get install -y curl jq
- run: ./test/waitForSonarQubeUp.sh
timeout-minutes: 3
- 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: |
if [ ! -f ./test/example-project/.scannerwork/report-task.txt ]; then
echo "Couldn't find the report task file. Analysis failed."
exit 1
fi