Skip to content

Commit 9f31033

Browse files
committed
move sonar to top level
Signed-off-by: Nitish Bharambe <[email protected]>
1 parent 0768d16 commit 9f31033

File tree

2 files changed

+56
-37
lines changed

2 files changed

+56
-37
lines changed

.github/workflows/build-test-release.yml

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: MPL-2.0
44

55

6-
name: Build, Test, Sonar
6+
name: Build and Test
77

88
on:
99
# run pipeline from another workflow
@@ -64,41 +64,6 @@ jobs:
6464
name: power-grid-model-io
6565
path: wheelhouse/
6666

67-
sonar-cloud:
68-
permissions:
69-
contents: write
70-
runs-on: ubuntu-latest
71-
steps:
72-
73-
- name: Checkout source code
74-
uses: actions/checkout@v4
75-
with:
76-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
77-
78-
- name: Setup Python 3.11
79-
uses: actions/setup-python@v5
80-
with:
81-
python-version: "3.11"
82-
83-
- name: Install in develop mode
84-
run: |
85-
pip install -e .[dev]
86-
87-
- name: Test and Coverage
88-
run: |
89-
pytest
90-
91-
# Fix relative paths in coverage file
92-
# Known bug: https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057
93-
sed -i 's@/home/runner/work/power-grid-model-io/power-grid-model-io@/github/workspace@g' python_coverage.xml
94-
95-
- name: SonarCloud Scan
96-
if: ${{ (github.event_name == 'push') || (github.event.pull_request.head.repo.owner.login == 'PowerGridModel') }}
97-
uses: SonarSource/sonarqube-scan-action@master
98-
env:
99-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
101-
10267
unit-tests:
10368
needs: build-python
10469
strategy:
@@ -176,7 +141,6 @@ jobs:
176141
- build-python
177142
- unit-tests
178143
- validation-tests
179-
- sonar-cloud
180144
permissions:
181145
contents: write
182146
runs-on: ubuntu-latest

.github/workflows/sonar.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]>
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
name: Sonar Cloud
6+
7+
on:
8+
# run pipeline on push event of main branch
9+
push:
10+
branches:
11+
- main
12+
# run pipeline on pull request
13+
pull_request:
14+
# run pipeline on merge queue
15+
merge_group:
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}-sonar
19+
cancel-in-progress: true
20+
21+
jobs:
22+
sonar-cloud:
23+
permissions:
24+
contents: write
25+
runs-on: ubuntu-latest
26+
steps:
27+
28+
- name: Checkout source code
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
32+
33+
- name: Setup Python 3.11
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: "3.11"
37+
38+
- name: Install in develop mode
39+
run: |
40+
pip install -e .[dev]
41+
42+
- name: Test and Coverage
43+
run: |
44+
pytest
45+
46+
# Fix relative paths in coverage file
47+
# Known bug: https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057
48+
sed -i 's@/home/runner/work/power-grid-model-io/power-grid-model-io@/github/workspace@g' python_coverage.xml
49+
50+
- name: SonarCloud Scan
51+
if: ${{ (github.event_name == 'push') || (github.event.pull_request.head.repo.owner.login == 'PowerGridModel') }}
52+
uses: SonarSource/sonarqube-scan-action@master
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)