Skip to content

Commit

Permalink
Merge pull request #66 from Takasaki-Studio/sonarqube
Browse files Browse the repository at this point in the history
Add: sonar qube
  • Loading branch information
Takasakiii authored Aug 30, 2024
2 parents 85ed667 + 5c906d1 commit 158503c
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 13 deletions.
49 changes: 46 additions & 3 deletions .github/workflows/dotnet8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

jobs:
build:
name: Build
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
Expand All @@ -29,7 +30,7 @@ jobs:
run: dotnet build --no-restore /WarnAsError

test:
needs: [ build ]
name: Test
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
Expand All @@ -48,9 +49,50 @@ jobs:
run: dotnet restore
- name: Test
run: dotnet test --verbosity normal

sonar:
name: Sonar Qube
needs: [ build, test ]
runs-on: windows-latest

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@v4
with:
java-version: 17
distribution: 'temurin'
- name: Cache SonarQube packages
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@v4
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 ]
name: Publish Github
needs: [ sonar ]
environment: 'Production'
runs-on: ubuntu-latest
if: github.ref_name == 'dotnet8' && github.event_name == 'push'
Expand Down Expand Up @@ -81,7 +123,8 @@ jobs:
run: dotnet nuget push "./TakasakiStudio.Lina/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github"

publish_nuget:
needs: [ test ]
name: Publish Nuget
needs: [ sonar ]
environment: 'Production Nuget'
runs-on: ubuntu-latest
if: github.ref_name == 'dotnet8' && github.event_name == 'push'
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.1.5</Version>
<Version>2.1.6</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>TakasakiStudio.Lina.AspNet</PackageId>
<Authors>TakasakiStudio</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.1.5</Version>
<Version>2.1.6</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>TakasakiStudio.Lina.AutoDependencyInjection</PackageId>
<Authors>TakasakiStudio</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.1.5</Version>
<Version>2.1.6</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>TakasakiStudio.Lina.Common</PackageId>
<Title>TakasakiStudio.Lina.Common</Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.1.5</Version>
<Version>2.1.6</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>TakasakiStudio.Lina.Database</PackageId>
<Title>TakasakiStudio.Lina.Database</Title>
Expand All @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions TakasakiStudio.Lina.Test/TakasakiStudio.Lina.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.5.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion TakasakiStudio.Lina.Utils/TakasakiStudio.Lina.Utils.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.1.5</Version>
<Version>2.1.6</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>TakasakiStudio.Lina.Utils</PackageId>
<Title>TakasakiStudio.Lina.Utils</Title>
Expand Down
2 changes: 1 addition & 1 deletion TakasakiStudio.Lina/TakasakiStudio.Lina.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.1.5</Version>
<Version>2.1.6</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>TakasakiStudio.Lina</PackageId>
<Title>TakasakiStudio.Lina</Title>
Expand Down

0 comments on commit 158503c

Please sign in to comment.