Files
ChatBot/.gitea/workflows/build.yml
Workflow config file is invalid. Please check your config file: yaml: line 53: mapping values are not allowed in this context
Leonid Pershin bc60411c2f f
2025-10-17 08:13:18 +03:00

58 lines
1.9 KiB
YAML

name: SonarCloud
on:
push:
branches: [ master ]
pull_request:
types: [opened, synchronize, reopened]
env:
DOTNET_VERSION: '9.0.x'
SONAR_PROJECT_KEY: 'mrleo1nid_chatbot'
SONAR_ORG: 'mrleo1nid'
SONAR_HOST_URL: 'https://sonarcloud.io'
jobs:
build:
name: Build, Test, Coverage, and Analyze
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:9.0
env:
PATH: ${{ env.PATH }}:/root/.dotnet/tools
steps:
- name: Checkout code
run: echo "Checking out code..." && pwd && ls -la
- name: Setup .NET
run: echo "Setting up .NET..." && dotnet --version && echo "Dotnet is available"
- name: Restore dependencies
run: dotnet restore
- name: Install dotnet-coverage
run: dotnet tool install --global dotnet-coverage
- name: Install SonarCloud Scanner
run: dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
- name: Begin SonarCloud analysis
run: ./.sonar/scanner/dotnet-sonarscanner begin /k:"${{ env.SONAR_PROJECT_KEY }}" /o:"${{ env.SONAR_ORG }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ env.SONAR_HOST_URL }}" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml"
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Build
run: dotnet build --no-incremental
- name: Run tests and collect coverage
run: dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults --no-build
- name: List files for debug
run: ls -la
- name: Print coverage.xml for debug
run: find ./TestResults -name "*.xml" -exec echo "Found: {}" \;
- name: End SonarCloud analysis
run: ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}