Skip to content

Commit f97bd52

Browse files
committed
Added Python 3.9, migrated workflow to SonarSource/sonarcloud-github-action, fixed warning with shallow clones
1 parent e822fbd commit f97bd52

File tree

3 files changed

+47
-45
lines changed

3 files changed

+47
-45
lines changed

.github/workflows/sonar.yml

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,39 @@
11
name: Sonar
2-
3-
on:
2+
'on':
43
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
8-
4+
branches:
5+
- master
6+
pull_request_target:
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
schedule:
12+
- cron: 0 16 * * *
913
jobs:
10-
build:
11-
env:
12-
SONAR_SCANNER_VERSION: 3.3.0.1492
14+
sonarcloud:
15+
name: Sonar
1316
runs-on: ubuntu-latest
14-
1517
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 setup.py test
31-
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
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
- name: Set up Python 3.8
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: 3.8
25+
- name: Install dependencies
26+
run: |
27+
pip3 install -r requirements.txt
28+
pip3 install .
29+
pip3 install coverage
30+
- name: Run Tests
31+
run: |
32+
coverage run setup.py test
33+
coverage xml
34+
- name: SonarCloud Scan
35+
uses: SonarSource/sonarcloud-github-action@master
36+
env:
37+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
38+
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}'
39+

.github/workflows/test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ on:
44
push:
55
branches: [ master ]
66
pull_request:
7-
branches: [ master ]
7+
types: [opened, synchronize, reopened]
8+
schedule:
9+
- cron: "0 16 * * *"
810

911
jobs:
1012
build:
11-
env:
12-
SONAR_SCANNER_VERSION: 3.3.0.1492
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: [3.6, 3.7, 3.8]
17-
16+
python-version: [3.6, 3.7, 3.8, 3.9]
1817
steps:
1918
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
2021
- name: Set up Python ${{ matrix.python-version }}
2122
uses: actions/setup-python@v2
2223
with:

sonar-project.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sonar.projectKey=Mastercard_client-encryption-python
2+
sonar.organization=mastercard
3+
sonar.projectName=client-encryption-python
4+
sonar.sources=./client_encryption
5+
sonar.tests=./tests
6+
sonar.python.coverage.reportPaths=coverage.xml
7+
sonar.host.url=https://sonarcloud.io

0 commit comments

Comments
 (0)