Add: sonar qube #64
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET 8 | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "dotnet8" ] | |
pull_request: | |
branches: [ "dotnet8" ] | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
platform: [ ubuntu-latest, macos-latest, windows-latest ] | |
version: [ 8.x ] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ matrix.version }} | |
- name: Login into Github Packeges | |
run: dotnet nuget add source --store-password-in-clear-text "https://nuget.pkg.github.com/Takasaki-Studio/index.json" --name github --username ${{ secrets.USERNAME }} --password ${{ secrets.SECRET }} | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore /WarnAsError | |
test: | |
name: Test | |
strategy: | |
matrix: | |
platform: [ ubuntu-latest, macos-latest, windows-latest ] | |
version: [ 8.x ] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ matrix.version }} | |
- name: Login into Github Packeges | |
run: dotnet nuget add source --store-password-in-clear-text "https://nuget.pkg.github.com/Takasaki-Studio/index.json" --name github --username ${{ secrets.USERNAME }} --password ${{ secrets.SECRET }} | |
- name: Restore dependencies | |
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: | |
name: Publish Github | |
needs: [ sonar ] | |
environment: 'Production' | |
runs-on: ubuntu-latest | |
if: github.ref_name == 'dotnet8' && github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore -c Release | |
- name: Add Nuget Source | |
run: dotnet nuget add source --store-password-in-clear-text "https://nuget.pkg.github.com/Takasaki-Studio/index.json" --username "${{ secrets.USERNAME }}" --password "${{ secrets.SECRET }}" --name "github" | |
- name: Publish TakasakiStudio.Lina.Common to Github Package | |
run: dotnet nuget push "./TakasakiStudio.Lina.Common/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github" | |
- name: Publish TakasakiStudio.Lina.AutoDependencyInjection to Github Package | |
run: dotnet nuget push "./TakasakiStudio.Lina.AutoDependencyInjection/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github" | |
- name: Publish TakasakiStudio.Lina.Utils to Github Package | |
run: dotnet nuget push "./TakasakiStudio.Lina.Utils/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github" | |
- name: Publish TakasakiStudio.Lina.Database to Github Package | |
run: dotnet nuget push "./TakasakiStudio.Lina.Database/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github" | |
- name: Publish TakasakiStudio.Lina.AspNet to Github Package | |
run: dotnet nuget push "./TakasakiStudio.Lina.AspNet/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github" | |
- name: Publish TakasakiStudio.Lina to Github Package | |
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 | |
if: github.ref_name == 'dotnet8' && github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore -c Release | |
- name: Publish TakasakiStudio.Lina.Common to Nuget | |
run: dotnet nuget push "./TakasakiStudio.Lina.Common/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org" | |
- name: Publish TakasakiStudio.Lina.AutoDependencyInjection to Nuget | |
run: dotnet nuget push "./TakasakiStudio.Lina.AutoDependencyInjection/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org" | |
- name: Publish TakasakiStudio.Lina.Utils to Nuget | |
run: dotnet nuget push "./TakasakiStudio.Lina.Utils/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org" | |
- name: Publish TakasakiStudio.Lina.Database to Nuget | |
run: dotnet nuget push "./TakasakiStudio.Lina.Database/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org" | |
- name: Publish TakasakiStudio.Lina.AspNet to Nuget | |
run: dotnet nuget push "./TakasakiStudio.Lina.AspNet/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org" | |
- name: Publish TakasakiStudio.Lina to Nuget | |
run: dotnet nuget push "./TakasakiStudio.Lina/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org" |