From 6352db5dedee33f781e42f8a944af4b7e6b3d18f Mon Sep 17 00:00:00 2001 From: Gabriel-Paulucci Date: Fri, 30 Aug 2024 13:19:45 -0300 Subject: [PATCH 1/4] Add: sonar qube --- .github/workflows/dotnet8.yml | 44 ++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet8.yml b/.github/workflows/dotnet8.yml index 6407f02..91e4b10 100644 --- a/.github/workflows/dotnet8.yml +++ b/.github/workflows/dotnet8.yml @@ -29,7 +29,6 @@ jobs: run: dotnet build --no-restore /WarnAsError test: - needs: [ build ] strategy: matrix: platform: [ ubuntu-latest, macos-latest, windows-latest ] @@ -48,9 +47,48 @@ jobs: run: dotnet restore - name: Test run: dotnet test --verbosity normal + + sonar: + needs: [ build, test ] + runs-on: windows-latest + name: Sonar Qube + + steps: + - uses: actions/checkout@v4 + 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 + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache SonarQube scanner + id: cache-sonar-scanner + uses: actions/cache@v1 + with: + path: .\.sonar\scanner + key: ${{ runner.os }}-sonar-scanner + restore-keys: ${{ runner.os }}-sonar-scanner + - name: Install SonarQube scanner + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' + shell: powershell + run: | + New-Item -Path .\.sonar\scanner -ItemType Directory + dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner + - name: Build and analyze + shell: powershell + run: | + .\.sonar\scanner\dotnet-sonarscanner begin /k:"Takasaki-Studio_Lina_15f9a6a7-ef3c-4937-88f6-40e4f890d8f1" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}" + dotnet build + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" publish_github: - needs: [ test ] + needs: [ sonar ] environment: 'Production' runs-on: ubuntu-latest if: github.ref_name == 'dotnet8' && github.event_name == 'push' @@ -81,7 +119,7 @@ jobs: run: dotnet nuget push "./TakasakiStudio.Lina/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github" publish_nuget: - needs: [ test ] + needs: [ sonar ] environment: 'Production Nuget' runs-on: ubuntu-latest if: github.ref_name == 'dotnet8' && github.event_name == 'push' From 46673815e3bbe3a0bf25b2cc9633c537122bfe47 Mon Sep 17 00:00:00 2001 From: Gabriel-Paulucci Date: Fri, 30 Aug 2024 13:33:27 -0300 Subject: [PATCH 2/4] Add: sonar status --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6472394..7dab4a1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A framework to simplify application creation by improving dependency injection, validation, config and database handling +[![Quality gate](https://qube.takasaki.studio/api/project_badges/quality_gate?project=Takasaki-Studio_Lina_15f9a6a7-ef3c-4937-88f6-40e4f890d8f1&token=sqb_e3d13032d4593a8be8fecd4a976ada88ba8696ac)](https://qube.takasaki.studio/dashboard?id=Takasaki-Studio_Lina_15f9a6a7-ef3c-4937-88f6-40e4f890d8f1) + ## Features - Config From b7d035121713e89f3c1dd9b85ddbb8dda87e322a Mon Sep 17 00:00:00 2001 From: Gabriel-Paulucci Date: Fri, 30 Aug 2024 13:33:42 -0300 Subject: [PATCH 3/4] Fix: versions of packages in github actions --- .github/workflows/dotnet8.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet8.yml b/.github/workflows/dotnet8.yml index 91e4b10..5d61975 100644 --- a/.github/workflows/dotnet8.yml +++ b/.github/workflows/dotnet8.yml @@ -9,6 +9,7 @@ on: jobs: build: + name: Build strategy: matrix: platform: [ ubuntu-latest, macos-latest, windows-latest ] @@ -29,6 +30,7 @@ jobs: run: dotnet build --no-restore /WarnAsError test: + name: Test strategy: matrix: platform: [ ubuntu-latest, macos-latest, windows-latest ] @@ -49,27 +51,28 @@ jobs: run: dotnet test --verbosity normal sonar: + name: Sonar Qube needs: [ build, test ] runs-on: windows-latest - name: Sonar Qube steps: - uses: actions/checkout@v4 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 + uses: actions/setup-java@v4 with: java-version: 17 + distribution: 'temurin' - name: Cache SonarQube packages - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~\.sonar\cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Cache SonarQube scanner id: cache-sonar-scanner - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: .\.sonar\scanner key: ${{ runner.os }}-sonar-scanner @@ -88,6 +91,7 @@ jobs: .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" publish_github: + name: Publish Github needs: [ sonar ] environment: 'Production' runs-on: ubuntu-latest @@ -119,6 +123,7 @@ jobs: run: dotnet nuget push "./TakasakiStudio.Lina/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github" publish_nuget: + name: Publish Nuget needs: [ sonar ] environment: 'Production Nuget' runs-on: ubuntu-latest From 5c906d10ae7acfc5736d551b08d2b1f28562b492 Mon Sep 17 00:00:00 2001 From: Gabriel-Paulucci Date: Fri, 30 Aug 2024 13:55:14 -0300 Subject: [PATCH 4/4] Update: dependencies --- .../TakasakiStudio.Lina.AspNet.csproj | 2 +- .../TakasakiStudio.Lina.AutoDependencyInjection.csproj | 2 +- .../TakasakiStudio.Lina.Common.csproj | 2 +- .../TakasakiStudio.Lina.Database.csproj | 4 ++-- TakasakiStudio.Lina.Test/TakasakiStudio.Lina.Test.csproj | 6 +++--- TakasakiStudio.Lina.Utils/TakasakiStudio.Lina.Utils.csproj | 2 +- TakasakiStudio.Lina/TakasakiStudio.Lina.csproj | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/TakasakiStudio.Lina.AspNet/TakasakiStudio.Lina.AspNet.csproj b/TakasakiStudio.Lina.AspNet/TakasakiStudio.Lina.AspNet.csproj index 6a14b4d..0c065ce 100644 --- a/TakasakiStudio.Lina.AspNet/TakasakiStudio.Lina.AspNet.csproj +++ b/TakasakiStudio.Lina.AspNet/TakasakiStudio.Lina.AspNet.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 2.1.5 + 2.1.6 true TakasakiStudio.Lina.AspNet TakasakiStudio diff --git a/TakasakiStudio.Lina.AutoDependencyInjection/TakasakiStudio.Lina.AutoDependencyInjection.csproj b/TakasakiStudio.Lina.AutoDependencyInjection/TakasakiStudio.Lina.AutoDependencyInjection.csproj index 02668f7..02f5a77 100644 --- a/TakasakiStudio.Lina.AutoDependencyInjection/TakasakiStudio.Lina.AutoDependencyInjection.csproj +++ b/TakasakiStudio.Lina.AutoDependencyInjection/TakasakiStudio.Lina.AutoDependencyInjection.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 2.1.5 + 2.1.6 true TakasakiStudio.Lina.AutoDependencyInjection TakasakiStudio diff --git a/TakasakiStudio.Lina.Common/TakasakiStudio.Lina.Common.csproj b/TakasakiStudio.Lina.Common/TakasakiStudio.Lina.Common.csproj index 7eee659..5cc849d 100644 --- a/TakasakiStudio.Lina.Common/TakasakiStudio.Lina.Common.csproj +++ b/TakasakiStudio.Lina.Common/TakasakiStudio.Lina.Common.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 2.1.5 + 2.1.6 true TakasakiStudio.Lina.Common TakasakiStudio.Lina.Common diff --git a/TakasakiStudio.Lina.Database/TakasakiStudio.Lina.Database.csproj b/TakasakiStudio.Lina.Database/TakasakiStudio.Lina.Database.csproj index 7ea0f33..d891679 100644 --- a/TakasakiStudio.Lina.Database/TakasakiStudio.Lina.Database.csproj +++ b/TakasakiStudio.Lina.Database/TakasakiStudio.Lina.Database.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 2.1.5 + 2.1.6 true TakasakiStudio.Lina.Database TakasakiStudio.Lina.Database @@ -20,7 +20,7 @@ - + diff --git a/TakasakiStudio.Lina.Test/TakasakiStudio.Lina.Test.csproj b/TakasakiStudio.Lina.Test/TakasakiStudio.Lina.Test.csproj index 84402cb..527ad8d 100644 --- a/TakasakiStudio.Lina.Test/TakasakiStudio.Lina.Test.csproj +++ b/TakasakiStudio.Lina.Test/TakasakiStudio.Lina.Test.csproj @@ -10,9 +10,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TakasakiStudio.Lina.Utils/TakasakiStudio.Lina.Utils.csproj b/TakasakiStudio.Lina.Utils/TakasakiStudio.Lina.Utils.csproj index 09555b1..9f8e4ec 100644 --- a/TakasakiStudio.Lina.Utils/TakasakiStudio.Lina.Utils.csproj +++ b/TakasakiStudio.Lina.Utils/TakasakiStudio.Lina.Utils.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 2.1.5 + 2.1.6 true TakasakiStudio.Lina.Utils TakasakiStudio.Lina.Utils diff --git a/TakasakiStudio.Lina/TakasakiStudio.Lina.csproj b/TakasakiStudio.Lina/TakasakiStudio.Lina.csproj index 26cb261..d3dd9ef 100644 --- a/TakasakiStudio.Lina/TakasakiStudio.Lina.csproj +++ b/TakasakiStudio.Lina/TakasakiStudio.Lina.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 2.1.5 + 2.1.6 true TakasakiStudio.Lina TakasakiStudio.Lina