-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (47 loc) · 1.82 KB
/
build.yml
File metadata and controls
53 lines (47 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Build
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
toolintegrationservice:
if: (startsWith(github.head_ref, 'BE_') && github.event.pull_request.merged == false) || (github.event_name == 'push')
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3
- name: Install dependencies
run: |
pip install tox
pip install coverage
# - name: Run tests and coverage
# run: |
# pytest --cov=tool_integration_service
- name: Run tox for tests and coverage
run: |
tox -e py
# Assuming you have a tox environment setup for running tests and generating coverage reports
# If not, you might need to run coverage commands directly depending on your project setup
# Example:
# coverage run -m pytest
# coverage xml
# Ensure the coverage report is generated before running the SonarCloud Scan
# The SonarCloud action or command line tool will need to know where to find the coverage report
# This can be specified in the sonar-project.properties file or with command line arguments
- name: Override Coverage Source Path for Sonar
run: sed -i 's/\/home\/runner\/work\/fastapi-sonar-integration\/fastapi-sonar-integration\//\/github\/workspace\//g' coverage-reports/coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
with:
args: >
-Dsonar.python.coverage.reportPaths=coverage-reports/coverage.xml
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}