Skip to content

Commit

Permalink
added new gh action for local sq
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-howlett-sonarsource committed Mar 28, 2024
1 parent 1305346 commit 63dbab9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 65 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/dotnet.yml

This file was deleted.

23 changes: 12 additions & 11 deletions .github/workflows/sonarqube.yml → .github/workflows/sq.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
name: SonarQube Check
name: Build

on:
push:
branches:
- master # or the name of your main branch
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
name: Build
runs-on: windows-latest
permissions: read-all
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
path: ~\.sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube scanner
Expand All @@ -37,10 +40,8 @@ jobs:
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"tom-sonartest_DotNet5WebApi" /d:sonar.login="${{ secrets.SONARQUBE_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}"
.\.sonar\scanner\dotnet-sonarscanner begin /k:"tom-howlett-sonarsource_DotNet5WebApi_0343358a-8c80-46e8-97e7-8d3119384d53" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}"
dotnet build
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONARQUBE_TOKEN }}"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

0 comments on commit 63dbab9

Please sign in to comment.