Quality gate coverage resets after branch update to the latest main

  • ALM used GitHub
  • CI system used GitHub Actions
  • Scanner command used when applicable (private details masked)
  test:
    runs-on: runner-ui
    timeout-minutes: 60
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup
        uses: ./.github/actions/setup

      - name: Run tests
        run: yarn nx run-many --target=test --parallel=4 run --coverage.enabled=true --coverage.reporter=lcovonly

      - name: Merge coverage
        run: yarn test:merge-coverage

      - name: 'Upload Coverage'
        uses: actions/upload-artifact@v4
        with:
          name: lcov.info
          path: lcov.info

  sonar:
    needs: [test]
    runs-on: ubuntu-latest
    timeout-minutes: 60
    env:
      SONAR_SCANNER_JAVA_OPTS: -Xmx2048m
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup
        uses: ./.github/actions/setup

      - name: Download coverage info
        uses: actions/download-artifact@v4
        with:
          name: lcov.info

      - uses: SonarSource/sonarqube-scan-action@v5.1.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  • Languages of the repository typescript
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
  • Steps to reproduce
# be on a feature branch feature/foo
git merge main
git push

It also fails if you update the branch via GitHub’s website

  • Workaround
    After the failed state, you can push a dummy commit, like adding/removing a new line, and coverage will be restored


1 Like

Hi,

This is going to be about what steps run in your pipeline. There appear to be cases where a coverage report is not produced and fed into analysis. You should check what pipeline steps are run on push versus on merge.

 
HTH,
Ann

I don’t think so. Both steps trigger within the same condition in the same workflow file

on:
  pull_request:
    branches: ['main']

Hi,

I don’t know what to tell you. This is about the data being fed in to your analysis.

 
HTH,
Ann

@mirus-ua Just curious, do you see any coverage on overall code in your PR (the Estimated after merge figure)

If so, it might be a problem with the detection of changed lines that needs to be investigated.