Skip to content

Commit

Permalink
sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
JosepFe committed Sep 5, 2023
1 parent 0779386 commit 0855d40
Showing 1 changed file with 39 additions and 34 deletions.
73 changes: 39 additions & 34 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,42 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
# - name: build
# run: |
# cd source
# dotnet restore
# dotnet build

- name: Build and analyze
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# shell: powershell
run: |
cd source
.\.sonar\scanner\dotnet-sonarscanner begin /k:"JosepFe_devon4net" /o:"josepfe" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet restore
dotnet build
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
# - name: Analyze with SonarCloud
# uses: sonarsource/sonarcloud-github-action@v1
# with:
# project-key: ${{ secrets.SONAR_PROJECT_KEY }}
# project-name: "devon4net"
# token: ${{ secrets.SONAR_TOKEN }}
# github-token: ${{ secrets.GITHUB_TOKEN }}
name: Build and analyze
runs-on: ubuntu-latest # Change to Ubuntu
steps:
- name: Set up JDK 17
uses: actions/setup-java@v2 # Update to the latest version
with:
java-version: 17
distribution: 'adopt' # Ubuntu uses AdoptOpenJDK
- uses: actions/checkout@v2 # Update to the latest version
with:
fetch-depth: 0
- name: Cache SonarCloud packages
uses: actions/cache@v2 # Update to the latest version
with:
path: ~/.sonar/cache # Change the path to the Linux format
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v2 # Update to the latest version
with:
path: ./.sonar/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
run: |
mkdir -p .sonar/scanner
dotnet tool update dotnet-sonarscanner --tool-path .sonar/scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./.sonar/scanner/dotnet-sonarscanner begin /k:"JosepFe_devon4net" /o:"josepfe" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
cd source
dotnet restore
dotnet build
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

0 comments on commit 0855d40

Please sign in to comment.