33# SPDX-License-Identifier: MPL-2.0
44
55
6- name : Build, Test, Sonar
6+ name : Build and Test
77
88on :
9- push :
10- branches :
11- - main
12- # run pipeline on pull request
13- pull_request :
14- # run pipeline on merge queue
15- merge_group :
169 # run pipeline from another workflow
1710 workflow_call :
1811 inputs :
7164 name : power-grid-model-io
7265 path : wheelhouse/
7366
74- sonar-cloud :
75- permissions :
76- contents : write
77- runs-on : ubuntu-latest
78- steps :
79-
80- - name : Checkout source code
81- uses : actions/checkout@v4
82- with :
83- fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
84-
85- - name : Setup Python 3.11
86- uses : actions/setup-python@v5
87- with :
88- python-version : " 3.11"
89-
90- - name : Install in develop mode
91- run : |
92- pip install -e .[dev]
93-
94- - name : Test and Coverage
95- run : |
96- pytest
97-
98- # Fix relative paths in coverage file
99- # Known bug: https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057
100- sed -i 's@/home/runner/work/power-grid-model-io/power-grid-model-io@/github/workspace@g' python_coverage.xml
101-
102- - name : SonarCloud Scan
103- if : ${{ (github.event_name == 'push') || (github.event.pull_request.head.repo.owner.login == 'PowerGridModel') }}
104- uses : SonarSource/sonarqube-scan-action@master
105- env :
106- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
107- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
108-
10967 unit-tests :
11068 needs : build-python
11169 strategy :
@@ -183,7 +141,6 @@ jobs:
183141 - build-python
184142 - unit-tests
185143 - validation-tests
186- - sonar-cloud
187144 permissions :
188145 contents : write
189146 runs-on : ubuntu-latest
@@ -207,7 +164,7 @@ jobs:
207164 run : echo "${{ steps.tag.outputs.tag }}"
208165
209166 - name : Create GitHub release
210- if : (github.event_name == 'push') || ((github.event_name == 'workflow_dispatch') && (github.event. inputs.create_release == 'true') )
167+ if : (inputs.create_release)
211168 uses : softprops/action-gh-release@v2
212169 with :
213170 files : |
0 commit comments