From bb22e14c7e556f826b1492511b550894c62b1842 Mon Sep 17 00:00:00 2001 From: rajeev-flexion Date: Fri, 24 May 2024 08:44:42 -0500 Subject: [PATCH] changed working dir --- .github/workflows/sonar.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index f0ec850e..a7bce7db 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -23,29 +23,38 @@ jobs: path: | ~/.cache/go-build ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + key: ${{ runner.os }}-go-${{ hashFiles('src/report-stream/go.sum') }} restore-keys: | ${{ runner.os }}-go- + - name: Install dependencies + run: | + cd src/report-stream + go mod tidy + go mod download + - name: Install SonarQube Scanner run: | curl -sSLo sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip unzip sonar-scanner.zip -d $HOME - export PATH="$HOME/sonar-scanner-4.6.2.2472-linux/bin:$PATH" + echo "$HOME/sonar-scanner-4.6.2.2472-linux/bin" >> $GITHUB_PATH - name: Run tests and generate coverage run: | + cd src/report-stream go test -v ./... -coverprofile=coverage.out + cat coverage.out go tool cover -func=coverage.out - name: SonarQube Scan env: SONAR_TOKEN: ${{ secrets.SFTP_INGESTION_SONAR_TOKEN }} run: | + cd src/report-stream sonar-scanner \ -Dsonar.projectKey=CDCgov_reportstream-sftp-ingestion \ - -Dsonar.organization=cdcgov \ # For SonarCloud only - -Dsonar.host.url=https://sonarcloud.io \ # Use your SonarQube URL if using SonarQube + -Dsonar.organization=cdcgov \ + -Dsonar.host.url=https://sonarcloud.io \ -Dsonar.login=$SONAR_TOKEN \ -Dsonar.sources=. \ -Dsonar.tests=. \