Skip to content

Commit

Permalink
test: sonarscan coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
erikburt committed Nov 28, 2024
1 parent 48c4037 commit ea15888
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci-core-partial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,64 @@ jobs:
if: ${{ always() }}
run: docker compose logs postgres | tee ../../../postgres_logs.txt
working-directory: ./.github/actions/setup-postgres

scan:
name: SonarQube Scan
needs: run-unit-tests
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/[email protected]
with:
# fetches all history for all tags and branches to provide more metadata for sonar reports
fetch-depth: 0

- name: Download all workflow run artifacts
uses: actions/[email protected]
with:
path: coverage
pattern: coverage-*
merge-multiple: true

- name: Check and Set SonarQube Report Paths
shell: bash
run: |
ARGS=""
sonarqube_coverage_report_paths=$(find ./coverage -name '*.cover.out' | paste -sd "," -)
# TODO uncomment when linting in enabled
# Check and assign paths for lint reports
# if [ -d "golangci-lint-report" ]; then
# sonarqube_lint_report_paths=$(find golangci-lint-report -name 'golangci-lint-report.xml' | paste -sd "," -)
# else
# sonarqube_lint_report_paths=""
# fi
# if [[ -z "$sonarqube_lint_report_paths" ]]; then
# echo "::warning::No lint report paths found, will not pass to sonarqube"
# else
# echo "Found lint report paths: $sonarqube_lint_report_paths"
# ARGS="$ARGS -Dsonar.go.golangci-lint.reportPaths=$sonarqube_lint_report_paths"
# fi
if [[ -z "$sonarqube_coverage_report_paths" ]]; then
echo "::warning::No coverage report paths found, will not pass to sonarqube"
else
echo "Found coverage report paths: $sonarqube_coverage_report_paths"
ARGS="$ARGS -Dsonar.go.coverage.reportPaths=$sonarqube_coverage_report_paths"
fi
echo "Final SONARQUBE_ARGS: $ARGS"
echo "SONARQUBE_ARGS=$ARGS" >> $GITHUB_ENV
- name: SonarQube Scan
if: ${{ env.SONARQUBE_ARGS != '' }}
uses: sonarsource/sonarqube-scan-action@aecaf43ae57e412bd97d70ef9ce6076e672fe0a9 # v2.3.0
with:
args: ${{ env.SONARQUBE_ARGS }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_SCANNER_OPTS: "-Xms6g -Xmx8g"


run-fuzz-tests:
Expand Down

0 comments on commit ea15888

Please sign in to comment.