From 8aaac75b58c58be369a450ff9e7178e0c3cda88d Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Fri, 17 Oct 2025 08:19:06 +0300 Subject: [PATCH] rew --- .gitea/workflows/build.yml | 78 ++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 46 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index a8d46e5..35d2ad9 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,58 +1,44 @@ -name: SonarCloud - +name: SonarQube on: push: - branches: [ master ] + 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 + name: Build 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: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + 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: Setup .NET - run: echo "Setting up .NET..." && dotnet --version && echo "Dotnet is available" - + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + - name: Install SonarQube Cloud scanner + run: | + mkdir -p ~/.sonar/scanner + dotnet tool install dotnet-sonarscanner --tool-path ~/.sonar/scanner - 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" + run: dotnet restore --verbosity normal + - name: Build and analyze 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 }} \ No newline at end of file + run: | + echo "Starting SonarQube analysis..." + echo "Current directory: $(pwd)" + echo "Listing files:" + ls -la + echo "Installing SonarQube scanner..." + ~/.sonar/scanner/dotnet-sonarscanner begin /k:"mrleo1nid_chatbot" /o:"mrleo1nid" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + echo "Building project..." + dotnet build --verbosity normal + echo "Ending SonarQube analysis..." + ~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ No newline at end of file