Skip to content

Commit 12527b3

Browse files
authored
Merge pull request #307 from PowerGridModel/fix/github-release-workflow-renaming
Github release workflow fix: Rename job call
2 parents ec5647e + f03cbaa commit 12527b3

File tree

7 files changed

+82
-76
lines changed

7 files changed

+82
-76
lines changed

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

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@
33
# SPDX-License-Identifier: MPL-2.0
44

55

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

88
on:
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:
@@ -71,41 +64,6 @@ jobs:
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: |

.github/workflows/check-code-quality.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66
name: Check Code Quality
77

88
on:
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

.github/workflows/ci.yml

Lines changed: 22 additions & 12 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 and Publish
6+
name: CI Build
77

88
on:
99
push:
@@ -13,14 +13,6 @@ on:
1313
pull_request:
1414
# run pipeline on merge queue
1515
merge_group:
16-
# run pipeline from another workflow
17-
workflow_call:
18-
inputs:
19-
create_release:
20-
type: boolean
21-
description: Create a (pre-)release when CI passes
22-
default: false
23-
required: false
2416
# run this workflow manually from the Actions tab
2517
workflow_dispatch:
2618
inputs:
@@ -31,10 +23,15 @@ on:
3123
required: true
3224

3325
concurrency:
34-
group: ${{ github.workflow }}-${{ github.ref }}-main
26+
group: ${{ github.workflow }}-${{ github.ref }}-ci-build
3527
cancel-in-progress: true
3628

3729
jobs:
30+
ci-started:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- run: echo "ci started"
34+
3835
build-test-release:
3936
name: build-test-release
4037
uses: "./.github/workflows/build-test-release.yml"
@@ -46,14 +43,27 @@ jobs:
4643
# otherwise create_release becomes false
4744
create_release: ${{ (github.event_name == 'workflow_dispatch' && inputs.create_release) || github.event_name == 'push'}}
4845

46+
check-code-quality:
47+
uses: "./.github/workflows/check-code-quality.yml"
48+
49+
reuse-compliance:
50+
uses: "./.github/workflows/reuse-compliance.yml"
51+
52+
ci-passed:
53+
runs-on: ubuntu-latest
54+
needs: [ci-started, build-test-release, check-code-quality, reuse-compliance]
55+
56+
steps:
57+
- run: echo "ci passed"
58+
4959
publish:
5060
name: Publish to PyPI
5161
runs-on: ubuntu-latest
5262
permissions:
5363
contents: write
5464
id-token: write # Required for Trusted Publishing
55-
needs: github-release
56-
if: (github.event_name == 'workflow_dispatch') || github.event_name == 'push'
65+
needs: build-test-release
66+
if: (github.event_name == 'workflow_dispatch' && inputs.create_release) || github.event_name == 'push'
5767

5868
steps:
5969
- name: Download assets from GitHub release

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
main:
18+
build-test-release:
1919
uses: "./.github/workflows/build-test-release.yml"
2020
permissions:
2121
contents: write

.github/workflows/reuse-compliance.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66
name: REUSE Compliance Check
77

88
on:
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
# run this workflow manually from the Actions tab

.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 }}

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ SPDX-License-Identifier: MPL-2.0
1010
[![Downloads](https://static.pepy.tech/badge/power-grid-model-io)](https://pepy.tech/project/power-grid-model-io)
1111
[![Downloads](https://static.pepy.tech/badge/power-grid-model-io/month)](https://pepy.tech/project/power-grid-model-io)
1212

13-
[![Build and Test Python](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/build-test-and-sonar.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/build-test-and-sonar.yml)
14-
[![Check Code Quality](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/check-code-quality.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/check-code-quality.yml)
15-
[![REUSE Compliance Check](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/reuse-compliance.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/reuse-compliance.yml)
13+
[![CI Build](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/ci.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model-io/actions/workflows/ci.yml)
1614
[![docs](https://readthedocs.org/projects/power-grid-model-io/badge/)](https://power-grid-model-io.readthedocs.io/en/stable/)
1715

1816
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=PowerGridModel_power-grid-model-io&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=PowerGridModel_power-grid-model-io)
@@ -26,7 +24,7 @@ SPDX-License-Identifier: MPL-2.0
2624

2725
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8059257.svg)](https://zenodo.org/record/8059257)
2826

29-
[![](https://github.com/PowerGridModel/.github/blob/main/artwork/svg/color.svg)](#)
27+
[![Power Grid Model logo](https://github.com/PowerGridModel/.github/blob/main/artwork/svg/color.svg)](#)
3028

3129
# Power Grid Model Input/Output
3230

0 commit comments

Comments
 (0)