Skip to content

Commit d9407ce

Browse files
authored
Merge pull request #908 from Laurynas-Jagutis/feature/full-workflow-setup
Workflow setup
2 parents fca3c9f + e54bc27 commit d9407ce

7 files changed

Lines changed: 75 additions & 48 deletions

File tree

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,13 @@ name: Build and Test C++ and Python
66

77
# Controls when the workflow will run
88
on:
9-
# run pipeline on push event of main branch
10-
push:
11-
branches:
12-
- main
13-
# run pipeline on pull request
14-
pull_request:
15-
# run pipeline on merge queue
16-
merge_group:
179
# run pipeline from another workflow
1810
workflow_call:
1911
inputs:
2012
create_release:
2113
type: boolean
2214
description: Create a (pre-)release when CI passes
23-
default: false
24-
required: false
15+
required: true
2516
# run this workflow manually from the Actions tab
2617
workflow_dispatch:
2718
inputs:
@@ -31,13 +22,12 @@ on:
3122
default: false
3223
required: true
3324

25+
3426
concurrency:
3527
group: ${{ github.workflow }}-${{ github.ref }}-main
3628
cancel-in-progress: true
3729

38-
3930
jobs:
40-
4131
acquire-python-version-build-sdist:
4232
name: Build sdist and set version
4333
runs-on: ubuntu-24.04
@@ -54,7 +44,7 @@ jobs:
5444
python set_pypi_version.py
5545
5646
- name: Build SDist
57-
run: python -m build --sdist --outdir wheelhouse .
47+
run: python -m build --sdist --outdir wheelhouse .
5848

5949
- name: Keep version file
6050
uses: actions/upload-artifact@v4
@@ -242,7 +232,6 @@ jobs:
242232
shell: bash -el {0}
243233
- os: windows
244234
shell: powershell
245-
246235
env:
247236
POWER_GRID_MODEL_NO_BINARY_BUILD: 1
248237

@@ -272,7 +261,6 @@ jobs:
272261
$vsPath = &(Join-Path ${env:ProgramFiles(x86)} '\Microsoft Visual Studio\Installer\vswhere.exe') -property installationpath
273262
Import-Module (Join-Path $vsPath 'Common7\Tools\Microsoft.VisualStudio.DevShell.dll')
274263
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -host_arch=x64'
275-
276264
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -B build/ -S .
277265
cmake --build build/ --verbose -j1
278266
cmake --install build/ --prefix ${env:CONDA_PREFIX}/Library
@@ -282,10 +270,10 @@ jobs:
282270
run: |
283271
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -B build/ -S . -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
284272
cmake --build build/ --verbose -j1
285-
cmake --install build/
273+
cmake --install build/
286274
287275
- name: Build python
288-
run: python -m pip install . -vv --no-build-isolation --no-deps
276+
run: python -m pip install . -vv --no-build-isolation --no-deps
289277

290278
- name: Test
291279
run: pytest
@@ -337,15 +325,15 @@ jobs:
337325
run: echo "${{ steps.tag.outputs.tag }}"
338326

