Skip to content

Commit 5154298

Browse files
Create test.yml
1 parent 2cf44fa commit 5154298

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Sonar
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
env:
12+
SONAR_SCANNER_VERSION: 3.3.0.1492
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python 3.8
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: 3.8
21+
- name: Install dependencies
22+
run: |
23+
pip3 install -r requirements.txt
24+
pip3 install .
25+
pip3 install coverage
26+
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION.zip
27+
unzip sonar-scanner-cli-$SONAR_SCANNER_VERSION.zip
28+
- name: Run Tests
29+
run: |
30+
coverage run --source=client_encryption/ -m pytest --junitxml=tests.xml
31+
coverage xml -o coverage.xml
32+
- name: Sonar
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
36+
run: |
37+
sonar-scanner-$SONAR_SCANNER_VERSION/bin/sonar-scanner \
38+
-Dsonar.projectName=client-encryption-python \
39+
-Dsonar.projectKey=Mastercard_client-encryption-python \
40+
-Dsonar.organization=mastercard \
41+
-Dsonar.sources=./client_encryption \
42+
-Dsonar.tests=./tests \
43+
-Dsonar.python.coverage.reportPaths=coverage.xml \
44+
-Dsonar.host.url=https://sonarcloud.io \
45+
-Dsonar.login=$SONAR_TOKEN

0 commit comments

Comments
 (0)