From 3d0d4a9eb86200df1991f036af1a541eb91f5868 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 13 May 2024 17:07:56 +0200 Subject: [PATCH] First experiment of a test written as GitHub action --- .github/workflows/qa.yml | 51 +++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index c906724..3b8c7c0 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -3,16 +3,51 @@ name: QA on: [push, pull_request] jobs: - run_qa: + integrationTest1: + name: Test 'args' input runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - - run: ./test/run-qa.sh - timeout-minutes: 5 - services: - sonarqube: - image: sonarqube:8.9-community - ports: - - 9000:9000 + - 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 + integrationTest2: + name: Test '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 \ No newline at end of file