Skip to content

AMB-2232- Sonarcloud #3

AMB-2232- Sonarcloud

AMB-2232- Sonarcloud #3

Workflow file for this run

name: sonarcloud
on: pull_request
jobs:
sonar_scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Sonar Scanner
shell: bash # Explicitly set to 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
export PATH="${PATH}:${GITHUB_WORKSPACE}/sonar-scanner/bin"
- 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"
- name: Run SonarQube Scan
shell: bash # Explicitly set to bash
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
PATH: "${{ github.workspace }}/sonar-scanner/bin:${{ env.PATH }}"
run: |
sonar-scanner \
-Dsonar.projectKey=NHSDigital_immunisation-batch \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.python.coverage.reportPaths=filenameprocessor_coverage.xml