forked from HishamParveezBavest/sonar_scanner_example
-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (47 loc) · 2.2 KB
/
build.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
45
46
47
48
49
50
51
52
53
name: Build and Analyse w/ SonarQube
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up msbuild
uses: microsoft/[email protected]
- name: Download and Install Build wrapper
shell: powershell
run: |
$path = "$HOME/.sonar/build-wrapper-win-x86.zip"
mkdir $HOME/.sonar
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile("${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-win-x86.zip", $path)
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- name: Download and install the SonarScanner
shell: powershell
run: |
$path = "$HOME/.sonar/sonar-scanner-cli-4.6.2.2472-windows.zip"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile("https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-windows.zip", $path)
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
- name: Build
shell: powershell
run: |
$env:Path += ";$HOME/.sonar/build-wrapper-win-x86"
build-wrapper-win-x86-64 --out-dir bw-output msbuild sonar_scanner_example.vcxproj /t:rebuild /nodeReuse:false
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: |
$env:Path += ";$HOME/.sonar/sonar-scanner-4.6.2.2472-windows/bin"
sonar-scanner -D sonar.cfamily.build-wrapper-output=bw-output -D sonar.verbose=true