Skip to content

Commit 60493eb

Browse files
authored
Merge branch 'dev' into ms/#1294-enhancing-load-profile-source
2 parents f581aa5 + 9922241 commit 60493eb

31 files changed

+891
-54
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 Gradle
34+
uses: gradle/actions/setup-gradle@v4
35+
36+
- name: Check Branch
37+
run: |
38+
if [ "${{ github.event_name }}" == "pull_request" ]; then
39+
BRANCH_NAME="${{ github.head_ref }}"
40+
else
41+
BRANCH_NAME="${{ github.ref_name }}"
42+
fi
43+
44+
if [[ "$BRANCH_NAME" == refs/heads/* ]]; then
45+
BRANCH_NAME="${BRANCH_NAME#refs/heads/}"
46+
fi
47+
48+
export BRANCH_NAME
49+
50+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
51+
52+
./gradlew checkBranchName -PbranchName="$BRANCH_NAME" --warning-mode=none
53+
54+
bash scripts/branch_type.sh
55+
56+
- name: Version Check
57+
if: ${{ github.event_name == 'pull_request' }}
58+
env:
59+
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
60+
run: bash scripts/run-version-check.sh
61+
62+
- name: Setup Java
63+
uses: actions/setup-java@v4
64+
with:
65+
distribution: 'temurin'
66+
java-version: 17
67+
68+
- name: Build Project
69+
run: ./gradlew --refresh-dependencies clean assemble spotlessCheck
70+
71+
- name: Run Tests
72+
run: ./gradlew pmdMain pmdTest spotbugsMain spotbugsTest 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

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased/Snapshot]
88

99
### Added
10+
- Implemented GitHub Actions for automatic code integration. [#1237](https://github.com/ie3-institute/PowerSystemDataModel/issues/1237)
11+
- Added `CopyBuilders` to `Line-/Transformer2W-/Tranformer3WTypeInput` [#1275](https://github.com/ie3-institute/PowerSystemDataModel/issues/1275)
1012

1113
### Fixed
12-
14+
- Fixed SonarQube junit path issue in GitHub Actions [#1284](https://github.com/ie3-institute/PowerSystemDataModel/issues/1284)
1315
### Changed
1416
- Replaced `return this` with `return thisInstance` in CopyBuilders [#1250](https://github.com/ie3-institute/PowerSystemDataModel/issues/1250)
1517
- Enhancing load profile source [#1294](https://github.com/ie3-institute/PowerSystemDataModel/issues/1294)
@@ -30,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3032
- Added domestic hot water storage model [#1257](https://github.com/ie3-institute/PowerSystemDataModel/issues/1257)
3133
- Validation for BDEW load profile values [#1243](https://github.com/ie3-institute/PowerSystemDataModel/issues/1243)
3234
- Added load profiles sources [#1106](https://github.com/ie3-institute/PowerSystemDataModel/issues/1106)
35+
- Add `v2gSupport` parameter to documentation of `EvcsModel` [#1278](https://github.com/ie3-institute/PowerSystemDataModel/issues/1278)
3336

3437
### Fixed
3538
- Removing opened `SwitchInput` during connectivity check [#1221](https://github.com/ie3-institute/PowerSystemDataModel/issues/1221)

build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
id 'de.undercouch.download' version '5.6.0'
1010
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
1111
id 'jacoco' // java code coverage plugin
12-
id "org.sonarqube" version "6.0.1.5171" // sonarqube
12+
id "org.sonarqube" version "6.1.0.5360" // sonarqube
1313
id 'net.thauvin.erik.gradle.semver' version '1.0.4' // semantic versioning
1414
id "com.github.johnrengelman.shadow" version "8.1.1" // fat jar
1515
}
@@ -45,6 +45,7 @@ apply from: scriptsLocation + 'mavenCentralPublish.gradle'
4545
apply from: scriptsLocation + 'sonarqube.gradle'
4646
apply from: scriptsLocation + 'vcs.gradle'
4747
apply from: scriptsLocation + 'semVer.gradle'
48+
apply from: scriptsLocation + 'branchName.gradle' // checks naming scheme of branches
4849

4950
repositories {
5051
mavenCentral() // searches in Sonatype's repository 'Maven Central'
@@ -80,7 +81,7 @@ dependencies {
8081
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
8182
testImplementation "org.spockframework:spock-core:2.3-groovy-$groovyVersion"
8283
testImplementation 'org.objenesis:objenesis:3.4' // Mock creation with constructor parameters
83-
testImplementation 'net.bytebuddy:byte-buddy:1.17.2' // Mocks of classes
84+
testImplementation 'net.bytebuddy:byte-buddy:1.17.5' // Mocks of classes
8485

8586
// testcontainers (docker framework for testing)
8687
testImplementation "org.testcontainers:testcontainers:$testcontainersVersion"
@@ -96,8 +97,8 @@ dependencies {
9697
implementation 'org.apache.logging.log4j:log4j-slf4j-impl' // log4j -> slf4j
9798

9899
// Databases
99-
implementation 'org.influxdb:influxdb-java:2.24'
100-
implementation 'com.couchbase.client:java-client:3.7.8'
100+
implementation 'org.influxdb:influxdb-java:2.25'
101+
implementation 'com.couchbase.client:java-client:3.7.9'
101102
runtimeOnly 'org.postgresql:postgresql:42.7.5' // postgresql jdbc driver required during runtime
102103

103104
implementation 'commons-io:commons-io:2.18.0' // I/O functionalities
@@ -114,7 +115,7 @@ tasks.withType(Javadoc){
114115
failOnError = false // TODO: Temp until JavaDoc issues are resolved
115116
}
116117

117-
task printVersion {
118+
tasks.register('printVersion') {
118119
doLast {
119120
println project.version
120121
}

docs/readthedocs/models/input/participant/evcs.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ station and has some limitations outlined below.
5858
* - locationType
5959
-
6060
- [Charging station location types](#location-types)
61+
62+
* - v2gSupport
63+
- Boolean
64+
- Vehicle to grid (V2G) support, true if the charging station supports feed in.
6165
6266
* - em
6367
-

docs/readthedocs/models/input/thermal/thermalhouse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ This reflects a simple shoe box with transmission losses
6161
- –
6262
- Type of building can either be house or flat
6363
64-
* - numberInhabititans
64+
* - numberInhabitants
6565
- –
6666
- Number of people living in the house. Double values to enable modeling based on statistical data sources.
6767

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/sonarqube.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ sonarqube {
1414
'src/test/groovy'] // test src dirs
1515
// reports stuff (for all languages)
1616
property 'sonar.junit.reportPaths', [
17-
'build/test-results/allTests'] // Comma-delimited list of paths to Surefire XML-format reports.
17+
'build/test-results/test'] // Comma-delimited list of paths to Surefire XML-format reports.
1818
// unit tests reports dirs
1919
property "sonar.coverage.jacoco.xmlReportsPath", [
2020
"build/reports/jacoco/test/jacocoTestReport.xml"] // Comma-separated list of paths to JaCoCo (jacoco.xml) report files.

gradle/scripts/tests.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
test {
22
useJUnitPlatform()
33
testLogging {
4-
events "skipped", "failed"
4+
events = ["skipped", "failed"]
55
}
66

77
// Improve logging for failed Spock tests
88
testLogging {
9-
exceptionFormat "Full"
9+
exceptionFormat = "Full"
1010
}
1111
}
1212

13-
task unitTest(type: Test) {
14-
description 'Run only unit tests.'
15-
group 'Verification'
13+
tasks.register('unitTest', Test) {
14+
description = 'Run only unit tests.'
15+
group = 'Verification'
1616

1717
filter {
1818
includeTestsMatching '*Test*.*'
1919
excludeTestsMatching '*IT'
2020
}
2121
useJUnitPlatform()
2222
testLogging {
23-
events "skipped", "failed"
23+
events = ["skipped", "failed"]
2424
}
2525
}
2626

27-
task integrationTest(type: Test) {
28-
description 'Run only the integration tests.'
29-
group 'Verification'
27+
tasks.register('integrationTest', Test) {
28+
description = 'Run only the integration tests.'
29+
group = 'Verification'
3030

3131
filter {
3232
includeTestsMatching '*IT.*'
3333
excludeTestsMatching '*Test*.*'
3434
}
3535
useJUnitPlatform()
3636
testLogging {
37-
events "skipped", "failed"
37+
events = ["skipped", "failed"]
3838
}
3939

4040
mustRunAfter unitTest

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)