Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 16 additions & 75 deletions .github/workflows/main_astar-dev.yml
Original file line number Diff line number Diff line change
@@ -1,110 +1,51 @@
name: Build and analyse the DatabaseTesting Solution
name: SonarQube
on:
pull_request:
types: [ opened, synchronize, reopened ]
push:
branches:
- main
env:
AZURE_WEBAPP_NAME: astar-dev
AZURE_WEBAPP_PACKAGE_PATH: src/uis/AStar.Dev.Web/published
CONFIGURATION: Release
DOTNET_CORE_VERSION: 9.0.x
WORKING_DIRECTORY: src/uis/AStar.Dev.Web
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build and analyze
runs-on: windows-latest
permissions:
contents: read #This is required for actions/checkout

steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'

distribution: 'zulu' # Alternative distribution options are available.
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: 🛠 Cache SonarQube Cloud packages
- name: Cache SonarQube Cloud packages
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: 🛠 Cache SonarQube Cloud scanner
- name: Cache SonarQube Cloud 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 Cloud scanner
- name: Install SonarQube Cloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: 🔍 Restore,
shell: powershell
run: |
dotnet restore
- name: 🛠 Build
shell: powershell
run: |
dotnet build --no-restore
- name: 🧪 Test and analyse with ☁️ SonarCloud / Qube
- name: Build and analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
dotnet tool install --global dotnet-coverage
.\.sonar\scanner\dotnet-sonarscanner begin /k:"astar-development_astar-dev-database-testing" /o:"astar-development" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.scanner.scanAll=false /d:sonar.scanner.skipJreProvisioning=true
dotnet-coverage collect 'dotnet test --filter "FullyQualifiedName!~Tests.EndToEnd"' -f xml -o 'coverage.xml'
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
#
# - name: 🚀 Publish App
# run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
#
# - name: 🚀 Publish Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: webapp
# path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

# deploy:
# runs-on: ubuntu-latest
# needs: build
# environment:
# name: 'Production'
# url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
# permissions:
# id-token: write #This is required for requesting the JWT
# contents: read #This is required for actions/checkout
#
# steps:
# - name: Download artifact from build job
# uses: actions/download-artifact@v4
# with:
# name: webapp
# path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
#
# - name: Login to Azure
# uses: azure/login@v2
# with:
# client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_E8497C9E217E4655814D0F7761AAE04F }}
# tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_085200BD39F041C4999EEB0851E8D6A2 }}
# subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_3FEB324333C140D8A0FA99AC083AEB82 }}
#
# - name: Deploy to Azure WebApp
# uses: azure/webapps-deploy@v3
# with:
# app-name: ${{ env.AZURE_WEBAPP_NAME }}
# package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
dotnet sonarscanner begin /k:"astar-development_astar-dev-database-testing"
/d:sonar.token="${{ secrets.SONAR_TOKEN }}"
/d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build --no-incremental
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
<PackageReference Include="JetBrains.Annotations" Version="2025.2.0"/>
Expand Down
Loading