From e3b617586061de829f80cecd433787c3f418e979 Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Sat, 18 Oct 2025 04:01:53 +0300 Subject: [PATCH] g --- .gitea/workflows/build-act.yml | 100 --------------------------------- .gitea/workflows/build.yml | 4 +- 2 files changed, 3 insertions(+), 101 deletions(-) delete mode 100644 .gitea/workflows/build-act.yml diff --git a/.gitea/workflows/build-act.yml b/.gitea/workflows/build-act.yml deleted file mode 100644 index 9564abf..0000000 --- a/.gitea/workflows/build-act.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Build and Test (Act Compatible) - -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 - env: - PATH: ${{ env.PATH }}:/root/.dotnet/tools - steps: - - name: Checkout code - run: | - echo "Checking out code..." - echo "Current directory: $(pwd)" - echo "Files in current directory:" - 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 - echo "Adding .dotnet/tools to PATH..." - echo 'export PATH="$PATH:/root/.dotnet/tools"' >> ~/.bashrc - 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" - - - name: Install SonarCloud Scanner - run: dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner - - - name: Begin SonarCloud analysis - run: | - echo "Starting SonarCloud analysis..." - if [ -n "$SONAR_TOKEN" ]; then - ./.sonar/scanner/dotnet-sonarscanner begin /k:"$SONAR_PROJECT_KEY" /o:"$SONAR_ORG" /d:sonar.token="$SONAR_TOKEN" /d:sonar.host.url="$SONAR_HOST_URL" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" - echo "SonarCloud analysis started" - else - echo "SONAR_TOKEN not set, skipping SonarCloud analysis" - fi - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - name: Build - run: dotnet build --no-incremental - - - name: Run tests and collect coverage - run: | - 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 - - - name: List files for debug - run: ls -la - - - name: Print coverage.xml for debug - run: cat coverage.xml || echo "No coverage.xml found" - - - name: End SonarCloud analysis - run: | - echo "Ending SonarCloud analysis..." - if [ -n "$SONAR_TOKEN" ]; then - ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN" - echo "SonarCloud analysis completed" - else - echo "SONAR_TOKEN not set, skipping SonarCloud analysis" - fi - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 90cfc1d..6ee3237 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -42,6 +42,8 @@ jobs: 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 + dotnet build --verbosity normal --no-incremental + echo "Collecting coverage..." + dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml" echo "Ending SonarQube analysis..." ~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ No newline at end of file