SCSCANGHA-6 Add Github Actions tests #30
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_TOKEN: FAKE_TOKEN | |
- name: Assert | |
# run: | | |
# ./test/assertFileContains ./output.properties "sonar.someArg=aValue" | |
run: | | |
if ! grep -q "sonar.someArg=aValue" ./output.properties; then | |
error "'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 | |
ls -la | |
- name: Run action with projectBaseDir | |
uses: ./ | |
with: | |
args: -Dsonar.scanner.dumpToFile=./output.properties | |
projectBaseDir: ./baseDir | |
env: | |
SONAR_TOKEN: FAKE_TOKEN | |
- name: Assert | |
run: | | |
ls -la ./test | |
./test/assertFileContains ./output.properties "sonar.projectBaseDir=.*/baseDir" | |
# 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_TOKEN: FAKE_TOKEN | |
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_TOKEN: FAKE_TOKEN | |
with: | |
projectBaseDir: ./test/maven-project | |
- name: Previous should have failed | |
if: ${{ steps.runTest.outcome == 'success'}} | |
run: | | |
echo "Expected previous step to fail" | |
exit 1 |