From bc60411c2f7521571582665c01246f3ef66ad8ae Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Fri, 17 Oct 2025 08:13:18 +0300 Subject: [PATCH] f --- .gitea/workflows/build.yml | 51 ++++++++------------------------------ 1 file changed, 11 insertions(+), 40 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 2d5d625..a8d46e5 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -22,66 +22,37 @@ jobs: PATH: ${{ env.PATH }}:/root/.dotnet/tools steps: - name: Checkout code - run: /bin/sh -c | - echo "Checking out code..." - echo "Current directory: $(pwd)" - echo "Files in current directory:" - ls -la + run: echo "Checking out code..." && pwd && ls -la - name: Setup .NET - run: /bin/sh -c | - echo "Setting up .NET..." - dotnet --version - echo "Dotnet is available" + run: echo "Setting up .NET..." && dotnet --version && echo "Dotnet is available" - name: Restore dependencies - run: /bin/sh -c "dotnet restore" + run: dotnet restore - name: Install dotnet-coverage - run: /bin/sh -c | - dotnet tool install --global dotnet-coverage - echo "Adding .dotnet/tools to PATH..." - echo 'export PATH="$PATH:/root/.dotnet/tools"' >> ~/.profile - export PATH="$PATH:/root/.dotnet/tools" - echo "dotnet-coverage location:" - which dotnet-coverage || echo "dotnet-coverage not found in PATH" - ls -la /root/.dotnet/tools/ | grep dotnet-coverage || echo "No dotnet-coverage in tools directory" + run: dotnet tool install --global dotnet-coverage - name: Install SonarCloud Scanner - run: /bin/sh -c "dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner" + run: dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner - name: Begin SonarCloud analysis - run: /bin/sh -c "./.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: ./.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: /bin/sh -c "dotnet build --no-incremental" + run: dotnet build --no-incremental - name: Run tests and collect coverage - run: /bin/sh -c | - echo "Running tests and collecting coverage..." - echo "PATH: $PATH" - echo "Trying dotnet-coverage from PATH..." - if dotnet-coverage collect "dotnet test --no-build" -f xml -o "coverage.xml"; then - echo "dotnet-coverage succeeded from PATH" - elif /root/.dotnet/tools/dotnet-coverage collect "dotnet test --no-build" -f xml -o "coverage.xml"; then - echo "dotnet-coverage succeeded with full path" - else - echo "dotnet-coverage failed, trying built-in coverage collection..." - dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults --no-build - echo "Looking for coverage files..." - find ./TestResults -name "*.xml" -exec echo "Found: {}" \; - # Convert to the expected format - find ./TestResults -name "coverage.cobertura.xml" -exec cp {} coverage.xml \; - fi + run: dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults --no-build - name: List files for debug - run: /bin/sh -c "ls -la" + run: ls -la - name: Print coverage.xml for debug - run: /bin/sh -c "cat coverage.xml" + run: find ./TestResults -name "*.xml" -exec echo "Found: {}" \; - name: End SonarCloud analysis - run: /bin/sh -c "./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token=\"${{ secrets.SONAR_TOKEN }}\"" + run: ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file