-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (40 loc) · 1.51 KB
/
sonarcube.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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