Skip to content

Commit 8424801

Browse files
committed
Merge branch 'dev' into ms/#251-upgrade-to-scala3
# Conflicts: # CHANGELOG.md
2 parents 0840bc9 + 45c5f64 commit 8424801

30 files changed

+531
-208
lines changed

.github/workflows/ci.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# © 2025. TU Dortmund University,
2+
# Institute of Energy Systems, Energy Efficiency and Energy Economics,
3+
# Research group Distribution grid planning and operation
4+
#
5+
6+
name: CI
7+
8+
on:
9+
push:
10+
paths-ignore:
11+
- 'docs/**'
12+
branches:
13+
- main
14+
- dev
15+
- 'hotfix/*'
16+
- 'rel/*'
17+
- 'dependabot/*'
18+
pull_request:
19+
branches:
20+
- main
21+
- dev
22+
23+
jobs:
24+
buildAndTest:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout Source
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Setup Java
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: 'temurin'
37+
java-version: 17
38+
39+
- name: Setup Gradle
40+
uses: gradle/actions/setup-gradle@v4
41+
42+
- name: Check Branch
43+
run: |
44+
if [ "${{ github.event_name }}" == "pull_request" ]; then
45+
BRANCH_NAME="${{ github.head_ref }}"
46+
else
47+
BRANCH_NAME="${{ github.ref_name }}"
48+
fi
49+
50+
if [[ "$BRANCH_NAME" == refs/heads/* ]]; then
51+
BRANCH_NAME="${BRANCH_NAME#refs/heads/}"
52+
fi
53+
54+
export BRANCH_NAME
55+
56+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
57+
58+
./gradlew checkBranchName -PbranchName="$BRANCH_NAME" --warning-mode=none
59+
60+
bash scripts/branch_type.sh
61+
62+
- name: Version Check
63+
if: ${{ github.event_name == 'pull_request' }}
64+
env:
65+
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
66+
run: bash scripts/run-version-check.sh
67+
68+
- name: Build Project
69+
run: ./gradlew --refresh-dependencies clean assemble spotlessCheck
70+
71+
- name: Run Tests
72+
run: ./gradlew pmdMain pmdTest test jacocoTestReport jacocoTestCoverageVerification
73+
74+
- name: Build Java-Docs
75+
run: ./gradlew javadoc
76+
77+
- name: SonarQube
78+
run: |
79+
./gradlew sonar \
80+
-Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \
81+
-Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \
82+
-Dsonar.login=${{ secrets.SONAR_TOKEN }} \
83+
-Dsonar.qualitygate.wait=true
84+
85+
#Deployment
86+
- name: Deploy
87+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
88+
env:
89+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVENCENTRAL_SIGNINGKEY }}
90+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVENCENTRAL_SIGNINGPASS }}
91+
ORG_GRADLE_PROJECT_user: ${{ secrets.MAVENCENTRAL_USER }}
92+
ORG_GRADLE_PROJECT_password: ${{ secrets.MAVENCENTRAL_PASS }}
93+
run: |
94+
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
95+
currentVersion=$(./gradlew -q currentVersion)
96+
else
97+
currentVersion=$(./gradlew -q devVersion)
98+
fi
99+
100+
echo "currentVersion=$currentVersion"
101+
102+
./gradlew publish -PdeployVersion=$currentVersion
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Dependabot auto-merge
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'ie3-institute/simonaAPI'
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
19+
- name: Enable auto-merge for Dependabot PRs
20+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
21+
run: gh pr merge --auto --merge "$PR_URL"
22+
env:
23+
PR_URL: ${{ github.event.pull_request.html_url }}
24+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased/Snapshot]
8+
### Added
9+
- Implementing auto-merge for dependabot PRs [#273](https://github.com/ie3-institute/simonaAPI/issues/273)
10+
- Implemented GitHub Actions pipeline [#247](https://github.com/ie3-institute/simonaAPI/issues/247)
11+
12+
### Changed
13+
- Converting pekko classic to typed [#232](https://github.com/ie3-institute/simonaAPI/issues/232)
14+
15+
## [0.7.0] - 2025-03-11
816

917
### Added
1018
- Added Bao and Staudt to the list of reviewers [#216](https://github.com/ie3-institute/simonaAPI/issues/216)
1119
- Documentation for this API [#230](https://github.com/ie3-institute/simonaAPI/issues/230)
1220

13-
### Changed
21+
#### Changed
22+
- Updated PSDM to 6.0.0
1423
- Upgraded to `scala3` [#251](https://github.com/ie3-institute/simonaAPI/issues/251)
1524

1625
## [0.6.0] - 2024-12-02
@@ -54,7 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5463
- Renamed messages to ease understanding [#62](https://github.com/ie3-institute/simonaAPI/issues/62)
5564
- Separating departures and arrivals in message protocol, properly handling exceptions [#77](https://github.com/ie3-institute/simonaAPI/issues/77)
5665

57-
[Unreleased/Snapshot]: https://github.com/ie3-institute/simonaapi/compare/0.6.0...HEAD
66+
[Unreleased/Snapshot]: https://github.com/ie3-institute/simonaapi/compare/0.7.0...HEAD
67+
[0.7.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/0.6.0...0.7.0
5868
[0.6.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/0.5.0...0.6.0
5969
[0.5.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/0.4.0...0.5.0
6070
[0.4.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/0.3.0...0.4.0

build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
22
id 'groovy' // groovy support
33
id 'java' // java support
4-
id 'com.diffplug.spotless' version '7.0.2'//code format
4+
id 'com.diffplug.spotless' version '7.0.3'//code format
55
id 'pmd' // code check, working on source code
6-
id 'com.github.spotbugs' version '6.1.5' // code check, working on byte code
7-
id "org.sonarqube" version "6.0.1.5171" // sonarqube
6+
id 'com.github.spotbugs' version '6.1.7' // code check, working on byte code
7+
id "org.sonarqube" version "6.1.0.5360" // sonarqube
88
id 'signing'
99
id 'maven-publish' // publish to a maven repo (local or mvn central, has to be defined)
1010
id 'jacoco' // java code coverage plugin
@@ -40,6 +40,7 @@ apply from: scriptsLocation + 'mavenCentralPublish.gradle'
4040
apply from: scriptsLocation + 'jacoco.gradle'
4141
apply from: scriptsLocation + 'documentation.gradle'
4242
apply from: scriptsLocation + 'test.gradle'
43+
apply from: scriptsLocation + 'branchName.gradle'
4344

4445
repositories {
4546
mavenCentral()
@@ -61,7 +62,7 @@ dependencies{
6162
}
6263

6364
//PSDM
64-
implementation('com.github.ie3-institute:PowerSystemDataModel:5.1.0') {
65+
implementation('com.github.ie3-institute:PowerSystemDataModel:6.0.0') {
6566
exclude group: 'org.apache.logging.log4j'
6667
exclude group: 'org.slf4j'
6768
/* Exclude our own nested dependencies */
@@ -75,8 +76,9 @@ dependencies{
7576
implementation 'org.apache.logging.log4j:log4j-slf4j-impl' // log4j -> slf4j
7677

7778
// pekko
78-
implementation "org.apache.pekko:pekko-actor_${scalaVersion}:${pekkoVersion}"
79-
testImplementation "org.apache.pekko:pekko-testkit_${scalaVersion}:${pekkoVersion}" // pekko testkit
79+
implementation "org.apache.pekko:pekko-actor-typed_${scalaVersion}:${pekkoVersion}"
80+
81+
testImplementation "org.apache.pekko:pekko-actor-testkit-typed_${scalaVersion}:${pekkoVersion}" // pekko typed testkit
8082

8183
// TESTING
8284
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'

docs/readthedocs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
commonmark==0.9.1
22
recommonmark==0.7.1
3-
Sphinx==8.1.3
3+
Sphinx==8.2.3
44
sphinx-rtd-theme==3.0.2
5-
myst-parser==4.0.0
5+
myst-parser==4.0.1
66
markdown-it-py==3.0.0

gradle/scripts/branchName.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
tasks.register('checkBranchName') {
2+
doLast {
3+
if (!project.hasProperty('branchName')) {
4+
throw new GradleException("Error: Missing required property 'branchName'.")
5+
}
6+
7+
def branchName = project.property('branchName')
8+
9+
def patterns = [
10+
~/^(developer|develop|dev)$/,
11+
~/.*rel\/.*/,
12+
~/^dependabot\/.*$/,
13+
~/.*hotfix\/\pL{2}\/#\d+.*/,
14+
~/.*main/,
15+
~/^[a-z]{2}\/#[0-9]+(?:-.+)?$/
16+
]
17+
18+
def isValid = patterns.any { pattern -> branchName ==~ pattern }
19+
20+
if (!isValid) {
21+
throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName). Current branch name is $branchName.")
22+
}
23+
24+
println "Branch name is $branchName"
25+
}
26+
}

gradle/scripts/semVer.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// tasks for semantic versioning using semver-gradle https://github.com/ethauvin/semver-gradle
22

3-
task currentVersion {
4-
doFirst{
3+
tasks.register('currentVersion') {
4+
doFirst {
55
println semver.semver
66
}
77
}
88

9-
task devVersion {
10-
doFirst{
9+
tasks.register('devVersion') {
10+
doFirst {
1111
println "${semver.major}.${semver.minor}-SNAPSHOT"
1212
}
1313
}

gradle/scripts/spotless.gradle

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ spotless {
2020
licenseHeader "#!groovy\n\n" + ie3LicHead, "////////////////////////////////"
2121
// the Groovy Eclipse formatter extends the Java Eclipse formatter,
2222
// so it formats Java files by default (unless `excludeJava` is used).
23-
// FIXME rolled back greclipse version https://github.com/diffplug/spotless/issues/1860
24-
greclipse('4.27')
25-
indentWithSpaces 2
23+
greclipse()
24+
leadingTabsToSpaces 2
2625
}
2726

2827
groovyGradle {
2928
// same as groovy, but for .gradle (defaults to '*.gradle')
3029
target '*.gradle', 'gradle/scripts/*.gradle'
31-
// FIXME rolled back greclipse version https://github.com/diffplug/spotless/issues/1860
32-
greclipse('4.27')
33-
indentWithSpaces 2
30+
greclipse()
31+
leadingTabsToSpaces 2
3432
}
3533

3634
//sets a license header, removes unused imports and formats conforming to the scala fmt formatter
@@ -43,15 +41,15 @@ spotless {
4341
format 'misc', {
4442
target '**/.gitignore', 'configs/**'
4543
trimTrailingWhitespace()
46-
indentWithTabs()
44+
leadingSpacesToTabs()
4745
endWithNewline()
4846
}
4947

5048
/* Formats markdown files, just like the other misc files, but without trimming trailing white spaces (nested
5149
* enumerations) */
5250
format 'md', {
5351
target '**/*.md'
54-
indentWithSpaces 2
52+
leadingTabsToSpaces 2
5553
endWithNewline()
5654
}
5755
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

scripts/branch_type.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [ -z "${BRANCH_NAME:-}" ]; then
5+
echo "Error: BRANCH_NAME variable is not set."
6+
exit 1
7+
fi
8+
9+
10+
pattern_dev='^(developer|develop|dev)$'
11+
pattern_release='.*rel/.*'
12+
pattern_dependabot='^dependabot/.*'
13+
pattern_hotfix='.*hotfix/.*'
14+
pattern_main='.*main'
15+
pattern_feature='^[a-z]{2}/#[0-9]+(-.+)?$'
16+
17+
BRANCH_TYPE="unknown"
18+
19+
if [[ "$BRANCH_NAME" =~ $pattern_dev ]]; then
20+
BRANCH_TYPE="dev"
21+
elif [[ "$BRANCH_NAME" =~ $pattern_release ]]; then
22+
BRANCH_TYPE="release"
23+
elif [[ "$BRANCH_NAME" =~ $pattern_dependabot ]]; then
24+
BRANCH_TYPE="dependabot"
25+
elif [[ "$BRANCH_NAME" =~ $pattern_hotfix ]]; then
26+
BRANCH_TYPE="hotfix"
27+
elif [[ "$BRANCH_NAME" =~ $pattern_main ]]; then
28+
BRANCH_TYPE="main"
29+
elif [[ "$BRANCH_NAME" =~ $pattern_feature ]]; then
30+
BRANCH_TYPE="feature"
31+
else
32+
echo "Error:'$BRANCH_NAME' does not match any pattern."
33+
exit 1
34+
fi
35+
36+
echo "========================="
37+
echo "Branch type: $BRANCH_TYPE"
38+
echo "BRANCH_TYPE=$BRANCH_TYPE" >> "$GITHUB_ENV"
39+
echo "========================="

0 commit comments

Comments
 (0)