Issue : Unable to get coverage of aws python lambda project . no sonar analysis picked up 0 coverage
using Git Hub actions pull request workflow
Languages of the repository - python
------------------------
file: tox.ini
[tox]
envlist = py39
skipsdist = True
[testenv]
deps =
pytest
boto3
botocore
mock
requests
pymysql
coverage
commands =
coverage run -m pytest
coverage xml
[coverage:run]
relative_files = True
branch = True
--------------------
--------------------
Repository folder structure
root ->
.github ->
pull_request.yml
create-sso-users->
create-sso-users-function-> app.py
events-> event.json
tests->
unit->
test_handler.py
sonar-project.properties
tox.ini
.coverage
--------------------
------------
pull_request.yml
name: Pull Request
# This workflow is triggered on pull requests to the develop branch only
# Runs on Open and Sync - but will only actually run if PR is Ready for Review (Line 19)
on:
pull_request:
branches:
- develop
concurrency:
group: ci-${{ github.head_ref }}
cancel-in-progress: true
jobs:
build:
runs-on:
- ubuntu-20.04
steps:
# Checkout repo
- uses: actions/checkout@v2
# Dependencies
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd create-sso-users
cd tests
- name: Install tox and any other packages
run: pip install tox
- name: Run tox
run: tox -e py
- name: SonarQube Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
-----------------