339327
- name: Upload wheels
340-
if: (github.event_name == 'push') || ((github.event_name == 'workflow_dispatch') && (inputs.create_release == 'true'))
328+
if: (inputs.create_release)
341329
run: |
342330
pip install twine
343331
echo "Publish to PyPI..."
344332
twine upload --verbose wheelhouse/*
345333
346334
- name: Release
347335
uses: softprops/action-gh-release@v2
348-
if: (github.event_name == 'push') || ((github.event_name == 'workflow_dispatch') && (inputs.create_release == 'true'))
336+
if: (inputs.create_release)
349337
with:
350338
files: |
351339
./wheelhouse/*

.github/workflows/check-blocking-labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#
33
# SPDX-License-Identifier: MPL-2.0
44

5-
65
name: Check Blocking Labels
76

87
on:
@@ -44,3 +43,4 @@ jobs:
4443
run: |
4544
echo "This pull request needs (more) unit tests before it may be merged (needs-unit-tests)"
4645
exit 3
46+

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
name: Check Code Quality
1212

1313
on:
14-
# run pipeline on push event of main branch
15-
push:
16-
branches:
17-
- main
18-
# run pipeline on pull request
19-
pull_request:
20-
# run pipeline on merge queue
21-
merge_group:
2214
# run pipeline from another workflow
2315
workflow_call:
2416

.github/workflows/ci.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
name: CI Build
6+
7+
# Controls when the workflow will run.
8+
on:
9+
# run pipeline on push event of main branch
10+
push:
11+
branches:
12+
- main
13+
# run pipeline on pull request
14+
pull_request:
15+
# run pipeline on merge queue
16+
merge_group:
17+
# run this workflow manually from the Actions tab
18+
workflow_dispatch:
19+
inputs:
20+
create_release:
21+
type: boolean
22+
description: Create a (pre-)release when CI passes
23+
default: false
24+
required: true
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}-ci-build
28+
cancel-in-progress: true
29+
30+
jobs:
31+
ci-started:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- run: echo "ci started"
35+
36+
build-test-release:
37+
name: build-test-release
38+
uses: "./.github/workflows/build-test-release.yml"
39+
permissions:
40+
contents: write
41+
with:
42+
# create_release becomes true if the event that triggered this workflow is "workflow_dispatch" and inputs.create_release is true
43+
# create_release becomes true if the event that triggered this workflow is "push" on main
44+
# otherwise create_release becomes false
45+
create_release: ${{ (github.event_name == 'workflow_dispatch' && inputs.create_release) || github.event_name == 'push'}}
46+
47+
check-code-quality:
48+
uses: "./.github/workflows/check-code-quality.yml"
49+
50+
reuse-compliance:
51+
uses: "./.github/workflows/reuse-compliance.yml"
52+
53+
clang-tidy:
54+
uses: "./.github/workflows/clang-tidy.yml"
55+
with:
56+
target: "power_grid_model_api_tests"
57+
58+
ci-passed:
59+
runs-on: ubuntu-latest
60+
needs: [ci-started, build-test-release, check-code-quality, reuse-compliance, clang-tidy]
61+
62+
steps:
63+
- run: echo "ci passed"

.github/workflows/clang-tidy.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
name: Clang Tidy
66

77
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:
168
# run pipeline from another workflow
179
workflow_call:
1810
inputs:

.github/workflows/reuse-compliance.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
name: REUSE Compliance Check
66

77
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:
168
# run pipeline from another workflow
179
workflow_call:
1810
# run this workflow manually from the Actions tab

README.md

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

13-
[![Build and Test C++ and Python](https://github.com/PowerGridModel/power-grid-model/actions/workflows/main.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model/actions/workflows/main.yml)
14-
[![Check Code Quality](https://github.com/PowerGridModel/power-grid-model/actions/workflows/check-code-quality.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model/actions/workflows/check-code-quality.yml)
15-
[![Clang Tidy](https://github.com/PowerGridModel/power-grid-model/actions/workflows/clang-tidy.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model/actions/workflows/clang-tidy.yml)
16-
[![REUSE Compliance Check](https://github.com/PowerGridModel/power-grid-model/actions/workflows/reuse-compliance.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model/actions/workflows/reuse-compliance.yml)
13+
[![Build and Test C++ and Python](https://github.com/PowerGridModel/power-grid-model/actions/workflows/ci.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model/actions/workflows/build-test-release.yml)
14+
[![Check Code Quality](https://github.com/PowerGridModel/power-grid-model/actions/workflows/ci.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model/actions/workflows/check-code-quality.yml)
15+
[![Clang Tidy](https://github.com/PowerGridModel/power-grid-model/actions/workflows/ci.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model/actions/workflows/clang-tidy.yml)
16+
[![REUSE Compliance Check](https://github.com/PowerGridModel/power-grid-model/actions/workflows/ci.yml/badge.svg)](https://github.com/PowerGridModel/power-grid-model/actions/workflows/reuse-compliance.yml)
1717
[![docs](https://readthedocs.org/projects/power-grid-model/badge/)](https://power-grid-model.readthedocs.io/en/stable/)
1818

1919
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=PowerGridModel_power-grid-model&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=PowerGridModel_power-grid-model)

0 commit comments

Comments
 (0)