Hello,
I’m learning how to use Sonar for a Swift test project with Github Actions.
This very simple project consists in a framework containing a TestCIModel
folder with a swift file, containing a basic model. At the root of this project is also contained a TestCIModelTests
folder containing the corresponding test files.
I’ve also added a very simple sonar-project.properties
file at the root of the project:
sonar.organization={organization}
sonar.projectKey={project_key}
sonar.sources=TestCIModel
sonar.tests=TestCIModelTests
And about the Github Action, I just followed the official instructions:
on:
pull_request:
name: Pull Request
jobs:
sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@v2.3.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Everything seems to run fine, but in the analysis, it looks like the test file is treated as a source file:
Resulting in a 0% code coverage:
Is there something wrong, or did I forget something about how to setup the project?
Also, not totally related, but although I’ve this 0% code coverage issue, this doesn’t seem to prevent the quality gate from passing:
Is there a specific config to set for this?
Thank you for your help!