AMB-2232- Sonarcloud #6
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: sonarcloud | |
on: pull_request | |
jobs: | |
sonar_scan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' # Or 'temurin' if you prefer | |
- name: Install Sonar Scanner | |
shell: bash | |
run: | | |
wget -O sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip | |
unzip sonar-scanner.zip | |
mv sonar-scanner-4.6.2.2472-linux sonar-scanner | |
echo "SONAR_SCANNER_BIN=${GITHUB_WORKSPACE}/sonar-scanner/bin" >> $GITHUB_ENV | |
- name: Diagnostic Check for Environment | |
shell: bash | |
run: | | |
echo "Checking /usr/bin/env" | |
ls -l /usr/bin/env || echo "/usr/bin/env missing" | |
echo "Checking for sh" | |
which sh || echo "sh is missing" | |
echo "Checking for Sonar Scanner" | |
which sonar-scanner || echo "Sonar Scanner not found" | |
echo "Sonar Scanner Bin Path: $SONAR_SCANNER_BIN" | |
- name: Run SonarQube Scan | |
shell: bash | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
$SONAR_SCANNER_BIN/sonar-scanner \ | |
-Dsonar.projectKey=NHSDigital_immunisation-batch \ | |
-Dsonar.host.url=https://sonarcloud.io \ | |
-Dsonar.login=$SONAR_TOKEN \ | |
-Dsonar.python.coverage.reportPaths=filenameprocessor_coverage.xml |