From a5e78825bc07d49d44cf508dd4392b808faed4c2 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 17:14:45 +0200 Subject: [PATCH 001/165] Testing Checkout --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..e83e62c628 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +# © 2024. TU Dortmund University, +# Institute of Energy Systems, Energy Efficiency and Energy Economics, +# Research group Distribution grid planning and operation +# + +name: CI + +on: + push: + branches: + - main + - dev + - 'feature/*' + - 'hotfix/*' + - 'release/*' + pull_request: + branches: + - main + - dev + + jobs: + checkout_code: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + # Check if it's a pull request + ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Get Commit Hash + id: get_commit + run: echo "::set-output name=hash::$(git rev-parse HEAD)" + + - name: Display Commit Hash + run: + echo "Checked out commit hash: ${{ steps.get_commit.outputs.hash }}" \ No newline at end of file From c205a34cc360de7389638c61a2b1e90048b7a8b0 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 17:18:55 +0200 Subject: [PATCH 002/165] Fixed Syntax --- .github/workflows/ci.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e83e62c628..2f32e94300 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,22 +18,22 @@ on: - main - dev - jobs: - checkout_code: - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - # Check if it's a pull request - ref: ${{ github.event.pull_request.head.ref || github.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} +jobs: + checkout_code: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + # Check if it's a pull request + ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Get Commit Hash - id: get_commit - run: echo "::set-output name=hash::$(git rev-parse HEAD)" + - name: Get Commit Hash + id: get_commit + run: echo "::set-output name=hash::$(git rev-parse HEAD)" - - name: Display Commit Hash - run: - echo "Checked out commit hash: ${{ steps.get_commit.outputs.hash }}" \ No newline at end of file + - name: Display Commit Hash + run: + echo "Checked out commit hash: ${{ steps.get_commit.outputs.hash }}" \ No newline at end of file From 0d7d2561083bc549d80ad9832c09318ac1f4799b Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 17:22:30 +0200 Subject: [PATCH 003/165] Fixed Syntax --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f32e94300..f6a83907d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,10 @@ jobs: - name: Get Commit Hash id: get_commit - run: echo "::set-output name=hash::$(git rev-parse HEAD)" + run: | + COMMIT_HASH=$(git rev-parse HEAD) + echo "::set-output name=hash::$COMMIT_HASH" - name: Display Commit Hash run: - echo "Checked out commit hash: ${{ steps.get_commit.outputs.hash }}" \ No newline at end of file + echo "Checked out commit hash: ${{ steps.get_commit.outputs.hash }}" From 81864ff2214275dd0db7c021cc5f684e09d09e92 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 17:31:46 +0200 Subject: [PATCH 004/165] removed unnecessary steps --- .github/workflows/ci.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6a83907d6..9a843da33c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,13 +29,3 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - - - name: Get Commit Hash - id: get_commit - run: | - COMMIT_HASH=$(git rev-parse HEAD) - echo "::set-output name=hash::$COMMIT_HASH" - - - name: Display Commit Hash - run: - echo "Checked out commit hash: ${{ steps.get_commit.outputs.hash }}" From e21113c23d8425f37d321d7e75b504a3fa5ec7f8 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 17:38:40 +0200 Subject: [PATCH 005/165] removed unnecessary steps --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a843da33c..7a7af82e40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,3 +29,5 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + run: + echo "Current branch: ${{ github.event.pull_request.head.ref || github.ref }}" From 1a322fe1169009c96b1300ec0baebb8c48b183bd Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 17:42:54 +0200 Subject: [PATCH 006/165] Syntax --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a7af82e40..7fd03ae240 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,5 +29,6 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Show current Branch run: echo "Current branch: ${{ github.event.pull_request.head.ref || github.ref }}" From a3581861705165c8f0321e2eeac288dcc2efb543 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 17:46:01 +0200 Subject: [PATCH 007/165] Syntax --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fd03ae240..70b45ff4f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,5 +30,5 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Show current Branch - run: - echo "Current branch: ${{ github.event.pull_request.head.ref || github.ref }}" + run: | + git rev-parse --abbrev-ref HEAD \ No newline at end of file From ef8ef612fb4a5e4a8064eb6c354cb1965333c193 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 17:57:04 +0200 Subject: [PATCH 008/165] Test SSH --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70b45ff4f7..5c5e4ebbad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,9 @@ jobs: checkout_code: runs-on: ubuntu-latest steps: + - name: Test SSH Key Authorization + if: secrets.SSH_PRIVATE_KEY + run: ssh -T git@github.com || echo "SSH key not authorized" - name: Checkout Code uses: actions/checkout@v4 with: @@ -29,6 +32,7 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Show current Branch + + - name: Show current branch run: | git rev-parse --abbrev-ref HEAD \ No newline at end of file From 9ff6b0f54a216bbdddfde91b39f0dbb62bd9074d Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 18:21:15 +0200 Subject: [PATCH 009/165] Testing Build ENV --- .github/workflows/ci.yml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c5e4ebbad..d9a847c47b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,12 +19,9 @@ on: - dev jobs: - checkout_code: + checkout: runs-on: ubuntu-latest steps: - - name: Test SSH Key Authorization - if: secrets.SSH_PRIVATE_KEY - run: ssh -T git@github.com || echo "SSH key not authorized" - name: Checkout Code uses: actions/checkout@v4 with: @@ -35,4 +32,26 @@ jobs: - name: Show current branch run: | - git rev-parse --abbrev-ref HEAD \ No newline at end of file + git rev-parse --abbrev-ref HEAD + + build: + runs-on: ubuntu-latest + container: + image: amazoncorretto:17 + options: --user root + + steps: + # Install Gradle 8.10 + - name: Install Gradle 8.10 + run: | + GRADLE_VERSION=8.10 + wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -P /tmp + unzip /tmp/gradle-${GRADLE_VERSION}-bin.zip -d /opt/gradle + rm /tmp/gradle-${GRADLE_VERSION}-bin.zip + echo "export GRADLE_HOME=/opt/gradle/gradle-${GRADLE_VERSION}" >> $GITHUB_ENV + echo "export PATH=\$GRADLE_HOME/bin:\$PATH" >> $GITHUB_ENV + + # Verify Gradle and Java installation + - name: Verify Gradle & Java version + run: + gradle -v && java -v \ No newline at end of file From 7a63e640e1680750c092837d72d98096e46cd9a7 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 18:24:49 +0200 Subject: [PATCH 010/165] Added wget --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9a847c47b..348dc9b23f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,8 @@ jobs: # Install Gradle 8.10 - name: Install Gradle 8.10 run: | + yum update -y + yum install -y wget unzip GRADLE_VERSION=8.10 wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -P /tmp unzip /tmp/gradle-${GRADLE_VERSION}-bin.zip -d /opt/gradle From 58b398b382624889a24ebbc4a7245e75d4584fb5 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 18:27:43 +0200 Subject: [PATCH 011/165] ENV --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 348dc9b23f..555ed69cb4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,8 +50,8 @@ jobs: wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -P /tmp unzip /tmp/gradle-${GRADLE_VERSION}-bin.zip -d /opt/gradle rm /tmp/gradle-${GRADLE_VERSION}-bin.zip - echo "export GRADLE_HOME=/opt/gradle/gradle-${GRADLE_VERSION}" >> $GITHUB_ENV - echo "export PATH=\$GRADLE_HOME/bin:\$PATH" >> $GITHUB_ENV + echo "GRADLE_HOME=/opt/gradle/gradle-${GRADLE_VERSION}" >> $GITHUB_ENV + echo "PATH=\$GRADLE_HOME/bin:\$PATH" >> $GITHUB_ENV # Verify Gradle and Java installation - name: Verify Gradle & Java version From 4907ebde12bec7aa74266d23146d973e43ca2515 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 18:29:56 +0200 Subject: [PATCH 012/165] added shell --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 555ed69cb4..c87f90d197 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,7 @@ jobs: steps: # Install Gradle 8.10 - name: Install Gradle 8.10 + shell: bash run: | yum update -y yum install -y wget unzip @@ -55,5 +56,6 @@ jobs: # Verify Gradle and Java installation - name: Verify Gradle & Java version + shell: bash run: gradle -v && java -v \ No newline at end of file From 717170db4a71dabbbf3d64c23c297f40fffa7f57 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 18:35:30 +0200 Subject: [PATCH 013/165] check java --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c87f90d197..4b9a6325cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,6 @@ jobs: steps: # Install Gradle 8.10 - name: Install Gradle 8.10 - shell: bash run: | yum update -y yum install -y wget unzip @@ -56,6 +55,5 @@ jobs: # Verify Gradle and Java installation - name: Verify Gradle & Java version - shell: bash run: - gradle -v && java -v \ No newline at end of file + java -v \ No newline at end of file From 868926f87bcdabb0e57d545a4e00752e6d1d9bff Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 18:40:23 +0200 Subject: [PATCH 014/165] check java --- .github/workflows/ci.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b9a6325cf..0314419580 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,17 +43,10 @@ jobs: steps: # Install Gradle 8.10 - name: Install Gradle 8.10 - run: | - yum update -y - yum install -y wget unzip - GRADLE_VERSION=8.10 - wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -P /tmp - unzip /tmp/gradle-${GRADLE_VERSION}-bin.zip -d /opt/gradle - rm /tmp/gradle-${GRADLE_VERSION}-bin.zip - echo "GRADLE_HOME=/opt/gradle/gradle-${GRADLE_VERSION}" >> $GITHUB_ENV - echo "PATH=\$GRADLE_HOME/bin:\$PATH" >> $GITHUB_ENV + run: + java -version # Verify Gradle and Java installation - name: Verify Gradle & Java version run: - java -v \ No newline at end of file + echo "test" \ No newline at end of file From 272364d4eace556d90b417bb50481f541f060dae Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 19:19:05 +0200 Subject: [PATCH 015/165] Created new Docker Image --- .github/workflows/ci.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0314419580..d63d0d3e11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,16 +37,11 @@ jobs: build: runs-on: ubuntu-latest container: - image: amazoncorretto:17 + image: morpheus99/corretto-gradle options: --user root steps: # Install Gradle 8.10 - - name: Install Gradle 8.10 + - name: Checking Gradle & Java run: - java -version - - # Verify Gradle and Java installation - - name: Verify Gradle & Java version - run: - echo "test" \ No newline at end of file + java -version && gradle --version \ No newline at end of file From c6f72b1f18fe4bf65b17a82f8752660d668e8956 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 19:42:34 +0200 Subject: [PATCH 016/165] Added Build and Test stage --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d63d0d3e11..6d9ceb9678 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,31 @@ jobs: options: --user root steps: - # Install Gradle 8.10 - name: Checking Gradle & Java run: - java -version && gradle --version \ No newline at end of file + java -version && gradle --version + + - name: Building Project + run: + gradle clean assemble -p simona + + test: + runs-on: ubuntu-latest + container: + image: morpheus99/corretto-gradle + options: --user root + + steps: + - name: Checking Gradle & Java + run: + java -version && gradle --version + + - name: Running tests + run: + gradle --refresh-dependencies spotlessCheck pmdMain pmdTest -p simona + + - name: Generate JavaDoc + run: | + set +x + cd simona + ./gradlew javadoc \ No newline at end of file From 5d624e7fbe302eb784213269bfb00772279509c4 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 19:43:43 +0200 Subject: [PATCH 017/165] Fix --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d9ceb9678..e2b31b73d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - name: Building Project run: - gradle clean assemble -p simona + gradle clean assemble test: runs-on: ubuntu-latest @@ -62,7 +62,7 @@ jobs: - name: Running tests run: - gradle --refresh-dependencies spotlessCheck pmdMain pmdTest -p simona + gradle --refresh-dependencies spotlessCheck pmdMain pmdTest - name: Generate JavaDoc run: | From cc50142e6d228b170ae89378721e74c0b33d20ad Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 19:47:03 +0200 Subject: [PATCH 018/165] Added right order --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2b31b73d1..9d614abbc6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: git rev-parse --abbrev-ref HEAD build: + needs: checkout runs-on: ubuntu-latest container: image: morpheus99/corretto-gradle @@ -50,6 +51,7 @@ jobs: gradle clean assemble test: + needs: build runs-on: ubuntu-latest container: image: morpheus99/corretto-gradle From 9979cc8b1fc14080a6c9f57fba28f44521995b6e Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 19:58:52 +0200 Subject: [PATCH 019/165] Fix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d614abbc6..f6d621a766 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,7 @@ jobs: java -version && gradle --version - name: Building Project + working-directory: simona run: gradle clean assemble From 82c04b5a59f7f2bf620ad378a9296abcbec136e5 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:00:42 +0200 Subject: [PATCH 020/165] Fix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6d621a766..471f72c055 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: - name: Show current branch run: | git rev-parse --abbrev-ref HEAD + pwd build: needs: checkout From 2f5d1edaf9fcdb35be1d0bb02d0b6417c5155dec Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:02:59 +0200 Subject: [PATCH 021/165] Fix --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 471f72c055..e3bd48ed28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,9 +48,10 @@ jobs: java -version && gradle --version - name: Building Project - working-directory: simona + working-directory: /__w/simona/simona run: - gradle clean assemble + pwd + sudo gradle clean assemble test: needs: build From 423824be7af3d24d43ff4c87a88ce9c1b0fe9f74 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:04:27 +0200 Subject: [PATCH 022/165] Fix --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3bd48ed28..3d1bbaffb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,9 +48,10 @@ jobs: java -version && gradle --version - name: Building Project - working-directory: /__w/simona/simona + working-directory: /__w/simona run: pwd + ls sudo gradle clean assemble test: From de427e92fa6aad27f9b384998ff2fd33d251be61 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:05:20 +0200 Subject: [PATCH 023/165] Fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d1bbaffb7..8036b28373 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: - name: Building Project working-directory: /__w/simona - run: + run: | pwd ls sudo gradle clean assemble From 480116702ab6e2f70c7efa8b854d0b12e105a72c Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:06:49 +0200 Subject: [PATCH 024/165] Fix --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8036b28373..38345bd8bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,11 +48,11 @@ jobs: java -version && gradle --version - name: Building Project - working-directory: /__w/simona + working-directory: /__w/simona/simona run: | pwd ls - sudo gradle clean assemble + gradle clean assemble test: needs: build From cc21a2e3c3dda37394ebf593a718a0bf46d06c0b Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:12:08 +0200 Subject: [PATCH 025/165] Fix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38345bd8bd..4ee872d076 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,7 @@ jobs: run: | git rev-parse --abbrev-ref HEAD pwd + ls -la build: needs: checkout From 6ebc5e2a5568bfa18cd8e5f00adc040133459358 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:15:09 +0200 Subject: [PATCH 026/165] Added Volume --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ee872d076..262c6e81e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,8 +33,6 @@ jobs: - name: Show current branch run: | git rev-parse --abbrev-ref HEAD - pwd - ls -la build: needs: checkout @@ -42,6 +40,8 @@ jobs: container: image: morpheus99/corretto-gradle options: --user root + volumes: + - /home/runner/work/${{ github.repository }}:/simona steps: - name: Checking Gradle & Java @@ -49,10 +49,10 @@ jobs: java -version && gradle --version - name: Building Project - working-directory: /__w/simona/simona + working-directory: /simona run: | pwd - ls + ls -la gradle clean assemble test: From 3434da4653c4d5a81d68802276c9ba712ee32249 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:18:23 +0200 Subject: [PATCH 027/165] Set clean to false --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 262c6e81e4..a6f46a777c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ jobs: uses: actions/checkout@v4 with: # Check if it's a pull request + clean: false ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} From 485d6c12dd7f7f0ffb82985223159c46cb1ddd6c Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:26:07 +0200 Subject: [PATCH 028/165] Set clean to true --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6f46a777c..14d51c6220 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,14 +26,14 @@ jobs: uses: actions/checkout@v4 with: # Check if it's a pull request - clean: false ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Show current branch run: | git rev-parse --abbrev-ref HEAD + pwd + ls -la build: needs: checkout From f136f27e3a4fea48824f494d00036bc530a6aa80 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:27:25 +0200 Subject: [PATCH 029/165] Fixed Volume Path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14d51c6220..22eac8688c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - /home/runner/work/${{ github.repository }}:/simona + - /home/runner/work/${{ github.repository }}/${{ github.repository }}:/simona steps: - name: Checking Gradle & Java From f0247713e441c7cd0b16f7864fd08d531984de1e Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:35:56 +0200 Subject: [PATCH 030/165] Fixed Volume Path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22eac8688c..4c6ed37e81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - /home/runner/work/${{ github.repository }}/${{ github.repository }}:/simona + - /home/runner/work/simona/simona:/simona steps: - name: Checking Gradle & Java From ae3f4142384fb1f6d8d6e426ee17b5a6c2115450 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:39:11 +0200 Subject: [PATCH 031/165] Fixed Volume Path --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c6ed37e81..38bda5393d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,11 @@ jobs: run: java -version && gradle --version + - name: Verify Files in Container + run: | + pwd + ls -la /simona + - name: Building Project working-directory: /simona run: | From cc00df1465017ed6fb4241159f7dff7835d03840 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:42:59 +0200 Subject: [PATCH 032/165] Fixed Volume Path --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38bda5393d..b5644dab3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: run: | git rev-parse --abbrev-ref HEAD pwd - ls -la + ls -la /home/runner/work/simona/simona build: needs: checkout @@ -42,7 +42,7 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - /home/runner/work/simona/simona:/simona + - ${{ github.workspace }}:/simona steps: - name: Checking Gradle & Java From c892a8c4baacd12973d12ae64d77553b31c1da01 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:46:10 +0200 Subject: [PATCH 033/165] Fixed Volume Path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5644dab3f..3b52a7c2be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: run: | git rev-parse --abbrev-ref HEAD pwd - ls -la /home/runner/work/simona/simona + ls -la ${{ github.workspace }} build: needs: checkout From 442d31b874feb7293a16a6f84d550e9cb43980c7 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 20:49:04 +0200 Subject: [PATCH 034/165] Fixed Volume Path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b52a7c2be..abd9f5005f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - ${{ github.workspace }}:/simona + - ${{ github.workspace }}:/simona:rw steps: - name: Checking Gradle & Java From 88b444784aa89201f7d723254a0ed93ceb5c2a14 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 21:49:46 +0200 Subject: [PATCH 035/165] Bind Volume --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abd9f5005f..a2cf74b22f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,9 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - ${{ github.workspace }}:/simona:rw + - type: bind + source: ${{ github.workspace }} + target: /simona steps: - name: Checking Gradle & Java From 26273ddbd74cc54e55a9b86688eb1d2ba1a54ab3 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 22:39:04 +0200 Subject: [PATCH 036/165] Fixed Docker Image --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2cf74b22f..3bc26d2759 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,9 +42,7 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - type: bind - source: ${{ github.workspace }} - target: /simona + - ${{ github.workspace }}:/simona steps: - name: Checking Gradle & Java @@ -69,6 +67,8 @@ jobs: container: image: morpheus99/corretto-gradle options: --user root + volumes: + - ${{ github.workspace }}:/simona steps: - name: Checking Gradle & Java From b9016d1e5f95ee97255765a1b807c2ab687b9e5f Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 22:43:22 +0200 Subject: [PATCH 037/165] Fix --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bc26d2759..098d5b9309 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,13 +42,17 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - ${{ github.workspace }}:/simona + - ${{ github.workspace }}:/simona:rw steps: - name: Checking Gradle & Java run: java -version && gradle --version + - name: Inspect Docker Mounts + run: + docker inspect $(docker ps -q) --format='{{json .Mounts}}' + - name: Verify Files in Container run: | pwd @@ -68,7 +72,7 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - ${{ github.workspace }}:/simona + - ${{ github.workspace }}:/simona:rw steps: - name: Checking Gradle & Java From 07e14423b8ac10ed849995e1d8d4bd2d2b0442f1 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 22:58:05 +0200 Subject: [PATCH 038/165] Fix --- .github/workflows/ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 098d5b9309..626efb46f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,17 +42,13 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - ${{ github.workspace }}:/simona:rw + - ${{ github.workspace }}:/app:rw steps: - name: Checking Gradle & Java run: java -version && gradle --version - - name: Inspect Docker Mounts - run: - docker inspect $(docker ps -q) --format='{{json .Mounts}}' - - name: Verify Files in Container run: | pwd @@ -72,7 +68,7 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - ${{ github.workspace }}:/simona:rw + - ${{ github.workspace }}:/app:rw steps: - name: Checking Gradle & Java From 16db60dcf64f099ddc68e1c284b75d01eee38b58 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 22:59:45 +0200 Subject: [PATCH 039/165] Fix --- .github/workflows/ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 626efb46f8..95bab46ccc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,13 +49,8 @@ jobs: run: java -version && gradle --version - - name: Verify Files in Container - run: | - pwd - ls -la /simona - - name: Building Project - working-directory: /simona + working-directory: /app run: | pwd ls -la From b21805d449f6b8dc913c3f908784f78b6ee7035c Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:02:09 +0200 Subject: [PATCH 040/165] Fix --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95bab46ccc..d7c174d3ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - ${{ github.workspace }}:/app:rw + - ${{ github.workspace }}:/simona:rw steps: - name: Checking Gradle & Java @@ -50,9 +50,9 @@ jobs: java -version && gradle --version - name: Building Project - working-directory: /app run: | pwd + cd /simona ls -la gradle clean assemble @@ -63,7 +63,7 @@ jobs: image: morpheus99/corretto-gradle options: --user root volumes: - - ${{ github.workspace }}:/app:rw + - ${{ github.workspace }}:/simona:rw steps: - name: Checking Gradle & Java From ddd5a92e5f0897a49513e4199d9926ac9687f995 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:07:07 +0200 Subject: [PATCH 041/165] Fix --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7c174d3ff..643e128e2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: needs: checkout runs-on: ubuntu-latest container: - image: morpheus99/corretto-gradle + image: gradle:8.10-jdk17 options: --user root volumes: - ${{ github.workspace }}:/simona:rw @@ -60,7 +60,7 @@ jobs: needs: build runs-on: ubuntu-latest container: - image: morpheus99/corretto-gradle + image: gradle:8.10-jdk17 options: --user root volumes: - ${{ github.workspace }}:/simona:rw From d9260e9e6af011debf752992e8ddc6dfc056f22e Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:08:36 +0200 Subject: [PATCH 042/165] Fix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 643e128e2b..07fb29da32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,7 @@ jobs: run: | pwd cd /simona + pwd ls -la gradle clean assemble From bdd790617a756c7ca3d8168b1cfaf943e9156119 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:10:03 +0200 Subject: [PATCH 043/165] Fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07fb29da32..573c73ef06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: - name: Building Project run: | pwd - cd /simona + cd .. pwd ls -la gradle clean assemble From d537e09fe76f95e89bc3b56cefbc7b934848841a Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:11:18 +0200 Subject: [PATCH 044/165] Fix Volume --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 573c73ef06..ee97d09ea0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,7 @@ jobs: - name: Building Project run: | pwd + ls -la cd .. pwd ls -la From 160bd9963fd9d17d006596ff3873ff9636023048 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:13:54 +0200 Subject: [PATCH 045/165] Fix Volume --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee97d09ea0..3433674d1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: image: gradle:8.10-jdk17 options: --user root volumes: - - ${{ github.workspace }}:/simona:rw + - ${{ github.workspace }}:/__w/simona/simona:rw steps: - name: Checking Gradle & Java From caafefe71464806dbcf6789f76e79d1f3ea7a200 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:14:48 +0200 Subject: [PATCH 046/165] Fix Volume --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3433674d1e..6a17ce18df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: image: gradle:8.10-jdk17 options: --user root volumes: - - ${{ github.workspace }}:/simona:rw + - ${{ github.workspace }}:/__w/simona/simona:rw steps: - name: Checking Gradle & Java @@ -51,9 +51,6 @@ jobs: - name: Building Project run: | - pwd - ls -la - cd .. pwd ls -la gradle clean assemble From f85defe4259e78030553292fd0bd5aa3c87c4f9a Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:20:52 +0200 Subject: [PATCH 047/165] Fix Volume --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a17ce18df..adeb80f783 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,9 +40,8 @@ jobs: runs-on: ubuntu-latest container: image: gradle:8.10-jdk17 - options: --user root volumes: - - ${{ github.workspace }}:/__w/simona/simona:rw + - ${{ github.workspace }}:/simona:rw steps: - name: Checking Gradle & Java @@ -50,6 +49,7 @@ jobs: java -version && gradle --version - name: Building Project + working-directory: /simona run: | pwd ls -la From b7440c8ff715a72a537ad9a325ea69fd4504779b Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:24:07 +0200 Subject: [PATCH 048/165] Combined Checkout and Build --- .github/workflows/ci.yml | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index adeb80f783..b0c1395007 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,14 @@ on: - dev jobs: - checkout: + + build: runs-on: ubuntu-latest + container: + image: gradle:8.10-jdk17 + volumes: + - ${{ github.workspace }}:/simona:rw + steps: - name: Checkout Code uses: actions/checkout@v4 @@ -29,25 +35,16 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + - name: Checking Gradle & Java + run: + java -version && gradle --version + - name: Show current branch run: | git rev-parse --abbrev-ref HEAD pwd ls -la ${{ github.workspace }} - build: - needs: checkout - runs-on: ubuntu-latest - container: - image: gradle:8.10-jdk17 - volumes: - - ${{ github.workspace }}:/simona:rw - - steps: - - name: Checking Gradle & Java - run: - java -version && gradle --version - - name: Building Project working-directory: /simona run: | From c9f7e429283c12d17c393555e4c195553abfe0ce Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:25:46 +0200 Subject: [PATCH 049/165] Fix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0c1395007..33402b3280 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,7 @@ jobs: - name: Show current branch run: | + git config --global --add safe.directory /__w/simona/simona git rev-parse --abbrev-ref HEAD pwd ls -la ${{ github.workspace }} From 68a7fc1c67699c120407043262290dee271b937f Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:40:45 +0200 Subject: [PATCH 050/165] Fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33402b3280..e2e29ee933 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: git config --global --add safe.directory /__w/simona/simona git rev-parse --abbrev-ref HEAD pwd - ls -la ${{ github.workspace }} + ls -la /__w/simona/simona - name: Building Project working-directory: /simona From 9c53be5e75a04880dd1ae2b2ebab59cca8857a39 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:42:03 +0200 Subject: [PATCH 051/165] Fix Vol --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2e29ee933..4b326fe49b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,6 @@ jobs: ls -la /__w/simona/simona - name: Building Project - working-directory: /simona run: | pwd ls -la From 0e57156ae57385e108d8bc033a6aa1ba5211505a Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Wed, 2 Oct 2024 23:56:21 +0200 Subject: [PATCH 052/165] Added Artifact --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b326fe49b..bd10045d3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,12 @@ jobs: ls -la gradle clean assemble + - name: Upload Build Artifact + uses: actions/upload-artifact@v3 + with: + name: simona-3.1.0-all.jar + path: ./build/libs + test: needs: build runs-on: ubuntu-latest @@ -66,6 +72,11 @@ jobs: run: java -version && gradle --version + - name: Download Build Artifact + uses: actions/download-artifact@v3 + with: + name: simona-3.1.0-all.jar + - name: Running tests run: gradle --refresh-dependencies spotlessCheck pmdMain pmdTest From b0b8a7dc8c028229a46a9fcb2980c38b654e8e18 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 00:15:19 +0200 Subject: [PATCH 053/165] Added Artifact --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd10045d3f..08e24b5f5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,8 @@ jobs: git rev-parse --abbrev-ref HEAD pwd ls -la /__w/simona/simona + echo "__w" + ls -la /__w - name: Building Project run: | From 7f6a28104a389f8aa0fd4d9f2f0a92b8e344a89c Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 00:20:00 +0200 Subject: [PATCH 054/165] Added Artifact --- .github/workflows/ci.yml | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08e24b5f5c..bf92557e6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,22 @@ on: - dev jobs: + checkout: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + # Check if it's a pull request + ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + + - name: Show current branch + run: | + git rev-parse --abbrev-ref HEAD + pwd + ls -la build: runs-on: ubuntu-latest @@ -28,26 +44,17 @@ jobs: - ${{ github.workspace }}:/simona:rw steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - # Check if it's a pull request - ref: ${{ github.event.pull_request.head.ref || github.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - - name: Checking Gradle & Java - run: - java -version && gradle --version - - - name: Show current branch + - name: Dir Check run: | - git config --global --add safe.directory /__w/simona/simona - git rev-parse --abbrev-ref HEAD pwd ls -la /__w/simona/simona echo "__w" ls -la /__w + - name: Checking Gradle & Java + run: + java -version && gradle --version + - name: Building Project run: | pwd From c14c0a6b4b7b05ebb6606d6eb7f0acdd68116a4d Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 00:23:23 +0200 Subject: [PATCH 055/165] Fix syntax --- .github/workflows/ci.yml | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf92557e6c..ce00584631 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,19 +22,19 @@ jobs: checkout: runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - # Check if it's a pull request - ref: ${{ github.event.pull_request.head.ref || github.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + # Check if it's a pull request + ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - name: Show current branch - run: | - git rev-parse --abbrev-ref HEAD - pwd - ls -la + - name: Show current branch + run: | + git rev-parse --abbrev-ref HEAD + pwd + ls -la build: runs-on: ubuntu-latest @@ -52,7 +52,7 @@ jobs: ls -la /__w - name: Checking Gradle & Java - run: + run: | java -version && gradle --version - name: Building Project @@ -61,12 +61,6 @@ jobs: ls -la gradle clean assemble - - name: Upload Build Artifact - uses: actions/upload-artifact@v3 - with: - name: simona-3.1.0-all.jar - path: ./build/libs - test: needs: build runs-on: ubuntu-latest @@ -78,7 +72,7 @@ jobs: steps: - name: Checking Gradle & Java - run: + run: | java -version && gradle --version - name: Download Build Artifact @@ -87,11 +81,11 @@ jobs: name: simona-3.1.0-all.jar - name: Running tests - run: + run: | gradle --refresh-dependencies spotlessCheck pmdMain pmdTest - name: Generate JavaDoc run: | set +x cd simona - ./gradlew javadoc \ No newline at end of file + ./gradlew javadoc From 4b3e51c446bbdf440ddd26cd5c6594c210818e08 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 00:25:30 +0200 Subject: [PATCH 056/165] Debug --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce00584631..b291fb1964 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: ls -la build: + needs: checkout runs-on: ubuntu-latest container: image: gradle:8.10-jdk17 @@ -50,6 +51,8 @@ jobs: ls -la /__w/simona/simona echo "__w" ls -la /__w + echo "__w/_temp" + ls -la /__w/_temp - name: Checking Gradle & Java run: | From 99a876e8cd0f3980e874f8e0a10ef6be18a0b18c Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 00:32:48 +0200 Subject: [PATCH 057/165] Debug --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b291fb1964..9e2e89ba8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,30 @@ jobs: pwd ls -la + test-mount: + runs-on: ubuntu-latest + + steps: + # 1. Code Checkout auf dem Host (ohne Container) + - name: Checkout Code + uses: actions/checkout@v4 + + # 2. Überprüfung des Verzeichnisses auf dem Host nach dem Checkout + - name: Verify Files on Host after Checkout + run: | + echo "Verzeichnis auf dem Host:" + ls -la ${{ github.workspace }} + + # 3. Container-Schritt zum Testen des Mounts + - name: Verify Mount in Container + container: + image: ubuntu:latest # Verwende ein einfaches Image zum Testen + volumes: + - ${{ github.workspace }}:/simona:rw + run: | + echo "Verzeichnis im Container:" + ls -la /simona + build: needs: checkout runs-on: ubuntu-latest From 50979d2658c816da566524e7601e6bddfa87317a Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 00:33:59 +0200 Subject: [PATCH 058/165] Debug --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e2e89ba8c..4d0d4df263 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: ls -la test-mount: + needs: checkout runs-on: ubuntu-latest steps: @@ -61,7 +62,7 @@ jobs: ls -la /simona build: - needs: checkout + needs: test-mount runs-on: ubuntu-latest container: image: gradle:8.10-jdk17 From 7aa55ba7fbda6e0614d04c218af973a7fb275900 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 00:35:26 +0200 Subject: [PATCH 059/165] STOP --- .github/workflows/ci.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d0d4df263..dc3abbd2de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,31 +36,6 @@ jobs: pwd ls -la - test-mount: - needs: checkout - runs-on: ubuntu-latest - - steps: - # 1. Code Checkout auf dem Host (ohne Container) - - name: Checkout Code - uses: actions/checkout@v4 - - # 2. Überprüfung des Verzeichnisses auf dem Host nach dem Checkout - - name: Verify Files on Host after Checkout - run: | - echo "Verzeichnis auf dem Host:" - ls -la ${{ github.workspace }} - - # 3. Container-Schritt zum Testen des Mounts - - name: Verify Mount in Container - container: - image: ubuntu:latest # Verwende ein einfaches Image zum Testen - volumes: - - ${{ github.workspace }}:/simona:rw - run: | - echo "Verzeichnis im Container:" - ls -la /simona - build: needs: test-mount runs-on: ubuntu-latest From 25346e65dec31618c247ded3cab541ea3c2080be Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 00:47:57 +0200 Subject: [PATCH 060/165] test --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc3abbd2de..5077ab37de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: ls -la build: - needs: test-mount + needs: checkout runs-on: ubuntu-latest container: image: gradle:8.10-jdk17 @@ -47,6 +47,8 @@ jobs: steps: - name: Dir Check run: | + echo "${{ github.workspace }}" + echo "$GITHUB_WORKSPACE" pwd ls -la /__w/simona/simona echo "__w" @@ -71,7 +73,7 @@ jobs: image: gradle:8.10-jdk17 options: --user root volumes: - - ${{ github.workspace }}:/__w/simona/simona:rw + - ${{ github.workspace }}:/simona:rw steps: - name: Checking Gradle & Java From 8c4b71b1aadaf0141b2632d791fdfda92bea4e39 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 00:53:20 +0200 Subject: [PATCH 061/165] Volume --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5077ab37de..a37cbc5dca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,13 +42,11 @@ jobs: container: image: gradle:8.10-jdk17 volumes: - - ${{ github.workspace }}:/simona:rw + - /home/runner/work/simona/simona:/simona:rw steps: - name: Dir Check run: | - echo "${{ github.workspace }}" - echo "$GITHUB_WORKSPACE" pwd ls -la /__w/simona/simona echo "__w" @@ -61,6 +59,7 @@ jobs: java -version && gradle --version - name: Building Project + working-directory: /simona run: | pwd ls -la From 517d9e5c49313851632020c26c81eca92cad7af0 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Thu, 3 Oct 2024 15:00:41 +0200 Subject: [PATCH 062/165] Using Cache --- .github/workflows/ci.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a37cbc5dca..6632558211 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,36 +30,38 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - name: Show current branch + - name: Check Branch & Files run: | git rev-parse --abbrev-ref HEAD pwd ls -la + - name: Cache project files + uses: actions/cache@v3 + with: + path: | + . + key: ${{ runner.os }}-project-${{ github.sha }} + build: needs: checkout runs-on: ubuntu-latest container: image: gradle:8.10-jdk17 - volumes: - - /home/runner/work/simona/simona:/simona:rw steps: - - name: Dir Check - run: | - pwd - ls -la /__w/simona/simona - echo "__w" - ls -la /__w - echo "__w/_temp" - ls -la /__w/_temp + - name: Restore project files + uses: actions/cache@v3 + with: + path: | + . + key: ${{ runner.os }}-project-${{ github.sha }} - name: Checking Gradle & Java run: | java -version && gradle --version - name: Building Project - working-directory: /simona run: | pwd ls -la From f58d317c5ad176d9bc90f577abd87a7e441ebce8 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:11:07 +0200 Subject: [PATCH 063/165] Cache Fix --- .github/workflows/ci.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6632558211..f597ba3c68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,10 +37,10 @@ jobs: ls -la - name: Cache project files - uses: actions/cache@v3 + uses: actions/cache/save@v4 + id: cache with: - path: | - . + path: . key: ${{ runner.os }}-project-${{ github.sha }} build: @@ -51,11 +51,10 @@ jobs: steps: - name: Restore project files - uses: actions/cache@v3 + uses: actions/cache/restore@v4 + id: restore-cache with: - path: | - . - key: ${{ runner.os }}-project-${{ github.sha }} + key: ${{ runner.os }}-project-${{ github.sha }} - name: Checking Gradle & Java run: | From f11304039fa37561b69e88bb432a9ad3487cd168 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:14:00 +0200 Subject: [PATCH 064/165] Cache Fix --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f597ba3c68..2bc6c140e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: uses: actions/cache/save@v4 id: cache with: - path: . + path: ./ key: ${{ runner.os }}-project-${{ github.sha }} build: @@ -54,6 +54,7 @@ jobs: uses: actions/cache/restore@v4 id: restore-cache with: + path: ./ key: ${{ runner.os }}-project-${{ github.sha }} - name: Checking Gradle & Java From 62656dbab490a14b849c292a9c752febcf53e5cf Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:26:51 +0200 Subject: [PATCH 065/165] Cache Fix --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bc6c140e2..9ea6c47ae1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,10 @@ name: CI +#Variables +env: + CHECKOUT_SHA: "" + on: push: branches: @@ -41,7 +45,10 @@ jobs: id: cache with: path: ./ - key: ${{ runner.os }}-project-${{ github.sha }} + key: simona-${{ github.sha }} + run: | + echo "COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV + echo "${{ github.sha }}" build: needs: checkout From 8999526ee0d51c12dd364d22270a6e26600ec480 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:30:48 +0200 Subject: [PATCH 066/165] Cache Fix --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ea6c47ae1..703eaab3fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,8 @@ jobs: with: path: ./ key: simona-${{ github.sha }} + + - name: Print run: | echo "COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV echo "${{ github.sha }}" From 21835f8f97cb91ed7c1c47ad3a3046c9461a3145 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:32:43 +0200 Subject: [PATCH 067/165] Cache Fix --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 703eaab3fe..bfc4c3f48b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: path: ./ key: simona-${{ github.sha }} - - name: Print + - name: Save Commit SHA run: | echo "COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV echo "${{ github.sha }}" @@ -59,12 +59,15 @@ jobs: image: gradle:8.10-jdk17 steps: + - name: Print SHA + run: echo "${{ github.sha }}" + - name: Restore project files uses: actions/cache/restore@v4 id: restore-cache with: path: ./ - key: ${{ runner.os }}-project-${{ github.sha }} + key: simona-${{ github.sha }} - name: Checking Gradle & Java run: | From 47dc2b26d30b55a8f8109760f55a36f25e1f0950 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:41:16 +0200 Subject: [PATCH 068/165] Cache Fix --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfc4c3f48b..bc2680d072 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,10 +41,11 @@ jobs: ls -la - name: Cache project files - uses: actions/cache/save@v4 + uses: actions/cache@v3 id: cache with: - path: ./ + path: | + . #Cache all files key: simona-${{ github.sha }} - name: Save Commit SHA From f623598e4880d47839624c1c3e9fc2540dbad432 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:42:25 +0200 Subject: [PATCH 069/165] Cache Fix --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc2680d072..22f25debdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,11 +41,11 @@ jobs: ls -la - name: Cache project files - uses: actions/cache@v3 + uses: actions/cache/save@v4 id: cache with: path: | - . #Cache all files + . key: simona-${{ github.sha }} - name: Save Commit SHA From a6ee5865276a5bb783215150069b01756781a49a Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:46:48 +0200 Subject: [PATCH 070/165] Cache Fix --- .github/workflows/ci.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22f25debdd..92a9378bff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,11 +41,9 @@ jobs: ls -la - name: Cache project files - uses: actions/cache/save@v4 - id: cache + uses: actions/cache@v3 with: - path: | - . + path: ./ key: simona-${{ github.sha }} - name: Save Commit SHA @@ -64,8 +62,7 @@ jobs: run: echo "${{ github.sha }}" - name: Restore project files - uses: actions/cache/restore@v4 - id: restore-cache + uses: actions/cache@v3 with: path: ./ key: simona-${{ github.sha }} From fed2642a7630a727ef6e6e356c24ce2c35b30579 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:53:30 +0200 Subject: [PATCH 071/165] Cache Fix --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92a9378bff..5b7ec1e4bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: uses: actions/cache@v3 with: path: ./ - key: simona-${{ github.sha }} + key: simona - name: Save Commit SHA run: | @@ -65,7 +65,7 @@ jobs: uses: actions/cache@v3 with: path: ./ - key: simona-${{ github.sha }} + key: simona - name: Checking Gradle & Java run: | From c0b408bf47444d2e3c19e61fb3bc57ac21069c23 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 15:57:14 +0200 Subject: [PATCH 072/165] Cache Fix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b7ec1e4bc..6c07dbcb8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: path: ./ key: simona + # - name: Save Commit SHA run: | echo "COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV From 51a29b8e178577bedc98303b2977c95a2192813e Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 16:03:33 +0200 Subject: [PATCH 073/165] Using artifacts --- .github/workflows/ci.yml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c07dbcb8d..7ffe52b1a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,17 +40,11 @@ jobs: pwd ls -la - - name: Cache project files - uses: actions/cache@v3 + - name: Upload build directory as artifact + uses: actions/upload-artifact@v3 with: + name: project-files path: ./ - key: simona - - # - - name: Save Commit SHA - run: | - echo "COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV - echo "${{ github.sha }}" build: needs: checkout @@ -59,14 +53,11 @@ jobs: image: gradle:8.10-jdk17 steps: - - name: Print SHA - run: echo "${{ github.sha }}" - - - name: Restore project files - uses: actions/cache@v3 + - name: Download project-files + uses: actions/download-artifact@v3 with: + name: project-files path: ./ - key: simona - name: Checking Gradle & Java run: | From a7d508d0ac06ef9fac847c5b17711327f8934282 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 16:32:26 +0200 Subject: [PATCH 074/165] Changed approach in passing files --- .github/workflows/ci.yml | 42 +++++++++++++++------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ffe52b1a5..db6a23e683 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,8 +23,11 @@ on: - dev jobs: - checkout: + + build: runs-on: ubuntu-latest + container: + image: gradle:8.10-jdk17 steps: - name: Checkout Code @@ -40,43 +43,30 @@ jobs: pwd ls -la - - name: Upload build directory as artifact - uses: actions/upload-artifact@v3 - with: - name: project-files - path: ./ - - build: - needs: checkout - runs-on: ubuntu-latest - container: - image: gradle:8.10-jdk17 - - steps: - - name: Download project-files - uses: actions/download-artifact@v3 - with: - name: project-files - path: ./ - - name: Checking Gradle & Java run: | java -version && gradle --version - name: Building Project run: | - pwd - ls -la gradle clean assemble + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: simona-build + path: | + build/ # Der gesamte 'build'-Ordner + build.gradle # Haupt-Gradle-Datei + settings.gradle # Projekt- und Modulkonfiguration + gradle/wrapper/ # Gradle-Wrapper-Dateien + .gradle/ # Cache-Dateien von Gradle (optional) + test: needs: build runs-on: ubuntu-latest container: image: gradle:8.10-jdk17 - options: --user root - volumes: - - ${{ github.workspace }}:/simona:rw steps: - name: Checking Gradle & Java @@ -86,7 +76,7 @@ jobs: - name: Download Build Artifact uses: actions/download-artifact@v3 with: - name: simona-3.1.0-all.jar + name: simona-build - name: Running tests run: | From 9a84f3e97a4485fa5166625c1e3f849f16cf02b9 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 16:33:27 +0200 Subject: [PATCH 075/165] Changed approach in passing files --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db6a23e683..1987ab199b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: - name: Check Branch & Files run: | + git config --global --add safe.directory /__w/simona/simona git rev-parse --abbrev-ref HEAD pwd ls -la From 26d977fdc1b30e81a356f8eceb76cdaa31942aa6 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 4 Oct 2024 16:38:01 +0200 Subject: [PATCH 076/165] Debug --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1987ab199b..73c4179396 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,7 @@ jobs: - name: Building Project run: | gradle clean assemble + ls -la - name: Upload Artifact uses: actions/upload-artifact@v3 From 5aa9679e9c9e27184726d9cacc3d7105718fa1c5 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Mon, 7 Oct 2024 19:56:29 +0200 Subject: [PATCH 077/165] Fixed Path --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73c4179396..7a43aaa9e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,10 +5,6 @@ name: CI -#Variables -env: - CHECKOUT_SHA: "" - on: push: branches: @@ -58,7 +54,7 @@ jobs: with: name: simona-build path: | - build/ # Der gesamte 'build'-Ordner + ./build/** # Der gesamte 'build'-Ordner build.gradle # Haupt-Gradle-Datei settings.gradle # Projekt- und Modulkonfiguration gradle/wrapper/ # Gradle-Wrapper-Dateien From da5336ba5a968d4592929c4a5c7857ef76cc0d4d Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Mon, 7 Oct 2024 20:01:01 +0200 Subject: [PATCH 078/165] Fixed Path --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a43aaa9e6..a4a02d784b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,11 +54,11 @@ jobs: with: name: simona-build path: | - ./build/** # Der gesamte 'build'-Ordner - build.gradle # Haupt-Gradle-Datei - settings.gradle # Projekt- und Modulkonfiguration - gradle/wrapper/ # Gradle-Wrapper-Dateien - .gradle/ # Cache-Dateien von Gradle (optional) + ./build/** + build.gradle + settings.gradle + gradle/wrapper/ + .gradle/ test: needs: build From 8da5343184e5ac39ac6b2d5a387710ce2148a702 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Mon, 7 Oct 2024 20:15:21 +0200 Subject: [PATCH 079/165] Fixed Path --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4a02d784b..e6acaf4597 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,11 +54,13 @@ jobs: with: name: simona-build path: | - ./build/** + ./build/classes/** + ./build/resources/** + ./build/libs/** + gradle/wrapper/** + gradlew build.gradle settings.gradle - gradle/wrapper/ - .gradle/ test: needs: build From 4b65e113d72f93812d52b7897e580d6c26bd737a Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Mon, 7 Oct 2024 20:16:00 +0200 Subject: [PATCH 080/165] Fixed Path --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6acaf4597..7362ddd4d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,7 @@ jobs: ./build/resources/** ./build/libs/** gradle/wrapper/** + gradle/scripts/** gradlew build.gradle settings.gradle From 5ec36de4b305db54621f862b207f7d086690fdfd Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Mon, 7 Oct 2024 20:22:44 +0200 Subject: [PATCH 081/165] Fixed Path --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7362ddd4d6..94d4769474 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,9 +54,7 @@ jobs: with: name: simona-build path: | - ./build/classes/** - ./build/resources/** - ./build/libs/** + ./build/** gradle/wrapper/** gradle/scripts/** gradlew From fc39fbbbad4de6cbde19fae554027d4d6a91b69d Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 15:15:06 +0200 Subject: [PATCH 082/165] Caching Gradle Dependencies --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94d4769474..d72139d58a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,16 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + - name: Cache Gradle dependencies + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle + - name: Check Branch & Files run: | git config --global --add safe.directory /__w/simona/simona @@ -54,7 +64,9 @@ jobs: with: name: simona-build path: | - ./build/** + ./build/classes/** + ./build/resources/test/** + ./build/libs/** gradle/wrapper/** gradle/scripts/** gradlew @@ -68,6 +80,16 @@ jobs: image: gradle:8.10-jdk17 steps: + - name: Cache Gradle dependencies + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle + - name: Checking Gradle & Java run: | java -version && gradle --version @@ -78,8 +100,9 @@ jobs: name: simona-build - name: Running tests + working-directory: ./simona run: | - gradle --refresh-dependencies spotlessCheck pmdMain pmdTest + gradle --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest - name: Generate JavaDoc run: | From e279c01121da8117f243e7caeab5580eec12ce3b Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 15:21:29 +0200 Subject: [PATCH 083/165] Removed workdir --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d72139d58a..da7e5a65ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,6 @@ jobs: name: simona-build - name: Running tests - working-directory: ./simona run: | gradle --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest From 5044de6a64fb8cb909c4254ad7b12122d034e3a5 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 15:40:57 +0200 Subject: [PATCH 084/165] Fixes --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da7e5a65ee..60d29f1e70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - name: Cache Gradle dependencies + - name: Cache Gradle packages uses: actions/cache@v3 with: path: | @@ -41,7 +41,7 @@ jobs: ~/.gradle/wrapper key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | - ${{ runner.os }}-gradle + ${{ runner.os }}-gradle- - name: Check Branch & Files run: | @@ -56,7 +56,7 @@ jobs: - name: Building Project run: | - gradle clean assemble + ./gradlew clean assemble ls -la - name: Upload Artifact From 711beaea3b57f27fed94a6b7826b22f5a752f7ab Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 15:45:05 +0200 Subject: [PATCH 085/165] Fixes --- .github/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60d29f1e70..c778e2f508 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,16 +33,6 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - name: Cache Gradle packages - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - name: Check Branch & Files run: | git config --global --add safe.directory /__w/simona/simona @@ -59,6 +49,16 @@ jobs: ./gradlew clean assemble ls -la + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Upload Artifact uses: actions/upload-artifact@v3 with: @@ -80,7 +80,7 @@ jobs: image: gradle:8.10-jdk17 steps: - - name: Cache Gradle dependencies + - name: Cache Gradle packages uses: actions/cache@v3 with: path: | @@ -88,7 +88,7 @@ jobs: ~/.gradle/wrapper key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | - ${{ runner.os }}-gradle + ${{ runner.os }}-gradle- - name: Checking Gradle & Java run: | From 1d0ba091142a012ad6b06adfcc5e445b2d62031b Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 16:06:43 +0200 Subject: [PATCH 086/165] Removed Artifacting Trying Cache --- .github/workflows/ci.yml | 52 ++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c778e2f508..b305f0fd68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,6 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 with: - # Check if it's a pull request ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} @@ -49,62 +48,47 @@ jobs: ./gradlew clean assemble ls -la - - name: Cache Gradle packages + - name: Cache Gradle Wrapper and Build Files uses: actions/cache@v3 with: path: | - ~/.gradle/caches - ~/.gradle/wrapper + ./build/ + ./gradle/ key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: simona-build - path: | - ./build/classes/** - ./build/resources/test/** - ./build/libs/** - gradle/wrapper/** - gradle/scripts/** - gradlew - build.gradle - settings.gradle - test: needs: build runs-on: ubuntu-latest container: image: gradle:8.10-jdk17 + services: + docker: + image: docker:19.03.12 + options: --privileged steps: - - name: Cache Gradle packages + - name: Checkout Code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + + - name: Cache Gradle Wrapper and Build Files uses: actions/cache@v3 with: path: | - ~/.gradle/caches - ~/.gradle/wrapper + ./build/ + ./gradle/wrapper/ key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- - - name: Checking Gradle & Java - run: | - java -version && gradle --version - - - name: Download Build Artifact - uses: actions/download-artifact@v3 - with: - name: simona-build - - - name: Running tests + - name: Running Tests run: | - gradle --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest + ./gradlew --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test - name: Generate JavaDoc run: | - set +x - cd simona ./gradlew javadoc From f703367a5ab171420595717bd19ab5bc38bf26cf Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 16:31:15 +0200 Subject: [PATCH 087/165] Seperated Build Artifact and Gradle Cache --- .github/workflows/ci.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b305f0fd68..2ccbad0c76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,16 +48,21 @@ jobs: ./gradlew clean assemble ls -la - - name: Cache Gradle Wrapper and Build Files + - name: Cache Gradle uses: actions/cache@v3 with: path: | - ./build/ ./gradle/ key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: ./build/ + test: needs: build runs-on: ubuntu-latest @@ -75,12 +80,11 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - name: Cache Gradle Wrapper and Build Files + - name: Download Gradle Cache uses: actions/cache@v3 with: path: | - ./build/ - ./gradle/wrapper/ + ./gradle/ key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- From d060f807ae9add4a21f4b761f11e5673d5ec2f0b Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 16:45:55 +0200 Subject: [PATCH 088/165] All jobs in one stage test --- .github/workflows/ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ccbad0c76..3d983fc348 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,9 +45,17 @@ jobs: - name: Building Project run: | - ./gradlew clean assemble + ./gradle clean assemble ls -la + - name: Running Tests + run: | + ./gradle --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test + + - name: Generate JavaDoc + run: | + ./gradlew javadoc + - name: Cache Gradle uses: actions/cache@v3 with: From 7eab7867083ef684e5d8c551324034ebedf6085a Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 16:52:16 +0200 Subject: [PATCH 089/165] Fixed permissions --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d983fc348..5e61feaf49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,12 +45,13 @@ jobs: - name: Building Project run: | - ./gradle clean assemble + chmod +x ./gradlew + ./gradlew clean assemble ls -la - name: Running Tests run: | - ./gradle --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test + ./gradlew --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test - name: Generate JavaDoc run: | From cee3934528b210925063dda17070d119fb0e38a3 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 18:39:23 +0200 Subject: [PATCH 090/165] Test --- .github/workflows/ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e61feaf49..e7b72de7d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,12 +43,6 @@ jobs: run: | java -version && gradle --version - - name: Building Project - run: | - chmod +x ./gradlew - ./gradlew clean assemble - ls -la - - name: Running Tests run: | ./gradlew --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test From 54dce131b80e513986aed07f14463ec3d8249d8a Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 18:40:14 +0200 Subject: [PATCH 091/165] Test --- .github/workflows/ci.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7b72de7d4..d5e0563a7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,21 +51,6 @@ jobs: run: | ./gradlew javadoc - - name: Cache Gradle - uses: actions/cache@v3 - with: - path: | - ./gradle/ - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Upload Build Artifacts - uses: actions/upload-artifact@v3 - with: - name: build-artifacts - path: ./build/ - test: needs: build runs-on: ubuntu-latest @@ -83,14 +68,6 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - name: Download Gradle Cache - uses: actions/cache@v3 - with: - path: | - ./gradle/ - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - name: Running Tests run: | From c96acf7345c3c98b45132991dadba459bc58ea07 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 18:51:21 +0200 Subject: [PATCH 092/165] Test --- .github/workflows/ci.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5e0563a7b..e1870f98a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,12 +45,28 @@ jobs: - name: Running Tests run: | - ./gradlew --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test + ./gradlew --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test -x build -x compileJava -x compileTestJava -x assemble + - name: Generate JavaDoc run: | ./gradlew javadoc + - name: Cache Gradle + uses: actions/cache@v3 + with: + path: | + ./gradle/ + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: ./build/ + test: needs: build runs-on: ubuntu-latest @@ -71,7 +87,8 @@ jobs: - name: Running Tests run: | - ./gradlew --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test + ./gradlew --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test -x build -x compileJava -x compileTestJava -x assemble + - name: Generate JavaDoc run: | From 7275f388dffbe1991025553e0104226e9faeedda Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 19:42:34 +0200 Subject: [PATCH 093/165] Changed approach --- .github/workflows/ci.yml | 63 +++++++++------------------------------- 1 file changed, 14 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1870f98a4..d5f1b07453 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,11 +22,9 @@ jobs: build: runs-on: ubuntu-latest - container: - image: gradle:8.10-jdk17 steps: - - name: Checkout Code + - name: Checkout Source uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref || github.ref }} @@ -34,62 +32,29 @@ jobs: - name: Check Branch & Files run: | - git config --global --add safe.directory /__w/simona/simona git rev-parse --abbrev-ref HEAD pwd ls -la - - name: Checking Gradle & Java - run: | - java -version && gradle --version - - - name: Running Tests - run: | - ./gradlew --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test -x build -x compileJava -x compileTestJava -x assemble - - - - name: Generate JavaDoc - run: | - ./gradlew javadoc - - - name: Cache Gradle - uses: actions/cache@v3 - with: - path: | - ./gradle/ - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Upload Build Artifacts - uses: actions/upload-artifact@v3 + - name: Setup Java + uses: actions/setup-java@v4 with: - name: build-artifacts - path: ./build/ - - test: - needs: build - runs-on: ubuntu-latest - container: - image: gradle:8.10-jdk17 - services: - docker: - image: docker:19.03.12 - options: --privileged + distribution: 'temurin' + java-version: 17 - steps: - - name: Checkout Code - uses: actions/checkout@v4 + - name: Setup Gradle 8.10 + uses: gradle/actions/setup-gradle@v4 with: - ref: ${{ github.event.pull_request.head.ref || github.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + gradle-version: "8.10" + - name: Build Project + run: | + ./gradlew clean assemble - - name: Running Tests + - name: Run Tests run: | - ./gradlew --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest test -x build -x compileJava -x compileTestJava -x assemble - + ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest - - name: Generate JavaDoc + - name: Build Java-Docs run: | ./gradlew javadoc From 3eb67df2ba64de701454947addeeb9cbf04d416a Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 8 Oct 2024 20:17:07 +0200 Subject: [PATCH 094/165] Added Sonar --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5f1b07453..a0318519fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,3 +58,8 @@ jobs: - name: Build Java-Docs run: | ./gradlew javadoc + + - name: Run SonarQube with Gradle + run: ./gradlew sonarqube -Dsonar.projectKey=edu.ie3:simona \ + -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \ + -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ No newline at end of file From cc45c56b9c857f87eb54ee17e74fae0d00d5e8ba Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Wed, 9 Oct 2024 13:15:50 +0200 Subject: [PATCH 095/165] Added Sonar --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0318519fa..2959b0c65b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,13 +53,15 @@ jobs: - name: Run Tests run: | - ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest + ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest test - name: Build Java-Docs run: | ./gradlew javadoc + + #ADD reportScoverageTask - name: Run SonarQube with Gradle - run: ./gradlew sonarqube -Dsonar.projectKey=edu.ie3:simona \ + run: ./gradlew reportScoverage sonarqube -Dsonar.projectKey=edu.ie3:simona \ -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \ -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ No newline at end of file From 2ad00b1372c32391be42bd93b13b62ea2ffee623 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Wed, 9 Oct 2024 13:26:05 +0200 Subject: [PATCH 096/165] Added sonar credentials --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2959b0c65b..3fba70782e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,9 +59,7 @@ jobs: run: | ./gradlew javadoc - - #ADD reportScoverageTask - name: Run SonarQube with Gradle - run: ./gradlew reportScoverage sonarqube -Dsonar.projectKey=edu.ie3:simona \ - -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \ + run: ./gradlew reportScoverage sonarqube -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ + -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \ -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ No newline at end of file From aaacfdb67ecc66e6fd25e7754495c135333fd5eb Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Wed, 16 Oct 2024 13:37:21 +0200 Subject: [PATCH 097/165] Moved reportScoverage --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3fba70782e..6875e6fbbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,13 +53,13 @@ jobs: - name: Run Tests run: | - ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest test + ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest test reportScoverage - name: Build Java-Docs run: | ./gradlew javadoc - name: Run SonarQube with Gradle - run: ./gradlew reportScoverage sonarqube -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ + run: ./gradlew sonarqube -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \ -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ No newline at end of file From 57534b87164816b2eeebd141de158e207501492b Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Wed, 16 Oct 2024 13:47:59 +0200 Subject: [PATCH 098/165] Moved reportScoverage --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6875e6fbbf..bf054d403b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: - name: Run Tests run: | - ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest test reportScoverage + ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest test - name: Build Java-Docs run: | @@ -62,4 +62,5 @@ jobs: - name: Run SonarQube with Gradle run: ./gradlew sonarqube -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \ - -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ No newline at end of file + -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ + reportScoverage sonarqube \ No newline at end of file From 9e2f3e85eb43878de9f2c9e02d95b36dd75c6667 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Wed, 16 Oct 2024 13:53:36 +0200 Subject: [PATCH 099/165] Moved reportScoverage --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf054d403b..4dc56c95c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,8 @@ jobs: ./gradlew javadoc - name: Run SonarQube with Gradle - run: ./gradlew sonarqube -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ + run: ./gradlew sonarqube \ + -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \ -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ - reportScoverage sonarqube \ No newline at end of file + -Dsonar.branch.name=${{ github.head_ref || github.ref_name }} \ No newline at end of file From 7d76f1706649acf35717014c1d31ed708455e0fd Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Wed, 16 Oct 2024 14:47:12 +0200 Subject: [PATCH 100/165] Switched to action --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4dc56c95c1..9c75713f5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,9 +59,8 @@ jobs: run: | ./gradlew javadoc - - name: Run SonarQube with Gradle - run: ./gradlew sonarqube \ - -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ - -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \ - -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ - -Dsonar.branch.name=${{ github.head_ref || github.ref_name }} \ No newline at end of file + - name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@ + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} \ No newline at end of file From 91a93662b30b3972ec5ceae457cc843aa70c8916 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Wed, 16 Oct 2024 14:48:00 +0200 Subject: [PATCH 101/165] Switched to action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c75713f5f..08dfe2ee9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: ./gradlew javadoc - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@ + uses: sonarsource/sonarqube-scan-action@v3 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} \ No newline at end of file From cfcabbf242892ebf6640452b4be886ebbe1010e7 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Wed, 16 Oct 2024 14:57:26 +0200 Subject: [PATCH 102/165] Back to gradle --- .github/workflows/ci.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08dfe2ee9c..3a188e437a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,8 +59,5 @@ jobs: run: | ./gradlew javadoc - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@v3 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} \ No newline at end of file + - name: Run SonarQube with Gradle + run: ./gradlew reportScoverage sonarqube -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.branch.name=${{ github.head_ref || github.ref_name }} \ No newline at end of file From 1ff1b5a93e30a24d5d8042e238e56b5e230e7c66 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 11:51:38 +0200 Subject: [PATCH 103/165] Removed dependencies from sonarqube.gradle --- gradle/scripts/sonarqube.gradle | 3 --- 1 file changed, 3 deletions(-) diff --git a/gradle/scripts/sonarqube.gradle b/gradle/scripts/sonarqube.gradle index 80a9db4fd1..29a4bcc28a 100644 --- a/gradle/scripts/sonarqube.gradle +++ b/gradle/scripts/sonarqube.gradle @@ -34,8 +34,5 @@ sonarqube { } // sonarqube task dependencies -project.tasks["sonarqube"].dependsOn "pmdMain" -project.tasks["sonarqube"].dependsOn "pmdTest" -project.tasks["sonarqube"].dependsOn "test" project.tasks["sonarqube"].dependsOn "reportScoverage" project.tasks["sonarqube"].dependsOn "checkScoverage" From 58ada892407b2e9db574296ad75db83ae878a392 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 12:41:14 +0200 Subject: [PATCH 104/165] Added deployment step and sonar quality gate --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a188e437a..95b402d886 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,11 +30,12 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - name: Check Branch & Files + - name: Determine Project Version + id: version run: | - git rev-parse --abbrev-ref HEAD - pwd - ls -la + branch_name=$(echo ${{ github.ref_name }}) + project_version=$(./gradlew -q $([ "$branch_name" = "dev" ] && echo "devVersion" || echo "currentVersion")) + echo "project_version=${project_version}" >> $GITHUB_ENV - name: Setup Java uses: actions/setup-java@v4 @@ -59,5 +60,29 @@ jobs: run: | ./gradlew javadoc - - name: Run SonarQube with Gradle - run: ./gradlew reportScoverage sonarqube -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.branch.name=${{ github.head_ref || github.ref_name }} \ No newline at end of file + - name: SonarQube Scan + run: | + ./gradlew reportScoverage sonarqube \ + -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ + -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \ + -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ + -Dsonar.branch.name=${{ github.head_ref || github.ref_name }} + + - name: SonarQube Quality Gate + id: sonarqube-quality-gate-check + uses: sonarsource/sonarqube-quality-gate-action@master + # Force to fail step after specific time. + timeout-hours: 1 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} + + - name: Deploy + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' + run: | + ./gradlew --refresh-dependencies test publish\ + -Puser=${{ secrets.MAVENCENTRAL_USER }} \ + -Ppassword=${{ secrets.MAVENCENTRAL_PASS }} \ + -Psigning.keyId=${{ secrets.MAVENCENTRAL_SIGNINGKEYID }} \ + -Psigning.password=${{ secrets.MAVENCENTRAL_SIGNINGPASS }} \ + -Psigning.secretKeyRingFile=${{ secrets.MAVENCENTRAL_SIGNINGKEY }} \ No newline at end of file From 50386fcda0ca6cda1908e7e29a34574045219333 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 12:42:01 +0200 Subject: [PATCH 105/165] fixed time format --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95b402d886..65ab3d84e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: id: sonarqube-quality-gate-check uses: sonarsource/sonarqube-quality-gate-action@master # Force to fail step after specific time. - timeout-hours: 1 + timeout-minutes: 60 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} From 33007be449d99f75d8420f30b64079f8a16d06a6 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 13:04:19 +0200 Subject: [PATCH 106/165] debug --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65ab3d84e0..6546cba77a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,14 @@ jobs: -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ -Dsonar.branch.name=${{ github.head_ref || github.ref_name }} + - name: Check if SonarQube Report Exists + id: verify-report + run: | + if [ ! -f ".scannerwork/report-task.txt" ]; then + echo "SonarQube report not found. Exiting." + exit 1 + fi + - name: SonarQube Quality Gate id: sonarqube-quality-gate-check uses: sonarsource/sonarqube-quality-gate-action@master From 5042d360e657848d51f2e91558c4bbfe9e09cbd5 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 13:35:50 +0200 Subject: [PATCH 107/165] Added dependencie to sonarqube.gradle and changed workflow --- .github/workflows/ci.yml | 2 +- gradle/scripts/sonarqube.gradle | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6546cba77a..a36d1ed2dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: - name: Run Tests run: | - ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest test + ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest - name: Build Java-Docs run: | diff --git a/gradle/scripts/sonarqube.gradle b/gradle/scripts/sonarqube.gradle index 29a4bcc28a..501bbbdc72 100644 --- a/gradle/scripts/sonarqube.gradle +++ b/gradle/scripts/sonarqube.gradle @@ -34,5 +34,6 @@ sonarqube { } // sonarqube task dependencies +project.tasks["sonarqube"].dependsOn "test" project.tasks["sonarqube"].dependsOn "reportScoverage" project.tasks["sonarqube"].dependsOn "checkScoverage" From 5c8ea2ba5c8f10d9dbb27f5e0bb1013dc68b6370 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 14:13:26 +0200 Subject: [PATCH 108/165] sonar --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a36d1ed2dc..1292b97813 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,7 +62,7 @@ jobs: - name: SonarQube Scan run: | - ./gradlew reportScoverage sonarqube \ + ./gradlew reportScoverage sonar \ -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \ -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ From e6b7e23a50e523a24c48e1993c00f67d0c966aa4 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 14:50:19 +0200 Subject: [PATCH 109/165] Switched to action --- .github/workflows/ci.yml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1292b97813..b2fe00ff39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,21 +60,15 @@ jobs: run: | ./gradlew javadoc - - name: SonarQube Scan - run: | - ./gradlew reportScoverage sonar \ - -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \ - -Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \ - -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ - -Dsonar.branch.name=${{ github.head_ref || github.ref_name }} - - - name: Check if SonarQube Report Exists - id: verify-report - run: | - if [ ! -f ".scannerwork/report-task.txt" ]; then - echo "SonarQube report not found. Exiting." - exit 1 - fi + - name: SonarQube Analysis + uses: sonarsource/sonarqube-scan-action@master + with: + projectBaseDir: '.' + args: > + -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} - name: SonarQube Quality Gate id: sonarqube-quality-gate-check From 0a0174b35f6089a1245bd43ef9354e3666af443e Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 15:04:09 +0200 Subject: [PATCH 110/165] Added path to binaries --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2fe00ff39..6fff761021 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,7 @@ jobs: projectBaseDir: '.' args: > -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} + -Dsonar.java.binaries=build/classes/java/main,build/classes/scala/main env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} From 00fd90a4eff6d66b4f7c67fac88b52e1a442efa5 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 15:10:25 +0200 Subject: [PATCH 111/165] Added path to binaries --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fff761021..48e82a37cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: projectBaseDir: '.' args: > -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} - -Dsonar.java.binaries=build/classes/java/main,build/classes/scala/main + -Dsonar.java.binaries=build/classes/java/main env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} From fa44b062f6055275bfb3b1f9c10c0a2fdae87758 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 15:27:57 +0200 Subject: [PATCH 112/165] Debug --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48e82a37cc..4ccdf1a69d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,7 @@ jobs: - name: Build Java-Docs run: | ./gradlew javadoc + ls -la - name: SonarQube Analysis uses: sonarsource/sonarqube-scan-action@master From d203385e3c601e9288c4b5e73bbd0b51bdf0b715 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 15:32:24 +0200 Subject: [PATCH 113/165] Debug --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ccdf1a69d..79b9480484 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: projectBaseDir: '.' args: > -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} - -Dsonar.java.binaries=build/classes/java/main + -Dsonar.java.binaries=build/classes/scala/main env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} From 1ff759cb1dabd95c0b9f8ded55981cb569b4653a Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 15:45:13 +0200 Subject: [PATCH 114/165] Debug --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79b9480484..eaf56da627 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,15 @@ jobs: args: > -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} -Dsonar.java.binaries=build/classes/scala/main + -Dsonar.verbose=true + -Dsonar.sourceEncoding=UTF-8 + -Dsonar.sources=src/main/resources,src/main/scala + -Dsonar.tests=src/test/resources,src/test/scala,src/test/groovy + -Dsonar.junit.reportPaths=build/test-results/test + -Dsonar.scala.scapegoat.reportPaths=build/reports/scapegoat/src/scapegoat-scalastyle.xml,build/reports/scapegoat/testsrc/scapegoat-scalastyle.xml + -Dsonar.scala.coverage.reportPaths=build/reports/scoverageTest/scoverage.xml + -Dsonar.groovy.binaries=build/classes/groovy + -Dsonar.exclusions=src/main/scala/edu/ie3/simona/config/SimonaConfig.scala env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} From 9d5d39580502e935a0068c72fc38ab7d3c1aea00 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 15:53:12 +0200 Subject: [PATCH 115/165] Finished Prototype --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaf56da627..cc0d644944 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,12 +54,11 @@ jobs: - name: Run Tests run: | - ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest + ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest test - name: Build Java-Docs run: | ./gradlew javadoc - ls -la - name: SonarQube Analysis uses: sonarsource/sonarqube-scan-action@master From 15ef2df51068a33385c073597eb404ac16d955b4 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 16:02:25 +0200 Subject: [PATCH 116/165] Finished Prototype --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc0d644944..a4101376dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: - name: Run Tests run: | - ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest test + ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest - name: Build Java-Docs run: | From a8fd9ee36d739a6261b822fe83ab4a827d8a87fa Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 17 Oct 2024 16:19:10 +0200 Subject: [PATCH 117/165] Changed Java-Docs to Scala-Docs --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4101376dd..7c7576f9da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,9 +56,9 @@ jobs: run: | ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest - - name: Build Java-Docs + - name: Build Scala-Docs run: | - ./gradlew javadoc + ./gradlew scaladoc - name: SonarQube Analysis uses: sonarsource/sonarqube-scan-action@master From 07aded54c05a79001b634ea93e68763ff38a3263 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 11:11:08 +0100 Subject: [PATCH 118/165] Resolved Conversations --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c7576f9da..81ef1b9f83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,8 @@ name: CI on: push: + paths-ignore: + - 'docs/**' branches: - main - dev @@ -19,7 +21,6 @@ on: - dev jobs: - build: runs-on: ubuntu-latest @@ -45,16 +46,14 @@ jobs: - name: Setup Gradle 8.10 uses: gradle/actions/setup-gradle@v4 - with: - gradle-version: "8.10" - name: Build Project run: | - ./gradlew clean assemble + ./gradlew --refresh-dependencies clean assemble - name: Run Tests run: | - ./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest + ./gradlew spotlessCheck pmdMain pmdTest - name: Build Scala-Docs run: | @@ -84,7 +83,7 @@ jobs: id: sonarqube-quality-gate-check uses: sonarsource/sonarqube-quality-gate-action@master # Force to fail step after specific time. - timeout-minutes: 60 + timeout-minutes: 15 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} From acc22f5d51d8c247d06c9cd9489ddb93d8b6410b Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 11:54:22 +0100 Subject: [PATCH 119/165] Changed branches --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81ef1b9f83..7fcd1f25a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,9 @@ on: branches: - main - dev - - 'feature/*' - 'hotfix/*' - - 'release/*' + - 'rel/*' + - 'dependabot/*' pull_request: branches: - main @@ -44,7 +44,7 @@ jobs: distribution: 'temurin' java-version: 17 - - name: Setup Gradle 8.10 + - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - name: Build Project From 39cbb1ff0b5b92ea9ddc521311f9c79862f237cc Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 13:22:00 +0100 Subject: [PATCH 120/165] Added check for naming convention --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fcd1f25a9..f45fab56f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,15 @@ jobs: runs-on: ubuntu-latest steps: + - name: Check branch naming convention + if: startsWith(github.ref, 'refs/heads/') + run: | + branch_name="${GITHUB_REF#refs/heads/}" + if [[ ! "$branch_name" =~ ^[\\p{Ll}]{2}/#\\d+.* ]]; then + echo "Error: Branch name must start with two lowercase initials (e.g., ps/#1337-FeatureName)." + exit 1 + fi + - name: Checkout Source uses: actions/checkout@v4 with: From e69b746c6caf346cd34d138036ec8e665065e6ab Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 13:30:41 +0100 Subject: [PATCH 121/165] Fixed Check Branch Step --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f45fab56f3..c253305aa7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Check branch naming convention - if: startsWith(github.ref, 'refs/heads/') + - name: Check Branch run: | branch_name="${GITHUB_REF#refs/heads/}" if [[ ! "$branch_name" =~ ^[\\p{Ll}]{2}/#\\d+.* ]]; then From 938172847cf5e79ba63d46d31dcf8c8b54f971c6 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 13:33:15 +0100 Subject: [PATCH 122/165] Debug --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c253305aa7..4f2a71f58c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,9 @@ jobs: steps: - name: Check Branch run: | + branch_name="${GITHUB_REF#refs/heads/}" + echo "Current branch name is: $branch_name" + branch_name="${GITHUB_REF#refs/heads/}" if [[ ! "$branch_name" =~ ^[\\p{Ll}]{2}/#\\d+.* ]]; then echo "Error: Branch name must start with two lowercase initials (e.g., ps/#1337-FeatureName)." From acf609f0183a808528d0bc2f8ea5df93ef5221a1 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 13:36:56 +0100 Subject: [PATCH 123/165] Debug --- .github/workflows/ci.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f2a71f58c..dabf123fd6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,15 @@ jobs: steps: - name: Check Branch run: | - branch_name="${GITHUB_REF#refs/heads/}" - echo "Current branch name is: $branch_name" + if [ "$GITHUB_REF" == "refs/pull/"* ]; then + # For pull request events, use GITHUB_HEAD_REF + branch_name="${GITHUB_HEAD_REF}" + else + # For push events, extract from GITHUB_REF + branch_name="${GITHUB_REF#refs/heads/}" + fi + + echo "Branch name is: $branch_name" branch_name="${GITHUB_REF#refs/heads/}" if [[ ! "$branch_name" =~ ^[\\p{Ll}]{2}/#\\d+.* ]]; then From 8ceb3abd80ddc0404d2b9187c2060a8764dbea08 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 13:49:01 +0100 Subject: [PATCH 124/165] Debug --- .github/workflows/ci.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dabf123fd6..84e4e8b5ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,15 +27,16 @@ jobs: steps: - name: Check Branch run: | - if [ "$GITHUB_REF" == "refs/pull/"* ]; then - # For pull request events, use GITHUB_HEAD_REF - branch_name="${GITHUB_HEAD_REF}" - else - # For push events, extract from GITHUB_REF - branch_name="${GITHUB_REF#refs/heads/}" + # Default to the GITHUB_REF_NAME, which works for push events + BRANCH_NAME="${GITHUB_REF_NAME}" + + # If it's a pull request, extract the branch from GITHUB_HEAD_REF + if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then + BRANCH_NAME="${GITHUB_HEAD_REF}" fi - echo "Branch name is: $branch_name" + echo "Branch name is $BRANCH_NAME" + echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV branch_name="${GITHUB_REF#refs/heads/}" if [[ ! "$branch_name" =~ ^[\\p{Ll}]{2}/#\\d+.* ]]; then From 1e1634d9d7a306e3b1f7744e5ec2180ef3cc9320 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 13:52:25 +0100 Subject: [PATCH 125/165] Debug --- .github/workflows/ci.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84e4e8b5ff..13de60e23b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,13 @@ jobs: runs-on: ubuntu-latest steps: + + - name: Checkout Source + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || github.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + - name: Check Branch run: | # Default to the GITHUB_REF_NAME, which works for push events @@ -37,19 +44,13 @@ jobs: echo "Branch name is $BRANCH_NAME" echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV - + branch_name="${GITHUB_REF#refs/heads/}" if [[ ! "$branch_name" =~ ^[\\p{Ll}]{2}/#\\d+.* ]]; then echo "Error: Branch name must start with two lowercase initials (e.g., ps/#1337-FeatureName)." exit 1 fi - - name: Checkout Source - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref || github.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - name: Determine Project Version id: version run: | From a4be0c256f52b637354ac005468da9a508e904ba Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 13:54:42 +0100 Subject: [PATCH 126/165] Debug --- .github/workflows/ci.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13de60e23b..4220f28355 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,23 +34,26 @@ jobs: - name: Check Branch run: | - # Default to the GITHUB_REF_NAME, which works for push events + # Default to GITHUB_REF_NAME (works for push events) BRANCH_NAME="${GITHUB_REF_NAME}" - # If it's a pull request, extract the branch from GITHUB_HEAD_REF + # If it's a pull request, use GITHUB_HEAD_REF if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then BRANCH_NAME="${GITHUB_HEAD_REF}" fi - echo "Branch name is $BRANCH_NAME" - echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV + # Extract the branch name from refs/heads/ for push events + branch_name="${BRANCH_NAME#refs/heads/}" - branch_name="${GITHUB_REF#refs/heads/}" - if [[ ! "$branch_name" =~ ^[\\p{Ll}]{2}/#\\d+.* ]]; then + # Check if branch name matches pattern (e.g., `ps/#1337-FeatureName`) + if [[ ! "$branch_name" =~ ^[a-z]{2}/#\\d+.* ]]; then echo "Error: Branch name must start with two lowercase initials (e.g., ps/#1337-FeatureName)." exit 1 fi + echo "Branch name is $branch_name" + echo "branch_name=$branch_name" >> $GITHUB_ENV + - name: Determine Project Version id: version run: | From 905594640d2814ddcadee6d983e48fcbe25b9e59 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 13:58:31 +0100 Subject: [PATCH 127/165] Debug --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4220f28355..261c8c04cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,8 +45,8 @@ jobs: # Extract the branch name from refs/heads/ for push events branch_name="${BRANCH_NAME#refs/heads/}" - # Check if branch name matches pattern (e.g., `ps/#1337-FeatureName`) - if [[ ! "$branch_name" =~ ^[a-z]{2}/#\\d+.* ]]; then + # Adjusted regex pattern to match two lowercase initials, slash, hashtag, and number + if [[ ! "$branch_name" =~ ^[a-z]{2}/#([0-9]+)(-.*)?$ ]]; then echo "Error: Branch name must start with two lowercase initials (e.g., ps/#1337-FeatureName)." exit 1 fi From 911d0ed0f992976763129553b5e4f61068fbdb78 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 14:01:59 +0100 Subject: [PATCH 128/165] Testing --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 261c8c04cb..b6863e2a4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,8 +41,8 @@ jobs: if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then BRANCH_NAME="${GITHUB_HEAD_REF}" fi - - # Extract the branch name from refs/heads/ for push events + + # Extract the branch name from refs/heads/ for push events :) branch_name="${BRANCH_NAME#refs/heads/}" # Adjusted regex pattern to match two lowercase initials, slash, hashtag, and number From ae77ae11b1e52d82c70a1861cd0eaba3d29e8b31 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 14:54:21 +0100 Subject: [PATCH 129/165] Final --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6863e2a4c..18898aca08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: BRANCH_NAME="${GITHUB_HEAD_REF}" fi - # Extract the branch name from refs/heads/ for push events :) + # Extract the branch name from refs/heads/ for push events branch_name="${BRANCH_NAME#refs/heads/}" # Adjusted regex pattern to match two lowercase initials, slash, hashtag, and number From 55180540fe44cd33b79133f9fbb62d7ca100d444 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 15:07:05 +0100 Subject: [PATCH 130/165] Final :) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18898aca08..53b05c787e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ on: - 'hotfix/*' - 'rel/*' - 'dependabot/*' + - '??/#*' pull_request: branches: - main From 364f6e1d910b87fb12512097c42d10d5909f9cdc Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Tue, 29 Oct 2024 15:13:18 +0100 Subject: [PATCH 131/165] Removed branch --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53b05c787e..18898aca08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,6 @@ on: - 'hotfix/*' - 'rel/*' - 'dependabot/*' - - '??/#*' pull_request: branches: - main From e3861dee3ce0d35ec5eeff87ba192843fd63e564 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Mon, 18 Nov 2024 13:43:07 +0100 Subject: [PATCH 132/165] Removed smth --- .github/workflows/ci.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffbb1f991b..9f6ba34008 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,14 +52,7 @@ jobs: fi echo "Branch name is $branch_name" - echo "branch_name=$branch_name" >> $GITHUB_ENV - - - name: Determine Project Version - id: version - run: | - branch_name=$(echo ${{ github.ref_name }}) - project_version=$(./gradlew -q $([ "$branch_name" = "dev" ] && echo "devVersion" || echo "currentVersion")) - echo "project_version=${project_version}" >> $GITHUB_ENV + echo "branch_name=$branch_name" >> $GITHUB_EN - name: Setup Java uses: actions/setup-java@v4 From 1c3678c6bf45513236f94cbcd44bb24db91b0af1 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Mon, 18 Nov 2024 15:31:15 +0100 Subject: [PATCH 133/165] Fixing output --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f6ba34008..9cfc3f28e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: fi echo "Branch name is $branch_name" - echo "branch_name=$branch_name" >> $GITHUB_EN + echo "branch_name=$branch_name" >> $GITHUB_ENV - name: Setup Java uses: actions/setup-java@v4 From 39d5a3d00121fd1e7390fbba0864820f9ef1f501 Mon Sep 17 00:00:00 2001 From: Sebastian Peter Date: Tue, 19 Nov 2024 20:13:31 +0100 Subject: [PATCH 134/165] Introducing CITATION.cff Signed-off-by: Sebastian Peter --- CHANGELOG.md | 1 + CITATION.cff | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 CITATION.cff diff --git a/CHANGELOG.md b/CHANGELOG.md index abbcb83730..2ff2c66d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add some quote to 'printGoodbye' [#997](https://github.com/ie3-institute/simona/issues/997) - Add unapply method for ThermalHouseResults [#934](https://github.com/ie3-institute/simona/issues/934) - Added `ApparentPower` to differentiate between different power types [#794](https://github.com/ie3-institute/simona/issues/794) +- Create `CITATION.cff` [#1035](https://github.com/ie3-institute/simona/issues/1035) ### Changed - Adapted to changed data source in PSDM [#435](https://github.com/ie3-institute/simona/issues/435) diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000000..fc6f218dce --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,41 @@ +cff-version: 1.2.0 +title: SIMONA +message: "If you use this software, please cite it as below." +type: software +authors: + - family-names: Hiry + given-names: Johannes + orcid: https://orcid.org/0000-0002-1447-0607 + - family-names: Kittl + given-names: Chris + orcid: https://orcid.org/0000-0002-1187-0568 + - family-names: Sen-Sarma + given-names: Debopama + orcid: https://orcid.org/0000-0003-3311-3020 + - family-names: Oberließen + given-names: Thomas + orcid: https://orcid.org/0000-0001-5805-5408 + - family-names: Peter + given-names: Sebastian + orcid: https://orcid.org/0000-0001-6311-6113 + - family-names: Feismann + given-names: Daniel + orcid: https://orcid.org/0000-0002-3531-9025 + - family-names: Bao + given-names: Johannes + orcid: https://orcid.org/0009-0008-3641-6469 + - family-names: Hohmann + given-names: Julian + - family-names: Staudt + given-names: Marius +repository-code: https://github.com/ie3-institute/simona +url: https://simona.ie3.e-technik.tu-dortmund.de +repository-artifact: https://central.sonatype.com/artifact/com.github.ie3-institute/simona +keywords: + - agent-based + - discrete-event simulation + - powerflow + - electricity distribution grid +license: BSD-3-Clause +version: 3.0.0 +date-released: 2023-08-07 From ff21a716a735205baf46c4d0fb753b34626c0938 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 21 Nov 2024 12:57:30 +0100 Subject: [PATCH 135/165] Outsourced checkBranchName --- .github/workflows/ci.yml | 21 +-------------------- build.gradle | 1 + gradle/scripts/BranchName.gradle | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 20 deletions(-) create mode 100644 gradle/scripts/BranchName.gradle diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cfc3f28e3..58f692d89d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,26 +33,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - name: Check Branch - run: | - # Default to GITHUB_REF_NAME (works for push events) - BRANCH_NAME="${GITHUB_REF_NAME}" - - # If it's a pull request, use GITHUB_HEAD_REF - if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then - BRANCH_NAME="${GITHUB_HEAD_REF}" - fi - - # Extract the branch name from refs/heads/ for push events - branch_name="${BRANCH_NAME#refs/heads/}" - - # Adjusted regex pattern to match two lowercase initials, slash, hashtag, and number - if [[ ! "$branch_name" =~ ^[a-z]{2}/#([0-9]+)(-.*)?$ ]]; then - echo "Error: Branch name must start with two lowercase initials (e.g., ps/#1337-FeatureName)." - exit 1 - fi - - echo "Branch name is $branch_name" - echo "branch_name=$branch_name" >> $GITHUB_ENV + run: ./gradlew checkBranchName - name: Setup Java uses: actions/setup-java@v4 diff --git a/build.gradle b/build.gradle index a69e01e63d..c3af3f14a1 100644 --- a/build.gradle +++ b/build.gradle @@ -54,6 +54,7 @@ apply from: scriptsLocation + 'scoverage.gradle' // scoverage scala code coverag apply from: scriptsLocation + 'deploy.gradle' apply from: scriptsLocation + 'semVer.gradle' apply from: scriptsLocation + 'mavenCentralPublish.gradle' +apply from: scriptsLocation + 'BranchName.gradle' configurations { scalaCompilerPlugin diff --git a/gradle/scripts/BranchName.gradle b/gradle/scripts/BranchName.gradle new file mode 100644 index 0000000000..65e790049e --- /dev/null +++ b/gradle/scripts/BranchName.gradle @@ -0,0 +1,23 @@ +task checkBranchName { + doLast { + def branchName = System.getenv('GITHUB_REF_NAME') + def eventName = System.getenv('GITHUB_EVENT_NAME') + def headRef = System.getenv('GITHUB_HEAD_REF') + + if (eventName == 'pull_request') { + branchName = headRef + } + + if (branchName.startsWith('refs/heads/')) { + branchName = branchName.replaceFirst('refs/heads/', '') + } + + def pattern = /^[a-z]{2}\/#([0-9]+)(-.*)?$/ + if (!branchName.matches(pattern)) { + throw new GradleException("Error: Branch name must start with two lowercase initials (e.g., ps/#1337-FeatureName).") + } + + println "Branch name is $branchName" + project.ext.set('branch_name', branchName) + } +} \ No newline at end of file From 43071b6d747fa2ae7a17b270980366e5ac038052 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 21 Nov 2024 13:10:13 +0100 Subject: [PATCH 136/165] Message --- gradle/scripts/BranchName.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/scripts/BranchName.gradle b/gradle/scripts/BranchName.gradle index 65e790049e..f3fd835bf8 100644 --- a/gradle/scripts/BranchName.gradle +++ b/gradle/scripts/BranchName.gradle @@ -14,7 +14,7 @@ task checkBranchName { def pattern = /^[a-z]{2}\/#([0-9]+)(-.*)?$/ if (!branchName.matches(pattern)) { - throw new GradleException("Error: Branch name must start with two lowercase initials (e.g., ps/#1337-FeatureName).") + throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName).") } println "Branch name is $branchName" From 58eb78dc39353d37d55242eb888b648859a3ad5a Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 21 Nov 2024 14:33:11 +0100 Subject: [PATCH 137/165] Resolved Convos --- .github/workflows/ci.yml | 6 +++++- build.gradle | 2 +- gradle/scripts/BranchName.gradle | 23 ----------------------- gradle/scripts/branchName.gradle | 26 ++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 25 deletions(-) delete mode 100644 gradle/scripts/BranchName.gradle create mode 100644 gradle/scripts/branchName.gradle diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58f692d89d..6c76f3d80f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,11 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - name: Check Branch - run: ./gradlew checkBranchName + run: | + ./gradlew checkBranchName \ + -PbranchName="$GITHUB_REF_NAME" \ + -PeventName="$GITHUB_EVENT_NAME" \ + -PheadRef="$GITHUB_HEAD_REF" - name: Setup Java uses: actions/setup-java@v4 diff --git a/build.gradle b/build.gradle index c3af3f14a1..3125cfe07e 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ apply from: scriptsLocation + 'scoverage.gradle' // scoverage scala code coverag apply from: scriptsLocation + 'deploy.gradle' apply from: scriptsLocation + 'semVer.gradle' apply from: scriptsLocation + 'mavenCentralPublish.gradle' -apply from: scriptsLocation + 'BranchName.gradle' +apply from: scriptsLocation + 'branchName.gradle' configurations { scalaCompilerPlugin diff --git a/gradle/scripts/BranchName.gradle b/gradle/scripts/BranchName.gradle deleted file mode 100644 index f3fd835bf8..0000000000 --- a/gradle/scripts/BranchName.gradle +++ /dev/null @@ -1,23 +0,0 @@ -task checkBranchName { - doLast { - def branchName = System.getenv('GITHUB_REF_NAME') - def eventName = System.getenv('GITHUB_EVENT_NAME') - def headRef = System.getenv('GITHUB_HEAD_REF') - - if (eventName == 'pull_request') { - branchName = headRef - } - - if (branchName.startsWith('refs/heads/')) { - branchName = branchName.replaceFirst('refs/heads/', '') - } - - def pattern = /^[a-z]{2}\/#([0-9]+)(-.*)?$/ - if (!branchName.matches(pattern)) { - throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName).") - } - - println "Branch name is $branchName" - project.ext.set('branch_name', branchName) - } -} \ No newline at end of file diff --git a/gradle/scripts/branchName.gradle b/gradle/scripts/branchName.gradle new file mode 100644 index 0000000000..dac85f597f --- /dev/null +++ b/gradle/scripts/branchName.gradle @@ -0,0 +1,26 @@ +tasks.register('checkBranchName') { + doLast { + if (!project.hasProperty('branchName') || !project.hasProperty('eventName') || !project.hasProperty('headRef')) { + throw new GradleException("Error: Missing required properties 'branchName', 'eventName', or 'headRef'.") + } + + def branchName = project.property('branchName') + def eventName = project.property('eventName') + def headRef = project.property('headRef') + + if (eventName == 'pull_request') { + branchName = headRef + } + + if (branchName.startsWith('refs/heads/')) { + branchName = branchName.replaceFirst('refs/heads/', '') + } + + def pattern = /^[a-z]{2}\\/#[0-9]+(?:-.+)?$/ + if (!branchName.matches(pattern)) { + throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName).") + } + + println "Branch name is $branchName" + } +} \ No newline at end of file From 04082f1405da2f87372351b251689a629e805aa6 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 21 Nov 2024 14:37:02 +0100 Subject: [PATCH 138/165] empty line --- gradle/scripts/branchName.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/scripts/branchName.gradle b/gradle/scripts/branchName.gradle index dac85f597f..86e7e9db20 100644 --- a/gradle/scripts/branchName.gradle +++ b/gradle/scripts/branchName.gradle @@ -23,4 +23,4 @@ tasks.register('checkBranchName') { println "Branch name is $branchName" } -} \ No newline at end of file +} From 63a6b1e1251b027fc68fade037019e146cbd1acd Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 21 Nov 2024 14:39:57 +0100 Subject: [PATCH 139/165] realigned steps --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c76f3d80f..e341e9dd52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,9 @@ jobs: ref: ${{ github.event.pull_request.head.ref || github.ref }} repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Check Branch run: | ./gradlew checkBranchName \ @@ -45,9 +48,6 @@ jobs: distribution: 'temurin' java-version: 17 - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - - name: Build Project run: ./gradlew --refresh-dependencies clean assemble spotlessCheck From 0b87a2dfcbe29e3bd1cb91e1e5c534ec77c5a0da Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 21 Nov 2024 16:06:14 +0100 Subject: [PATCH 140/165] updated branchName.gradle --- .github/workflows/ci.yml | 15 +++++++++++---- gradle/scripts/branchName.gradle | 16 +++------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e341e9dd52..b1a8c1c681 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,10 +37,17 @@ jobs: - name: Check Branch run: | - ./gradlew checkBranchName \ - -PbranchName="$GITHUB_REF_NAME" \ - -PeventName="$GITHUB_EVENT_NAME" \ - -PheadRef="$GITHUB_HEAD_REF" + if [ "${{ github.event_name }}" == "pull_request" ]; then + branchName="${{ github.head_ref }}" + else + branchName="${{ github.ref_name }}" + fi + + if [[ "$branchName" == refs/heads/* ]]; then + branchName="${branchName#refs/heads/}" + fi + + ./gradlew checkBranchName -PbranchName="$GITHUB_REF_NAME" - name: Setup Java uses: actions/setup-java@v4 diff --git a/gradle/scripts/branchName.gradle b/gradle/scripts/branchName.gradle index 86e7e9db20..5ef4e7dd6d 100644 --- a/gradle/scripts/branchName.gradle +++ b/gradle/scripts/branchName.gradle @@ -1,20 +1,10 @@ tasks.register('checkBranchName') { doLast { - if (!project.hasProperty('branchName') || !project.hasProperty('eventName') || !project.hasProperty('headRef')) { - throw new GradleException("Error: Missing required properties 'branchName', 'eventName', or 'headRef'.") + if (!project.hasProperty('branchName')) { + throw new GradleException("Error: Missing required property 'branchName'.") } def branchName = project.property('branchName') - def eventName = project.property('eventName') - def headRef = project.property('headRef') - - if (eventName == 'pull_request') { - branchName = headRef - } - - if (branchName.startsWith('refs/heads/')) { - branchName = branchName.replaceFirst('refs/heads/', '') - } def pattern = /^[a-z]{2}\\/#[0-9]+(?:-.+)?$/ if (!branchName.matches(pattern)) { @@ -23,4 +13,4 @@ tasks.register('checkBranchName') { println "Branch name is $branchName" } -} +} \ No newline at end of file From bc1e0d15acc1b7c90023f01554b8df8b8e742855 Mon Sep 17 00:00:00 2001 From: PhilippSchmelter Date: Thu, 21 Nov 2024 16:10:01 +0100 Subject: [PATCH 141/165] updated ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1a8c1c681..55c66d6a96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,8 +46,8 @@ jobs: if [[ "$branchName" == refs/heads/* ]]; then branchName="${branchName#refs/heads/}" fi - - ./gradlew checkBranchName -PbranchName="$GITHUB_REF_NAME" + + ./gradlew checkBranchName -PbranchName="$branchName" - name: Setup Java uses: actions/setup-java@v4 From c44bcaef8f43ff11c8efc91322b32ace61a2fc7c Mon Sep 17 00:00:00 2001 From: Sebastian Peter Date: Fri, 22 Nov 2024 18:15:56 +0100 Subject: [PATCH 142/165] Correcting wrong use of "wall clock time" Signed-off-by: Sebastian Peter --- CHANGELOG.md | 1 + .../agent/grid/GridAgentController.scala | 24 +++++++++---------- .../agent/grid/GridResultsSupport.scala | 6 ++--- .../ParticipantAgentFundamentals.scala | 4 ++-- .../participant/hp/HpAgentFundamentals.scala | 4 ++-- .../participant/statedata/BaseStateData.scala | 6 ++--- .../service/primary/PrimaryServiceProxy.scala | 8 +++---- .../primary/PrimaryServiceWorker.scala | 12 +++++----- .../service/weather/SampleWeatherSource.scala | 10 ++++---- .../participant/ParticipantAgentMock.scala | 4 ++-- 10 files changed, 40 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76a0624832..701bb86ea4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -142,6 +142,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix some minor issues and findings from inspections [#1019](https://github.com/ie3-institute/simona/issues/1019) - Fix initialisation freezing on empty primary data [#981](https://github.com/ie3-institute/simona/issues/981) - Shallow fetch in CI [#1041](https://github.com/ie3-institute/simona/issues/1041) +- Correct wrong use of term "wall clock time" [#727](https://github.com/ie3-institute/simona/issues/727) ## [3.0.0] - 2023-08-07 diff --git a/src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala b/src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala index ad0d6c3b07..8d615ec3af 100644 --- a/src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala +++ b/src/main/scala/edu/ie3/simona/agent/grid/GridAgentController.scala @@ -455,9 +455,9 @@ class GridAgentController( * @param primaryServiceProxy * Reference to the primary data service proxy * @param simulationStartDate - * First wall clock time in simulation + * The simulation time at which the simulation starts * @param simulationEndDate - * Last wall clock time in simulation + * The simulation time at which the simulation ends * @param resolution * Frequency of power flow calculations * @param requestVoltageDeviationThreshold @@ -512,9 +512,9 @@ class GridAgentController( * @param primaryServiceProxy * Reference to the primary data service proxy * @param simulationStartDate - * First wall clock time in simulation + * The simulation time at which the simulation starts * @param simulationEndDate - * Last wall clock time in simulation + * The simulation time at which the simulation ends * @param resolution * Frequency of power flow calculations * @param requestVoltageDeviationThreshold @@ -571,9 +571,9 @@ class GridAgentController( * @param weatherService * Reference to the weather service actor * @param simulationStartDate - * First wall clock time in simulation + * The simulation time at which the simulation starts * @param simulationEndDate - * Last wall clock time in simulation + * The simulation time at which the simulation ends * @param resolution * Frequency of power flow calculations * @param requestVoltageDeviationThreshold @@ -631,9 +631,9 @@ class GridAgentController( * @param evMovementsService * Reference to the ev movements service actor * @param simulationStartDate - * First wall clock time in simulation + * The simulation time at which the simulation starts * @param simulationEndDate - * Last wall clock time in simulation + * The simulation time at which the simulation ends * @param resolution * Frequency of power flow calculations * @param requestVoltageDeviationThreshold @@ -749,9 +749,9 @@ class GridAgentController( * @param weatherService * Reference to the weather service actor * @param simulationStartDate - * First wall clock time in simulation + * The simulation time at which the simulation starts * @param simulationEndDate - * Last wall clock time in simulation + * The simulation time at which the simulation ends * @param resolution * Frequency of power flow calculations * @param requestVoltageDeviationThreshold @@ -807,9 +807,9 @@ class GridAgentController( * @param primaryServiceProxy * Reference to the primary data service proxy * @param simulationStartDate - * First wall clock time in simulation + * The simulation time at which the simulation starts * @param simulationEndDate - * Last wall clock time in simulation + * The simulation time at which the simulation ends * @param resolution * Frequency of power flow calculations * @param requestVoltageDeviationThreshold diff --git a/src/main/scala/edu/ie3/simona/agent/grid/GridResultsSupport.scala b/src/main/scala/edu/ie3/simona/agent/grid/GridResultsSupport.scala index 59f0248f81..6b8b6520ff 100644 --- a/src/main/scala/edu/ie3/simona/agent/grid/GridResultsSupport.scala +++ b/src/main/scala/edu/ie3/simona/agent/grid/GridResultsSupport.scala @@ -617,7 +617,7 @@ object GridResultsSupport { /** Partial result for the port at the high voltage side * * @param time - * Wall clock time, the result does belong to + * Simulation time of the result * @param input * Unique identifier of the input model * @param currentMagnitude @@ -638,7 +638,7 @@ object GridResultsSupport { /** Partial result for the port at the medium voltage side * * @param time - * Wall clock time, the result does belong to + * Simulation time of the result * @param input * Unique identifier of the input model * @param currentMagnitude @@ -656,7 +656,7 @@ object GridResultsSupport { /** Partial result for the port at the low voltage side * * @param time - * Wall clock time, the result does belong to + * Simulation time of the result * @param input * Unique identifier of the input model * @param currentMagnitude diff --git a/src/main/scala/edu/ie3/simona/agent/participant/ParticipantAgentFundamentals.scala b/src/main/scala/edu/ie3/simona/agent/participant/ParticipantAgentFundamentals.scala index 12b0e9657c..a505696943 100644 --- a/src/main/scala/edu/ie3/simona/agent/participant/ParticipantAgentFundamentals.scala +++ b/src/main/scala/edu/ie3/simona/agent/participant/ParticipantAgentFundamentals.scala @@ -214,9 +214,9 @@ protected trait ParticipantAgentFundamentals[ * @param modelConfig * Configuration for the model * @param simulationStartDate - * Wall clock time of first instant in simulation + * Simulation time of first instant in simulation * @param simulationEndDate - * Wall clock time of last instant in simulation + * Simulation time of last instant in simulation * @return */ def buildModel( diff --git a/src/main/scala/edu/ie3/simona/agent/participant/hp/HpAgentFundamentals.scala b/src/main/scala/edu/ie3/simona/agent/participant/hp/HpAgentFundamentals.scala index 6a9d80cf58..534126b986 100644 --- a/src/main/scala/edu/ie3/simona/agent/participant/hp/HpAgentFundamentals.scala +++ b/src/main/scala/edu/ie3/simona/agent/participant/hp/HpAgentFundamentals.scala @@ -440,9 +440,9 @@ trait HpAgentFundamentals * @param modelConfig * Configuration for the model * @param simulationStartDate - * Wall clock time of first instant in simulation + * Simulation time of first instant in simulation * @param simulationEndDate - * Wall clock time of last instant in simulation + * Simulation time of last instant in simulation * @return */ override def buildModel( diff --git a/src/main/scala/edu/ie3/simona/agent/participant/statedata/BaseStateData.scala b/src/main/scala/edu/ie3/simona/agent/participant/statedata/BaseStateData.scala index b6ebd99841..04650f4763 100644 --- a/src/main/scala/edu/ie3/simona/agent/participant/statedata/BaseStateData.scala +++ b/src/main/scala/edu/ie3/simona/agent/participant/statedata/BaseStateData.scala @@ -43,7 +43,7 @@ trait BaseStateData[+PD <: PrimaryDataWithApparentPower[PD]] */ val startDate: ZonedDateTime - /** The wall clock date, at which the simulation ends + /** The simulation time at which the simulation ends */ val endDate: ZonedDateTime @@ -132,7 +132,7 @@ object BaseStateData { * @param startDate * The date, that fits the tick 0 * @param endDate - * The wall clock date, at which the simulation ends + * The simulation time at which the simulation ends * @param outputConfig * Determines the output behaviour of this model * @param additionalActivationTicks @@ -179,7 +179,7 @@ object BaseStateData { * @param startDate * The date, that fits the tick 0 * @param endDate - * The wall clock date, at which the simulation ends + * The simulation time at which the simulation ends * @param model * Physical model of the load * @param services diff --git a/src/main/scala/edu/ie3/simona/service/primary/PrimaryServiceProxy.scala b/src/main/scala/edu/ie3/simona/service/primary/PrimaryServiceProxy.scala index 838608a514..45de3bae63 100644 --- a/src/main/scala/edu/ie3/simona/service/primary/PrimaryServiceProxy.scala +++ b/src/main/scala/edu/ie3/simona/service/primary/PrimaryServiceProxy.scala @@ -79,7 +79,7 @@ import scala.util.{Failure, Success, Try} * @param scheduler * Reference to the scheduler of the simulation * @param startDateTime - * Wall clock time of the first instant in simulation + * Simulation time of the first instant in simulation */ case class PrimaryServiceProxy( scheduler: ActorRef, @@ -132,7 +132,7 @@ case class PrimaryServiceProxy( * @param primaryConfig * Configuration for the primary source * @param simulationStart - * Wall clock time of first instant in simulation + * Simulation time of first instant in simulation * @return * State data, containing the known model and time series identifiers */ @@ -505,7 +505,7 @@ object PrimaryServiceProxy { * @param primaryConfig * Configuration for the primary source * @param simulationStart - * Wall clock time of the first instant in simulation + * Simulation time of the first instant in simulation */ final case class InitPrimaryServiceProxyStateData( primaryConfig: PrimaryConfig, @@ -519,7 +519,7 @@ object PrimaryServiceProxy { * @param timeSeriesToSourceRef * Mapping from time series identifier to [[SourceRef]] * @param simulationStart - * Wall clock time of the first instant in simulation + * Simulation time of the first instant in simulation * @param primaryConfig * The configuration for the sources * @param mappingSource diff --git a/src/main/scala/edu/ie3/simona/service/primary/PrimaryServiceWorker.scala b/src/main/scala/edu/ie3/simona/service/primary/PrimaryServiceWorker.scala index b20fdd834c..f61974392d 100644 --- a/src/main/scala/edu/ie3/simona/service/primary/PrimaryServiceWorker.scala +++ b/src/main/scala/edu/ie3/simona/service/primary/PrimaryServiceWorker.scala @@ -228,8 +228,8 @@ final case class PrimaryServiceWorker[V <: Value]( Option[Long], ) = { /* Get the information to distribute */ - val wallClockTime = tick.toDateTime(serviceBaseStateData.startDateTime) - serviceBaseStateData.source.getValue(wallClockTime).toScala match { + val simulationTime = tick.toDateTime(serviceBaseStateData.startDateTime) + serviceBaseStateData.source.getValue(simulationTime).toScala match { case Some(value) => processDataAndAnnounce(tick, value, serviceBaseStateData) case None => @@ -237,7 +237,7 @@ final case class PrimaryServiceWorker[V <: Value]( log.warning( s"I expected to get data for tick '{}' ({}), but data is not available", tick, - wallClockTime, + simulationTime, ) updateStateDataAndBuildTriggerMessages(serviceBaseStateData) } @@ -371,7 +371,7 @@ object PrimaryServiceWorker { * @param timeSeriesUuid * Unique identifier of the time series to read * @param simulationStart - * Wall clock time of the beginning of simulation time + * Simulation time of the beginning of simulation time * @param csvSep * Column separation character of the csv files * @param directoryPath @@ -400,7 +400,7 @@ object PrimaryServiceWorker { * @param timeSeriesUuid * Unique identifier of the time series to read * @param simulationStart - * Wall clock time of the beginning of simulation time + * Simulation time of the beginning of simulation time * @param sqlParams * Parameters regarding SQL connection and table selection * @param databaseNamingStrategy @@ -420,7 +420,7 @@ object PrimaryServiceWorker { * @param activationTicks * Linked collection of ticks, in which data is available * @param startDateTime - * Wall clock time of the first instant in simulation + * Simulation time of the first instant in simulation * @param source * Implementation of [[TimeSeriesSource]] to use for actual acquisition of * data diff --git a/src/main/scala/edu/ie3/simona/service/weather/SampleWeatherSource.scala b/src/main/scala/edu/ie3/simona/service/weather/SampleWeatherSource.scala index 0db3ded44c..7f3a7de525 100644 --- a/src/main/scala/edu/ie3/simona/service/weather/SampleWeatherSource.scala +++ b/src/main/scala/edu/ie3/simona/service/weather/SampleWeatherSource.scala @@ -65,15 +65,15 @@ final class SampleWeatherSource( private def getWeather( tick: Long ): WeatherData = { - val wallClockTime = tick.toDateTime - val month = wallClockTime.get(MONTH_OF_YEAR) - 1 - val hour = wallClockTime.get(HOUR_OF_DAY) + val simulationTime = tick.toDateTime + val month = simulationTime.get(MONTH_OF_YEAR) - 1 + val hour = simulationTime.get(HOUR_OF_DAY) val year = if ( - wallClockTime.get(YEAR) != 2011 && !(wallClockTime + simulationTime.get(YEAR) != 2011 && !(simulationTime .get(YEAR) == 2012 && month == 0) ) 2011 - else wallClockTime.get(YEAR) + else simulationTime.get(YEAR) val index = (((year - 2011) * 288) + (month * 24) + hour) + 1 WeatherData( WattsPerSquareMeter( diff --git a/src/test/scala/edu/ie3/simona/agent/participant/ParticipantAgentMock.scala b/src/test/scala/edu/ie3/simona/agent/participant/ParticipantAgentMock.scala index c3c77e2292..3e17e76ccb 100644 --- a/src/test/scala/edu/ie3/simona/agent/participant/ParticipantAgentMock.scala +++ b/src/test/scala/edu/ie3/simona/agent/participant/ParticipantAgentMock.scala @@ -260,9 +260,9 @@ class ParticipantAgentMock( * @param modelConfig * Configuration for the model * @param simulationStartDate - * Wall clock time of first instant in simulation + * The simulation time at which the simulation starts * @param simulationEndDate - * Wall clock time of last instant in simulation + * The simulation time at which the simulation ends * @return */ override def buildModel( From 2a72bc6a2bbe12aa60442b9278473d9eee101ada Mon Sep 17 00:00:00 2001 From: Sebastian Peter Date: Fri, 22 Nov 2024 18:59:27 +0100 Subject: [PATCH 143/165] Updating config documentation Signed-off-by: Sebastian Peter --- CHANGELOG.md | 1 + docs/readthedocs/config.md | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76a0624832..f588d40713 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add some quote to 'printGoodbye' [#997](https://github.com/ie3-institute/simona/issues/997) - Add unapply method for ThermalHouseResults [#934](https://github.com/ie3-institute/simona/issues/934) - Added `ApparentPower` to differentiate between different power types [#794](https://github.com/ie3-institute/simona/issues/794) +- Update/enhance config documentation [#1013](https://github.com/ie3-institute/simona/issues/1013) ### Changed - Adapted to changed data source in PSDM [#435](https://github.com/ie3-institute/simona/issues/435) diff --git a/docs/readthedocs/config.md b/docs/readthedocs/config.md index 45deee0778..f6e968659a 100644 --- a/docs/readthedocs/config.md +++ b/docs/readthedocs/config.md @@ -12,15 +12,13 @@ To create the output directory name, the name of the simulation is used as a str `simona.simulationName = "vn_simona"` ### Time parameters -Starting date and time of the simulation - - Format: "YYYY-MM-DD HH:MM:SS" +Starting date and time of the simulation in ISO-8601 date and time format with offset - `simona.time.startDateTime = "2011-01-01 00:00:00"` + `simona.time.startDateTime = "2011-01-01T00:00:00Z"` -Ending date and time of the simulation - - Format: "YYYY-MM-DD HH:MM:SS" +Ending date and time of the simulation in ISO-8601 date and time format with offset - `simona.time.endDateTime = "2011-01-01 02:00:00"` + `simona.time.endDateTime = "2011-01-01T02:00:00Z"` The preset ReadyCheckWindow should be maintained @@ -39,7 +37,9 @@ Setting of the data source `simona.input.grid.datasource.id = "csv"` -Specify the folder path containing the csv data of the grid components and the csv separator (e.g. "," or ";") +Specify the folder path containing the csv data of the grid components and the csv separator (e.g. "," or ";"). +The directory structure is determined by the boolean `isHierarchic`. +If files are placed within [a specific set of subdirectories](https://powersystemdatamodel.readthedocs.io/en/latest/io/csvfiles.html#default-directory-hierarchy), `isHierarchic: true` needs to be set. ``` simona.input.primary.csvParams = { From 6a991077ff501aec66228d296daacf5fddc622a7 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Sun, 24 Nov 2024 10:33:47 +0100 Subject: [PATCH 144/165] Introduce ThermalDemandWrapper --- CHANGELOG.md | 1 + .../simona/model/participant/HpModel.scala | 87 +++++++++---------- .../simona/model/thermal/ThermalGrid.scala | 33 +++++-- .../model/thermal/ThermalGridTestData.scala | 24 ++++- .../ThermalGridWithHouseAndStorageSpec.scala | 10 ++- .../ThermalGridWithHouseOnlySpec.scala | 7 +- .../ThermalGridWithStorageOnlySpec.scala | 8 +- 7 files changed, 111 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44290c1dd2..c23f6be1da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add unapply method for ThermalHouseResults [#934](https://github.com/ie3-institute/simona/issues/934) - Added `ApparentPower` to differentiate between different power types [#794](https://github.com/ie3-institute/simona/issues/794) - Update/enhance config documentation [#1013](https://github.com/ie3-institute/simona/issues/1013) +- Introduce ThermalDemandWrapper [#1049](https://github.com/ie3-institute/simona/issues/1049) ### Changed - Adapted to changed data source in PSDM [#435](https://github.com/ie3-institute/simona/issues/435) diff --git a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala index 98d18d9ce3..9a3dd773aa 100644 --- a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala +++ b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala @@ -12,7 +12,7 @@ import edu.ie3.simona.model.SystemComponent import edu.ie3.simona.model.participant.HpModel.{HpRelevantData, HpState} import edu.ie3.simona.model.participant.control.QControl import edu.ie3.simona.model.thermal.ThermalGrid.{ - ThermalEnergyDemand, + ThermalDemandWrapper, ThermalGridState, } import edu.ie3.simona.model.thermal.{ThermalGrid, ThermalThreshold} @@ -132,7 +132,7 @@ final case class HpModel( ): (Boolean, Boolean, HpState) = { // Use lastHpState and relevantData to update state of thermalGrid to the current tick - val (demandHouse, demandThermalStorage, currentThermalGridState) = + val (thermalDemandWrapper, currentThermalGridState) = thermalGrid.energyDemandAndUpdatedState( relevantData.currentTick, lastHpState.ambientTemperature.getOrElse( @@ -148,13 +148,12 @@ final case class HpModel( lastHpState, currentThermalGridState, relevantData, - demandHouse, - demandThermalStorage, + thermalDemandWrapper, ) // Updating the HpState val updatedState = - calcState(lastHpState, relevantData, turnOn) + calcState(lastHpState, relevantData, turnOn, thermalDemandWrapper) (canOperate, canBeOutOfOperation, updatedState) } @@ -170,10 +169,8 @@ final case class HpModel( * to current tick updated state of the thermalGrid * @param relevantData * Relevant (external) data - * @param demandHouse - * ThermalEnergyDemand of the house - * @param demandThermalStorage - * ThermalEnergyDemand of the thermal storage + * @param thermalDemands + * ThermalEnergyDemand of the house and the thermal storage * @return * boolean defining if heat pump runs in next time step, if it can be in * operation and can be out of operation @@ -182,23 +179,21 @@ final case class HpModel( lastState: HpState, currentThermalGridState: ThermalGridState, relevantData: HpRelevantData, - demandHouse: ThermalEnergyDemand, - demandThermalStorage: ThermalEnergyDemand, + thermalDemands: ThermalDemandWrapper, ): (Boolean, Boolean, Boolean) = { - val ( - houseHasDemand, - heatStorageHasDemand, - noThermalStorageOrThermalStorageIsEmpty, - ) = determineDemandBooleans( - lastState, - currentThermalGridState, - demandHouse, - demandThermalStorage, + val demandHouse = thermalDemands.houseDemand + val demandThermalStorage = thermalDemands.heatStorageDemand + + val noThermalStorageOrThermalStorageIsEmpty = determineThermalStorageStatus( + currentThermalGridState ) - val turnHpOn: Boolean = - houseHasDemand || heatStorageHasDemand + val turnHpOn = + (demandHouse.hasRequiredDemand && noThermalStorageOrThermalStorageIsEmpty) || + (demandHouse.hasAdditionalDemand && lastState.isRunning) || + demandThermalStorage.hasRequiredDemand || + (demandThermalStorage.hasAdditionalDemand && lastState.isRunning) val canOperate = demandHouse.hasRequiredDemand || demandHouse.hasAdditionalDemand || @@ -206,33 +201,26 @@ final case class HpModel( val canBeOutOfOperation = !(demandHouse.hasRequiredDemand && noThermalStorageOrThermalStorageIsEmpty) - (turnHpOn, canOperate, canBeOutOfOperation) + ( + turnHpOn, + canOperate, + canBeOutOfOperation, + ) } /** This method will return booleans whether there is a heat demand of house * or thermal storage as well as a boolean indicating if there is no thermal * storage, or it is empty. * - * @param lastHpState - * Current state of the heat pump * @param updatedGridState * The updated state of the [[ThermalGrid]] - * @param demandHouse - * heat demand of the thermal house - * @param demandThermalStorage - * heat demand of the thermal storage * @return - * First boolean is true, if house has heat demand. Second boolean is true, - * if thermalStorage has heat demand. Third boolean is true, if there is no - * thermalStorage, or it's empty. + * boolean which is true, if there is no thermalStorage, or it's empty. */ - private def determineDemandBooleans( - lastHpState: HpState, - updatedGridState: ThermalGridState, - demandHouse: ThermalEnergyDemand, - demandThermalStorage: ThermalEnergyDemand, - ): (Boolean, Boolean, Boolean) = { + private def determineThermalStorageStatus( + updatedGridState: ThermalGridState + ): Boolean = { implicit val tolerance: Energy = KilowattHours(1e-3) val noThermalStorageOrThermalStorageIsEmpty: Boolean = updatedGridState.storageState.isEmpty || updatedGridState.storageState @@ -240,11 +228,7 @@ final case class HpModel( _.storedEnergy =~ zeroKWh ) - val houseDemand = - (demandHouse.hasRequiredDemand && noThermalStorageOrThermalStorageIsEmpty) || (lastHpState.isRunning && demandHouse.hasAdditionalDemand) - val heatStorageDemand = - demandThermalStorage.hasRequiredDemand || (lastHpState.isRunning && demandThermalStorage.hasAdditionalDemand) - (houseDemand, heatStorageDemand, noThermalStorageOrThermalStorageIsEmpty) + noThermalStorageOrThermalStorageIsEmpty } /** Calculate state depending on whether heat pump is needed or not. Also @@ -257,6 +241,8 @@ final case class HpModel( * data of heat pump including state of the heat pump * @param isRunning * determines whether the heat pump is running or not + * @param demandWrapper + * holds the thermal demands of the thermal units (house, storage) * @return * next [[HpState]] */ @@ -264,6 +250,7 @@ final case class HpModel( lastState: HpState, relevantData: HpRelevantData, isRunning: Boolean, + demandWrapper: ThermalDemandWrapper, ): HpState = { val lastStateStorageQDot = lastState.thermalGridState.storageState .map(_.qDot) @@ -346,13 +333,25 @@ final case class HpModel( lastState: HpState, setPower: Power, ): (HpState, FlexChangeIndicator) = { - /* If the setpoint value is above 50 % of the electrical power, turn on the heat pump otherwise turn it off */ + /* If the set point value is above 50 % of the electrical power, turn on the heat pump otherwise turn it off */ val turnOn = setPower > (sRated.toActivePower(cosPhiRated) * 0.5) + val ( + thermalDemands, + _, + ) = + thermalGrid.energyDemandAndUpdatedState( + data.currentTick, + lastState.ambientTemperature.getOrElse(data.ambientTemperature), + data.ambientTemperature, + lastState.thermalGridState, + ) + val updatedHpState = calcState( lastState, data, turnOn, + thermalDemands, ) ( diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala index 50f56e1849..6116783509 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala @@ -15,6 +15,7 @@ import edu.ie3.datamodel.models.result.thermal.{ } import edu.ie3.simona.exceptions.agent.InconsistentStateException import edu.ie3.simona.model.thermal.ThermalGrid.{ + ThermalDemandWrapper, ThermalEnergyDemand, ThermalGridState, } @@ -63,7 +64,7 @@ final case class ThermalGrid( lastAmbientTemperature: Temperature, ambientTemperature: Temperature, state: ThermalGridState, - ): (ThermalEnergyDemand, ThermalEnergyDemand, ThermalGridState) = { + ): (ThermalDemandWrapper, ThermalGridState) = { /* First get the energy demand of the houses but only if inner temperature is below target temperature */ val (houseDemand, updatedHouseState) = @@ -134,13 +135,15 @@ final case class ThermalGrid( } ( - ThermalEnergyDemand( - houseDemand.required, - houseDemand.possible, - ), - ThermalEnergyDemand( - storageDemand.required, - storageDemand.possible, + ThermalDemandWrapper( + ThermalEnergyDemand( + houseDemand.required, + houseDemand.possible, + ), + ThermalEnergyDemand( + storageDemand.required, + storageDemand.possible, + ), ), ThermalGridState(updatedHouseState, updatedStorageState), ) @@ -191,6 +194,8 @@ final case class ThermalGrid( * Current state of the houses * @param qDot * Infeed to the grid + * @param thermalDemands + * holds the thermal demands of the thermal units (house, storage) * @return * Updated thermal grid state */ @@ -540,6 +545,18 @@ object ThermalGrid { thermalGrid.storage.map(_.startingState), ) + /** Wraps the demand of thermal units (thermal house, thermal storage). + * + * @param houseDemand + * the demand of the thermal house + * @param heatStorageDemand + * the demand of the thermal heat storage + */ + final case class ThermalDemandWrapper private ( + houseDemand: ThermalEnergyDemand, + heatStorageDemand: ThermalEnergyDemand, + ) + /** Defines the thermal energy demand of a thermal grid. It comprises the * absolutely required energy demand to reach the target state as well as an * energy, that can be handled. The possible energy always has to be greater diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridTestData.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridTestData.scala index 6011c6caf2..df410786c5 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridTestData.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridTestData.scala @@ -9,7 +9,12 @@ package edu.ie3.simona.model.thermal import edu.ie3.datamodel.models.OperationTime import edu.ie3.datamodel.models.input.OperatorInput import edu.ie3.datamodel.models.input.thermal.ThermalBusInput -import squants.energy.{Kilowatts, Power} +import edu.ie3.simona.model.thermal.ThermalGrid.{ + ThermalDemandWrapper, + ThermalEnergyDemand, +} +import edu.ie3.util.scala.quantities.DefaultQuantities.zeroKWh +import squants.energy.{KilowattHours, Kilowatts, Power} import squants.thermal.{Celsius, Temperature} import java.util.UUID @@ -25,4 +30,21 @@ trait ThermalGridTestData { protected val testGridQDotInfeed: Power = Kilowatts(15d) protected val testGridQDotConsumption: Power = Kilowatts(-42d) protected val testGridQDotConsumptionHigh: Power = Kilowatts(-200d) + protected val noThermalDemand: ThermalDemandWrapper = + ThermalDemandWrapper( + ThermalEnergyDemand(zeroKWh, zeroKWh), + ThermalEnergyDemand(zeroKWh, zeroKWh), + ) + protected val onlyThermalDemandOfHouse: ThermalDemandWrapper = + ThermalDemandWrapper( + ThermalEnergyDemand(KilowattHours(1), KilowattHours(2)), + ThermalEnergyDemand(zeroKWh, zeroKWh), + ) + protected val onlyThermalDemandOfHeatStorage: ThermalDemandWrapper = + ThermalDemandWrapper( + ThermalEnergyDemand(zeroKWh, zeroKWh), + ThermalEnergyDemand(KilowattHours(1), KilowattHours(2)), + ) + protected val isRunning: Boolean = true + protected val isNotRunning: Boolean = false } diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala index 7d8d2c27f1..cc35927238 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala @@ -20,6 +20,7 @@ import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageThreshold.{ StorageFull, } import edu.ie3.simona.test.common.UnitSpec +import edu.ie3.util.scala.quantities.DefaultQuantities.{zeroKW, zeroKWh} import squants.energy._ import squants.thermal.Celsius import squants.{Energy, Kelvin, Power, Temperature} @@ -97,13 +98,16 @@ class ThermalGridWithHouseAndStorageSpec "deliver the house demand (no demand) with added flexibility by storage" in { val tick = 10800 // after three hours - val (houseDemand, storageDemand, updatedThermalGridState) = + val (thermalDemands, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( tick, testGridAmbientTemperature, testGridAmbientTemperature, ThermalGrid.startingState(thermalGrid), ) + val houseDemand = thermalDemands.houseDemand + val storageDemand = thermalDemands.heatStorageDemand + houseDemand.required should approximate(zeroKWh) houseDemand.possible should approximate(KilowattHours(31.05009722d)) storageDemand.required should approximate(KilowattHours(1150d)) @@ -120,7 +124,7 @@ class ThermalGridWithHouseAndStorageSpec val tick = 10800 // after three hours val startingState = ThermalGrid.startingState(thermalGrid) - val (houseDemand, storageDemand, updatedThermalGridState) = + val (thermalDemands, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( tick, testGridAmbientTemperature, @@ -131,6 +135,8 @@ class ThermalGridWithHouseAndStorageSpec ) ), ) + val houseDemand = thermalDemands.houseDemand + val storageDemand = thermalDemands.heatStorageDemand houseDemand.required should approximate(KilowattHours(45.6000555)) houseDemand.possible should approximate(KilowattHours(75.600055555)) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala index 6b14ee3780..14e76434b9 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala @@ -13,8 +13,8 @@ import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{ HouseTemperatureLowerBoundaryReached, HouseTemperatureUpperBoundaryReached, } -import edu.ie3.util.scala.quantities.DefaultQuantities.{zeroKW, zeroKWh} import edu.ie3.simona.test.common.UnitSpec +import edu.ie3.util.scala.quantities.DefaultQuantities.{zeroKW, zeroKWh} import squants.energy._ import squants.thermal.Celsius import squants.{Energy, Kelvin, Power, Temperature} @@ -81,7 +81,7 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { expectedHouseStartingState, ) - val (houseDemand, storageDemand, updatedThermalGridState) = + val (thermalDemands, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( tick, testGridAmbientTemperature, @@ -89,6 +89,9 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { ThermalGrid.startingState(thermalGrid), ) + val houseDemand = thermalDemands.houseDemand + val storageDemand = thermalDemands.heatStorageDemand + houseDemand.required should approximate(expectedHouseDemand.required) houseDemand.possible should approximate(expectedHouseDemand.possible) storageDemand.required should approximate(zeroKWh) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala index ead1ff6b03..b8aaae8d9d 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala @@ -81,13 +81,15 @@ class ThermalGridWithStorageOnlySpec "deliver the capabilities of the storage" in { val tick = 10800 // after three hours - val (houseDemand, storageDemand, updatedThermalGridState) = + val (thermalDemands, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( tick, testGridAmbientTemperature, testGridAmbientTemperature, ThermalGrid.startingState(thermalGrid), ) + val houseDemand = thermalDemands.houseDemand + val storageDemand = thermalDemands.heatStorageDemand houseDemand.required should approximate(zeroKWh) houseDemand.possible should approximate(zeroKWh) @@ -102,7 +104,7 @@ class ThermalGridWithStorageOnlySpec "deliver the capabilities of a half full storage" in { val tick = 10800 // after three hours - val (houseDemand, storageDemand, updatedThermalGridState) = + val (thermalDemands, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( tick, testGridAmbientTemperature, @@ -112,6 +114,8 @@ class ThermalGridWithStorageOnlySpec Some(ThermalStorageState(0L, KilowattHours(575d), zeroKW)), ), ) + val houseDemand = thermalDemands.houseDemand + val storageDemand = thermalDemands.heatStorageDemand houseDemand.required should approximate(zeroKWh) houseDemand.possible should approximate(zeroKWh) From 5280971ae9fb4f262c7f5d5ad1d9d3aabc9c9930 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Sun, 24 Nov 2024 11:05:19 +0100 Subject: [PATCH 145/165] Refactor thermal calcRelevantData --- CHANGELOG.md | 1 + .../simona/model/participant/HpModel.scala | 6 +- .../simona/model/thermal/ThermalGrid.scala | 93 ++++++++----------- .../simona/model/thermal/ThermalHouse.scala | 34 +++---- .../ThermalGridWithHouseAndStorageSpec.scala | 78 +++++++++------- .../ThermalGridWithHouseOnlySpec.scala | 23 ++--- .../ThermalGridWithStorageOnlySpec.scala | 29 +++--- 7 files changed, 129 insertions(+), 135 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44290c1dd2..e8c5efd272 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactor `ResultFileHierarchy` [#1031](https://github.com/ie3-institute/simona/issues/1031) - Removing logs in `logs/simona` [#1017](https://github.com/ie3-institute/simona/issues/1017) - Fix implausible test cases of HpModelSpec [#1042](https://github.com/ie3-institute/simona/issues/1042) +- Refactor thermal calcRelevantData [#1051](https://github.com/ie3-institute/simona/issues/1051) ### Fixed - Fix rendering of references in documentation [#505](https://github.com/ie3-institute/simona/issues/505) diff --git a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala index 98d18d9ce3..860a1efe72 100644 --- a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala +++ b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala @@ -134,11 +134,10 @@ final case class HpModel( // Use lastHpState and relevantData to update state of thermalGrid to the current tick val (demandHouse, demandThermalStorage, currentThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - relevantData.currentTick, + relevantData, lastHpState.ambientTemperature.getOrElse( relevantData.ambientTemperature ), - relevantData.ambientTemperature, lastHpState.thermalGridState, ) @@ -279,10 +278,9 @@ final case class HpModel( /* Push thermal energy to the thermal grid and get its updated state in return */ val (thermalGridState, maybeThreshold) = thermalGrid.updateState( - relevantData.currentTick, + relevantData, lastState.thermalGridState, lastState.ambientTemperature.getOrElse(relevantData.ambientTemperature), - relevantData.ambientTemperature, newThermalPower, ) diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala index 50f56e1849..ff9339c2b8 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala @@ -14,6 +14,7 @@ import edu.ie3.datamodel.models.result.thermal.{ ThermalHouseResult, } import edu.ie3.simona.exceptions.agent.InconsistentStateException +import edu.ie3.simona.model.participant.HpModel.HpRelevantData import edu.ie3.simona.model.thermal.ThermalGrid.{ ThermalEnergyDemand, ThermalGridState, @@ -44,13 +45,10 @@ final case class ThermalGrid( /** Determine the energy demand of the total grid at the given instance in * time and returns it including the updatedState - * - * @param tick - * Questioned instance in time + * @param relevantData + * data of heat pump including state of the heat pump * @param lastAmbientTemperature * Ambient temperature until this tick - * @param ambientTemperature - * Ambient temperature in the instance in question * @param state * Currently applicable state of the thermal grid * @return @@ -58,10 +56,9 @@ final case class ThermalGrid( * [[ThermalGridState]] */ def energyDemandAndUpdatedState( - tick: Long, + relevantData: HpRelevantData, // FIXME this is also in state lastAmbientTemperature: Temperature, - ambientTemperature: Temperature, state: ThermalGridState, ): (ThermalEnergyDemand, ThermalEnergyDemand, ThermalGridState) = { /* First get the energy demand of the houses but only if inner temperature is below target temperature */ @@ -71,10 +68,9 @@ final case class ThermalGrid( case Some((thermalHouse, lastHouseState)) => val (updatedHouseState, _) = thermalHouse.determineState( - tick, + relevantData, lastHouseState, lastAmbientTemperature, - ambientTemperature, lastHouseState.qDot, ) if ( @@ -83,8 +79,7 @@ final case class ThermalGrid( ) { ( thermalHouse.energyDemand( - tick, - ambientTemperature, + relevantData, updatedHouseState, ), Some(updatedHouseState), @@ -105,7 +100,7 @@ final case class ThermalGrid( .zip(state.storageState) .map { case (storage, state) => val (updatedStorageState, _) = - storage.updateState(tick, state.qDot, state) + storage.updateState(relevantData.currentTick, state.qDot, state) val storedEnergy = updatedStorageState.storedEnergy val soc = storedEnergy / storage.getMaxEnergyThreshold val storageRequired = { @@ -148,32 +143,28 @@ final case class ThermalGrid( /** Update the current state of the grid * - * @param tick - * Instance in time + * @param relevantData + * data of heat pump including state of the heat pump * @param state * Currently applicable state * @param lastAmbientTemperature * Ambient temperature valid up until (not including) the current tick - * @param ambientTemperature - * Current ambient temperature * @param qDot * Thermal energy balance * @return * The updated state of the grid */ def updateState( - tick: Long, + relevantData: HpRelevantData, state: ThermalGridState, lastAmbientTemperature: Temperature, - ambientTemperature: Temperature, qDot: Power, ): (ThermalGridState, Option[ThermalThreshold]) = if (qDot > zeroKW) - handleInfeed(tick, lastAmbientTemperature, ambientTemperature, state, qDot) + handleInfeed(relevantData, lastAmbientTemperature, state, qDot) else handleConsumption( - tick, + relevantData, lastAmbientTemperature, - ambientTemperature, state, qDot, ) @@ -181,12 +172,10 @@ final case class ThermalGrid( /** Handles the case, when a grid has infeed. First, heat up all the houses to * their maximum temperature, then fill up the storages * - * @param tick - * Current tick + * @param relevantData + * data of heat pump including state of the heat pump * @param lastAmbientTemperature * Ambient temperature valid up until (not including) the current tick - * @param ambientTemperature - * Current ambient temperature * @param state * Current state of the houses * @param qDot @@ -195,9 +184,8 @@ final case class ThermalGrid( * Updated thermal grid state */ private def handleInfeed( - tick: Long, + relevantData: HpRelevantData, lastAmbientTemperature: Temperature, - ambientTemperature: Temperature, state: ThermalGridState, qDot: Power, ): (ThermalGridState, Option[ThermalThreshold]) = @@ -210,7 +198,7 @@ final case class ThermalGrid( Some( thermalStorage .updateState( - tick, + relevantData.currentTick, zeroKW, storageState, ) @@ -221,10 +209,9 @@ final case class ThermalGrid( val (updatedHouseState, maybeHouseThreshold) = thermalHouse.determineState( - tick, + relevantData, lastHouseState, lastAmbientTemperature, - ambientTemperature, qDot, ) @@ -236,16 +223,19 @@ final case class ThermalGrid( /* The house is already heated up fully, set back the infeed and put it into storage, if available */ val (fullHouseState, maybeFullHouseThreshold) = thermalHouse.determineState( - tick, + relevantData, lastHouseState, lastAmbientTemperature, - ambientTemperature, zeroKW, ) storage.zip(updatedStorageState) match { case Some((thermalStorage, storageState)) => val (updatedStorageState, maybeStorageThreshold) = - thermalStorage.updateState(tick, qDot, storageState) + thermalStorage.updateState( + relevantData.currentTick, + qDot, + storageState, + ) /* Both house and storage are updated. Determine what reaches the next threshold */ val nextThreshold = determineMostRecentThreshold( @@ -279,7 +269,11 @@ final case class ThermalGrid( storage.zip(state.storageState) match { case Some((thermalStorage, storageState)) => val (updatedStorageState, maybeStorageThreshold) = - thermalStorage.updateState(tick, qDot, storageState) + thermalStorage.updateState( + relevantData.currentTick, + qDot, + storageState, + ) ( state.copy(storageState = Some(updatedStorageState)), maybeStorageThreshold, @@ -308,12 +302,10 @@ final case class ThermalGrid( /** Handle consumption (or no infeed) from thermal grid * - * @param tick - * Current tick + * @param relevantData + * data of heat pump including state of the heat pump * @param lastAmbientTemperature * Ambient temperature valid up until (not including) the current tick - * @param ambientTemperature - * Current ambient temperature * @param state * Current state of the houses * @param qDot @@ -322,9 +314,8 @@ final case class ThermalGrid( * Updated thermal grid state */ private def handleConsumption( - tick: Long, + relevantData: HpRelevantData, lastAmbientTemperature: Temperature, - ambientTemperature: Temperature, state: ThermalGridState, qDot: Power, ): (ThermalGridState, Option[ThermalThreshold]) = { @@ -332,10 +323,9 @@ final case class ThermalGrid( val maybeUpdatedHouseState = house.zip(state.houseState).map { case (house, houseState) => house.determineState( - tick, + relevantData, houseState, lastAmbientTemperature, - ambientTemperature, zeroMW, ) } @@ -343,18 +333,17 @@ final case class ThermalGrid( /* Update the state of the storage */ val maybeUpdatedStorageState = storage.zip(state.storageState).map { case (storage, storageState) => - storage.updateState(tick, qDot, storageState) + storage.updateState(relevantData.currentTick, qDot, storageState) } val (revisedHouseState, revisedStorageState) = reviseInfeedFromStorage( - tick, + relevantData, maybeUpdatedHouseState, maybeUpdatedStorageState, state.houseState, state.storageState, lastAmbientTemperature, - ambientTemperature, qDot, ) @@ -377,8 +366,8 @@ final case class ThermalGrid( * is no infeed from external and
  • the storage is not empty * itself
  • * - * @param tick - * The current tick + * @param relevantData + * data of heat pump including state of the heat pump * @param maybeHouseState * Optional thermal house state * @param maybeStorageState @@ -389,15 +378,13 @@ final case class ThermalGrid( * Previous thermal storage state before a first update was performed * @param lastAmbientTemperature * Ambient temperature valid up until (not including) the current tick - * @param ambientTemperature - * Current ambient temperature * @param qDot * Thermal influx * @return * Options to revised thermal house and storage state */ def reviseInfeedFromStorage( - tick: Long, + relevantData: HpRelevantData, maybeHouseState: Option[(ThermalHouseState, Option[ThermalThreshold])], maybeStorageState: Option[ (ThermalStorageState, Option[ThermalThreshold]) @@ -405,7 +392,6 @@ final case class ThermalGrid( formerHouseState: Option[ThermalHouseState], formerStorageState: Option[ThermalStorageState], lastAmbientTemperature: Temperature, - ambientTemperature: Temperature, qDot: Power, ): ( Option[(ThermalHouseState, Option[ThermalThreshold])], @@ -423,7 +409,7 @@ final case class ThermalGrid( ) && !thermalStorage.isEmpty(storageState.storedEnergy) => /* Storage is meant to heat the house only, if there is no infeed from external (+/- 10 W) and the house is cold */ val revisedStorageState = thermalStorage.updateState( - tick, + relevantData.currentTick, thermalStorage.getChargingPower * -1, formerStorageState.getOrElse( throw new InconsistentStateException( @@ -432,14 +418,13 @@ final case class ThermalGrid( ), ) val revisedHouseState = thermalHouse.determineState( - tick, + relevantData, formerHouseState.getOrElse( throw new InconsistentStateException( "Impossible to find no house state" ) ), lastAmbientTemperature, - ambientTemperature, thermalStorage.getChargingPower, ) (Some(revisedHouseState), Some(revisedStorageState)) diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalHouse.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalHouse.scala index e0fd7024f7..4296efa1ae 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalHouse.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalHouse.scala @@ -12,6 +12,7 @@ import edu.ie3.datamodel.models.input.thermal.{ ThermalBusInput, ThermalHouseInput, } +import edu.ie3.simona.model.participant.HpModel.HpRelevantData import edu.ie3.simona.model.thermal.ThermalGrid.ThermalEnergyDemand import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{ HouseTemperatureLowerBoundaryReached, @@ -82,27 +83,24 @@ final case class ThermalHouse( * determining the thermal demand, a change in external infeed will take * place. * - * @param tick - * Questionable tick - * @param ambientTemperature - * Ambient temperature in the instance in question + * @param relevantData + * data of heat pump including state of the heat pump * @param state * most recent state, that is valid for this model * @return * the needed energy in the questioned tick */ def energyDemand( - tick: Long, - ambientTemperature: Temperature, + relevantData: HpRelevantData, state: ThermalHouseState, ): ThermalEnergyDemand = { /* Calculate the inner temperature of the house, at the questioned instance in time */ - val duration = Seconds(tick - state.tick) + val duration = Seconds(relevantData.currentTick - state.tick) val currentInnerTemp = newInnerTemperature( state.qDot, duration, state.innerTemperature, - ambientTemperature, + relevantData.ambientTemperature, ) /* Determine, which temperature boundary triggers a needed energy to reach the temperature constraints */ @@ -219,27 +217,24 @@ final case class ThermalHouse( /** Update the current state of the house * - * @param tick - * Current instance in time + * @param relevantData + * data of heat pump including state of the heat pump * @param state * Currently applicable state * @param lastAmbientTemperature * Ambient temperature valid up until (not including) the current tick - * @param ambientTemperature - * Current ambient temperature * @param qDot * New thermal influx * @return * Updated state and the tick in which the next threshold is reached */ def determineState( - tick: Long, + relevantData: HpRelevantData, state: ThermalHouseState, lastAmbientTemperature: Temperature, - ambientTemperature: Temperature, qDot: Power, ): (ThermalHouseState, Option[ThermalThreshold]) = { - val duration = Seconds(tick - state.tick) + val duration = Seconds(relevantData.currentTick - state.tick) val updatedInnerTemperature = newInnerTemperature( state.qDot, duration, @@ -249,11 +244,16 @@ final case class ThermalHouse( /* Calculate the next given threshold */ val threshold = - nextThreshold(tick, qDot, updatedInnerTemperature, ambientTemperature) + nextThreshold( + relevantData.currentTick, + qDot, + updatedInnerTemperature, + relevantData.ambientTemperature, + ) ( state.copy( - tick = tick, + tick = relevantData.currentTick, innerTemperature = updatedInnerTemperature, qDot = qDot, ), diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala index 7d8d2c27f1..19ba70f680 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala @@ -7,6 +7,7 @@ package edu.ie3.simona.model.thermal import edu.ie3.datamodel.models.input.thermal.ThermalStorageInput +import edu.ie3.simona.model.participant.HpModel.HpRelevantData import edu.ie3.simona.model.thermal.ThermalGrid.ThermalGridState import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseState import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{ @@ -95,12 +96,13 @@ class ThermalGridWithHouseAndStorageSpec "determining the energy demand" should { "deliver the house demand (no demand) with added flexibility by storage" in { - val tick = 10800 // after three hours - + val relevantData = HpRelevantData( + 10800, // after three hours + testGridAmbientTemperature, + ) val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, ThermalGrid.startingState(thermalGrid), ) @@ -117,13 +119,15 @@ class ThermalGridWithHouseAndStorageSpec } "deliver the correct house and storage demand" in { - val tick = 10800 // after three hours + val relevantData = HpRelevantData( + 10800, // after three hours + testGridAmbientTemperature, + ) val startingState = ThermalGrid.startingState(thermalGrid) val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, startingState.copy(houseState = startingState.houseState.map( @@ -189,7 +193,10 @@ class ThermalGridWithHouseAndStorageSpec } "take energy from storage, if there is actual consumption" in { - val tick = 0L + val relevantData = HpRelevantData( + 0L, + testGridAmbientTemperature, + ) val initialGridState = ThermalGrid.startingState(thermalGrid) val initialLoading = KilowattHours(200d) val gridState = initialGridState.copy(storageState = @@ -201,8 +208,7 @@ class ThermalGridWithHouseAndStorageSpec val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleConsumption( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, gridState, externalQDot, @@ -230,13 +236,16 @@ class ThermalGridWithHouseAndStorageSpec "revising infeed from storage to house" should { val zeroInflux = zeroKW - val tick = 3600L + val relevantData = HpRelevantData( + 3600, + testGridAmbientTemperature, + ) val ambientTemperature = Celsius(14d) "hand back unaltered information if needed information is missing" in { val maybeHouseState = Some( ( ThermalHouseState( - tick, + relevantData.currentTick, Celsius( thermalHouseInput.getTargetTemperature .to(Units.CELSIUS) @@ -251,13 +260,12 @@ class ThermalGridWithHouseAndStorageSpec val maybeStorageState = None thermalGrid.reviseInfeedFromStorage( - tick, + relevantData, maybeHouseState, maybeStorageState, maybeHouseState.map(_._1), None, testGridAmbientTemperature, - testGridAmbientTemperature, testGridQDotConsumption, ) match { case (maybeRevisedHouseState, maybeRevisedStorageState) => @@ -270,7 +278,7 @@ class ThermalGridWithHouseAndStorageSpec val maybeHouseState = Some( ( ThermalHouseState( - tick, + relevantData.currentTick, Celsius( thermalHouseInput.getTargetTemperature .to(Units.CELSIUS) @@ -285,7 +293,7 @@ class ThermalGridWithHouseAndStorageSpec val maybeStorageState = Some( ( ThermalStorageState( - tick, + relevantData.currentTick, KilowattHours(50d), zeroInflux, ), @@ -294,13 +302,12 @@ class ThermalGridWithHouseAndStorageSpec ) thermalGrid.reviseInfeedFromStorage( - tick, + relevantData, maybeHouseState, maybeStorageState, maybeHouseState.map(_._1), maybeStorageState.map(_._1), ambientTemperature, - ambientTemperature, zeroInflux, ) match { case (maybeRevisedHouseState, maybeRevisedStorageState) => @@ -313,7 +320,7 @@ class ThermalGridWithHouseAndStorageSpec val maybeHouseState = Some( ( ThermalHouseState( - tick, + relevantData.currentTick, Celsius( thermalHouseInput.getTargetTemperature .to(Units.CELSIUS) @@ -328,7 +335,7 @@ class ThermalGridWithHouseAndStorageSpec val maybeStorageState = Some( ( ThermalStorageState( - tick, + relevantData.currentTick, KilowattHours(50d), zeroInflux, ), @@ -337,13 +344,12 @@ class ThermalGridWithHouseAndStorageSpec ) thermalGrid.reviseInfeedFromStorage( - tick, + relevantData, maybeHouseState, maybeStorageState, maybeHouseState.map(_._1), maybeStorageState.map(_._1), ambientTemperature, - ambientTemperature, testGridQDotInfeed, ) match { case (maybeRevisedHouseState, maybeRevisedStorageState) => @@ -356,7 +362,7 @@ class ThermalGridWithHouseAndStorageSpec val maybeHouseState = Some( ( ThermalHouseState( - tick, + relevantData.currentTick, Celsius( thermalHouseInput.getLowerTemperatureLimit .to(Units.CELSIUS) @@ -365,28 +371,29 @@ class ThermalGridWithHouseAndStorageSpec ), zeroInflux, ), - Some(HouseTemperatureLowerBoundaryReached(tick)), + Some( + HouseTemperatureLowerBoundaryReached(relevantData.currentTick) + ), ) ) val maybeStorageState = Some( ( ThermalStorageState( - tick, + relevantData.currentTick, zeroKWh, testGridQDotInfeed, ), - Some(StorageEmpty(tick)), + Some(StorageEmpty(relevantData.currentTick)), ) ) thermalGrid.reviseInfeedFromStorage( - tick, + relevantData, maybeHouseState, maybeStorageState, maybeHouseState.map(_._1), maybeStorageState.map(_._1), ambientTemperature, - ambientTemperature, zeroInflux, ) match { case (maybeRevisedHouseState, maybeRevisedStorageState) => @@ -399,7 +406,7 @@ class ThermalGridWithHouseAndStorageSpec val maybeHouseState = Some( ( ThermalHouseState( - tick, + relevantData.currentTick, Celsius( thermalHouseInput.getLowerTemperatureLimit .to(Units.CELSIUS) @@ -408,13 +415,15 @@ class ThermalGridWithHouseAndStorageSpec ), zeroInflux, ), - Some(HouseTemperatureLowerBoundaryReached(tick)), + Some( + HouseTemperatureLowerBoundaryReached(relevantData.currentTick) + ), ) ) val maybeStorageState = Some( ( ThermalStorageState( - tick, + relevantData.currentTick, KilowattHours(20d), testGridQDotInfeed, ), @@ -442,13 +451,12 @@ class ThermalGridWithHouseAndStorageSpec ) thermalGrid.reviseInfeedFromStorage( - tick, + relevantData, maybeHouseState, maybeStorageState, formerHouseState, formerStorageState, ambientTemperature, - ambientTemperature, zeroInflux, ) match { case ( @@ -465,8 +473,8 @@ class ThermalGridWithHouseAndStorageSpec ) ), ) => - houseTick shouldBe tick - storageTick shouldBe tick + houseTick shouldBe relevantData.currentTick + storageTick shouldBe relevantData.currentTick revisedQDotHouse should approximate(thermalStorage.chargingPower) revisedQDotStorage should approximate( diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala index 6b14ee3780..b1c96ca41f 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala @@ -7,6 +7,7 @@ package edu.ie3.simona.model.thermal import edu.ie3.datamodel.models.input.thermal.ThermalStorageInput +import edu.ie3.simona.model.participant.HpModel.HpRelevantData import edu.ie3.simona.model.thermal.ThermalGrid.ThermalGridState import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseState import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{ @@ -74,17 +75,18 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { "determining the energy demand" should { "exactly be the demand of the house" in { - val tick = 10800 // after three hours - val expectedHouseDemand = thermalHouse.energyDemand( - tick, + val relevantData = HpRelevantData( + 10800, // after three hours testGridAmbientTemperature, + ) + val expectedHouseDemand = thermalHouse.energyDemand( + relevantData, expectedHouseStartingState, ) val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, ThermalGrid.startingState(thermalGrid), ) @@ -200,12 +202,13 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { } "updating the grid state dependent on the given thermal infeed" should { + val relevantData = HpRelevantData(0, testGridAmbientTemperature) "deliver proper result, if energy is fed into the grid" in { + thermalGrid.updateState( - 0L, + relevantData, ThermalGrid.startingState(thermalGrid), testGridAmbientTemperature, - testGridAmbientTemperature, testGridQDotInfeed, ) match { case ( @@ -225,10 +228,9 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { "deliver proper result, if energy is consumed from the grid" in { thermalGrid.updateState( - 0L, + relevantData, ThermalGrid.startingState(thermalGrid), testGridAmbientTemperature, - testGridAmbientTemperature, testGridQDotConsumption, ) match { case ( @@ -248,10 +250,9 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { "deliver proper result, if energy is neither consumed from nor fed into the grid" in { thermalGrid.updateState( - 0L, + relevantData, ThermalGrid.startingState(thermalGrid), testGridAmbientTemperature, - testGridAmbientTemperature, zeroKW, ) match { case ( diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala index ead1ff6b03..e686dfa7f2 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala @@ -10,6 +10,7 @@ import edu.ie3.datamodel.models.input.thermal.{ ThermalHouseInput, ThermalStorageInput, } +import edu.ie3.simona.model.participant.HpModel.HpRelevantData import edu.ie3.simona.model.thermal.ThermalGrid.ThermalGridState import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageState import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageThreshold.{ @@ -79,12 +80,13 @@ class ThermalGridWithStorageOnlySpec "determining the energy demand" should { "deliver the capabilities of the storage" in { - val tick = 10800 // after three hours - + val relevantData = HpRelevantData( + 10800, // after three hours + testGridAmbientTemperature, + ) val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, ThermalGrid.startingState(thermalGrid), ) @@ -100,12 +102,13 @@ class ThermalGridWithStorageOnlySpec } "deliver the capabilities of a half full storage" in { - val tick = 10800 // after three hours - + val relevantData = HpRelevantData( + 10800, // after three hours + testGridAmbientTemperature, + ) val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, ThermalGridState( None, @@ -201,12 +204,12 @@ class ThermalGridWithStorageOnlySpec } "updating the grid state dependent on the given thermal infeed" should { + val relevantData = HpRelevantData(0, testGridAmbientTemperature) "deliver proper result, if energy is fed into the grid" in { val (updatedState, nextThreshold) = thermalGrid.updateState( - 0L, + relevantData, ThermalGrid.startingState(thermalGrid), testGridAmbientTemperature, - testGridAmbientTemperature, testGridQDotInfeed, ) @@ -226,7 +229,7 @@ class ThermalGridWithStorageOnlySpec "deliver proper result, if energy is consumed from the grid" in { thermalGrid.updateState( - 0L, + relevantData, ThermalGrid .startingState(thermalGrid) .copy(storageState = @@ -239,7 +242,6 @@ class ThermalGridWithStorageOnlySpec ) ), testGridAmbientTemperature, - testGridAmbientTemperature, testGridQDotConsumptionHigh, ) match { case ( @@ -259,10 +261,9 @@ class ThermalGridWithStorageOnlySpec "deliver proper result, if energy is neither consumed from nor fed into the grid" in { val updatedState = thermalGrid.updateState( - 0L, + relevantData, ThermalGrid.startingState(thermalGrid), testGridAmbientTemperature, - testGridAmbientTemperature, zeroKW, ) updatedState match { From ca039183a35e8623d4c4c2dc17c80c63c4706ddf Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Sun, 24 Nov 2024 11:07:18 +0100 Subject: [PATCH 146/165] sonarQube --- src/main/scala/edu/ie3/simona/model/participant/HpModel.scala | 3 --- .../model/thermal/ThermalGridWithHouseAndStorageSpec.scala | 1 - 2 files changed, 4 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala index 9a3dd773aa..586006600f 100644 --- a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala +++ b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala @@ -241,8 +241,6 @@ final case class HpModel( * data of heat pump including state of the heat pump * @param isRunning * determines whether the heat pump is running or not - * @param demandWrapper - * holds the thermal demands of the thermal units (house, storage) * @return * next [[HpState]] */ @@ -250,7 +248,6 @@ final case class HpModel( lastState: HpState, relevantData: HpRelevantData, isRunning: Boolean, - demandWrapper: ThermalDemandWrapper, ): HpState = { val lastStateStorageQDot = lastState.thermalGridState.storageState .map(_.qDot) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala index cc35927238..88172c712f 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala @@ -13,7 +13,6 @@ import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{ HouseTemperatureLowerBoundaryReached, HouseTemperatureUpperBoundaryReached, } -import edu.ie3.util.scala.quantities.DefaultQuantities.{zeroKW, zeroKWh} import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageState import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageThreshold.{ StorageEmpty, From 6106ad7ba963801377017dfb0911237c63618071 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Sun, 24 Nov 2024 11:09:56 +0100 Subject: [PATCH 147/165] fix HpModel --- .../edu/ie3/simona/model/participant/HpModel.scala | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala index 586006600f..254d18f136 100644 --- a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala +++ b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala @@ -153,7 +153,7 @@ final case class HpModel( // Updating the HpState val updatedState = - calcState(lastHpState, relevantData, turnOn, thermalDemandWrapper) + calcState(lastHpState, relevantData, turnOn) (canOperate, canBeOutOfOperation, updatedState) } @@ -333,22 +333,10 @@ final case class HpModel( /* If the set point value is above 50 % of the electrical power, turn on the heat pump otherwise turn it off */ val turnOn = setPower > (sRated.toActivePower(cosPhiRated) * 0.5) - val ( - thermalDemands, - _, - ) = - thermalGrid.energyDemandAndUpdatedState( - data.currentTick, - lastState.ambientTemperature.getOrElse(data.ambientTemperature), - data.ambientTemperature, - lastState.thermalGridState, - ) - val updatedHpState = calcState( lastState, data, turnOn, - thermalDemands, ) ( From 47e38dd01000f11239c2be6b1ae860ab60af256d Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Sun, 24 Nov 2024 11:13:01 +0100 Subject: [PATCH 148/165] fix ThermalHouseSpec --- .../edu/ie3/simona/model/thermal/ThermalHouseSpec.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalHouseSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalHouseSpec.scala index f4a7c97574..4438036f06 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalHouseSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalHouseSpec.scala @@ -6,6 +6,7 @@ package edu.ie3.simona.model.thermal +import edu.ie3.simona.model.participant.HpModel.HpRelevantData import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.HouseTemperatureLowerBoundaryReached import edu.ie3.simona.model.thermal.ThermalHouse.{ ThermalHouseState, @@ -71,16 +72,16 @@ class ThermalHouseSpec extends UnitSpec with HpInputTestData { } "Check for the correct state of house when ambient temperature changes" in { + val ambientTemperature = Temperature(-20, Celsius) + val relevantData = HpRelevantData(3600, ambientTemperature) val house = thermalHouse(18, 22) val initialHousestate = startingState(house) val lastAmbientTemperature = Temperature(15, Celsius) - val ambientTemperature = Temperature(-20, Celsius) val (thermalHouseState, threshold) = house.determineState( - 3600L, + relevantData, initialHousestate, lastAmbientTemperature, - ambientTemperature, zeroKW, ) From 2000e2cc48ecedb31ed5ffc637280fcd8fcecfbf Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Sun, 24 Nov 2024 11:20:35 +0100 Subject: [PATCH 149/165] fix tests --- .../ThermalGridWithHouseAndStorageSpec.scala | 24 ++++++++++++------- .../ThermalGridWithHouseOnlySpec.scala | 24 ++++++++++++------- .../ThermalGridWithStorageOnlySpec.scala | 16 ++++++++----- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala index 19ba70f680..bdd6ba22da 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala @@ -156,7 +156,10 @@ class ThermalGridWithHouseAndStorageSpec ) "return house threshold, if storage is in balance" in { - val tick = 0L + val relevantData = HpRelevantData( + 0L, + testGridAmbientTemperature, + ) val initialGridState = ThermalGrid.startingState(thermalGrid) val initialLoading = KilowattHours(430d) val gridState = initialGridState.copy(storageState = @@ -168,8 +171,7 @@ class ThermalGridWithHouseAndStorageSpec val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleConsumption( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, gridState, externalQDot, @@ -495,14 +497,16 @@ class ThermalGridWithHouseAndStorageSpec ) "heat the house, if the upper temperature in the house is not reached" in { - val tick = 0L + val relevantData = HpRelevantData( + 0L, + testGridAmbientTemperature, + ) val initialGridState = ThermalGrid.startingState(thermalGrid) val externalQDot = testGridQDotInfeed val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleInfeed( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, initialGridState, externalQDot, @@ -536,7 +540,10 @@ class ThermalGridWithHouseAndStorageSpec } "load the storage, if the upper temperature in the house is reached" in { - val tick = 0L + val relevantData = HpRelevantData( + 0L, + testGridAmbientTemperature, + ) val initialGridState = ThermalGrid.startingState(thermalGrid) val gridState = initialGridState.copy(houseState = initialGridState.houseState.map( @@ -547,8 +554,7 @@ class ThermalGridWithHouseAndStorageSpec val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleInfeed( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, gridState, externalQDot, diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala index b1c96ca41f..f1593c5d40 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala @@ -109,14 +109,16 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { ) "deliver the house state by just letting it cool down, if just no infeed is given" in { - val tick = 0L + val relevantData = HpRelevantData( + 0L, + testGridAmbientTemperature, + ) val gridState = ThermalGrid.startingState(thermalGrid) val externalQDot = zeroKW val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleConsumption( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, gridState, externalQDot, @@ -138,13 +140,15 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { } "not withdraw energy from the house, if actual consumption is given" in { - val tick = 0L // after three hours + val relevantData = HpRelevantData( + 0L, + testGridAmbientTemperature, + ) val gridState = ThermalGrid.startingState(thermalGrid) val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleConsumption( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, gridState, testGridQDotConsumption, @@ -173,13 +177,15 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { ) "solely heat up the house" in { - val tick = 0L + val relevantData = HpRelevantData( + 0L, + testGridAmbientTemperature, + ) val gridState = ThermalGrid.startingState(thermalGrid) val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleInfeed( - tick, - testGridAmbientTemperature, + relevantData, testGridAmbientTemperature, gridState, testGridQDotInfeed, diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala index e686dfa7f2..8c9357ebba 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala @@ -134,7 +134,10 @@ class ThermalGridWithStorageOnlySpec ) "properly take the energy from storage" in { - val tick = 0L + val relevantData = HpRelevantData( + 0L, + testGridAmbientTemperature, + ) val gridState = ThermalGrid .startingState(thermalGrid) .copy(storageState = @@ -149,8 +152,7 @@ class ThermalGridWithStorageOnlySpec val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleConsumption( - tick, - testGridAmbientTemperature, +relevantData, testGridAmbientTemperature, gridState, testGridQDotConsumptionHigh, @@ -177,13 +179,15 @@ class ThermalGridWithStorageOnlySpec ) "properly put energy to storage" in { - val tick = 0L + val relevantData = HpRelevantData( + 0L, + testGridAmbientTemperature, + ) val gridState = ThermalGrid.startingState(thermalGrid) val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleInfeed( - tick, - testGridAmbientTemperature, +relevantData, testGridAmbientTemperature, gridState, testGridQDotInfeed, From bb0763357815d7968f1d2ebbc5678f03d0b52c51 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Sun, 24 Nov 2024 11:20:46 +0100 Subject: [PATCH 150/165] fmt --- .../simona/model/thermal/ThermalGridWithStorageOnlySpec.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala index 8c9357ebba..79f9f82ad9 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala @@ -152,7 +152,7 @@ class ThermalGridWithStorageOnlySpec val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleConsumption( -relevantData, + relevantData, testGridAmbientTemperature, gridState, testGridQDotConsumptionHigh, @@ -187,7 +187,7 @@ relevantData, val (updatedGridState, reachedThreshold) = thermalGrid invokePrivate handleInfeed( -relevantData, + relevantData, testGridAmbientTemperature, gridState, testGridQDotInfeed, From 0d32e9cdce76195139006132954033aa25d1ad3c Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Sun, 24 Nov 2024 11:52:37 +0100 Subject: [PATCH 151/165] Refactoring to only use 'lastHpState' and 'relevantData' for 'ThermalGrid' calculations --- CHANGELOG.md | 1 + .../simona/model/participant/HpModel.scala | 8 +-- .../simona/model/thermal/ThermalGrid.scala | 38 ++++++-------- .../ThermalGridWithHouseAndStorageSpec.scala | 52 +++++++++++++------ .../ThermalGridWithHouseOnlySpec.scala | 25 ++++++--- .../ThermalGridWithStorageOnlySpec.scala | 47 ++++++++++++----- 6 files changed, 108 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44290c1dd2..3e98c86553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactor `ResultFileHierarchy` [#1031](https://github.com/ie3-institute/simona/issues/1031) - Removing logs in `logs/simona` [#1017](https://github.com/ie3-institute/simona/issues/1017) - Fix implausible test cases of HpModelSpec [#1042](https://github.com/ie3-institute/simona/issues/1042) +- Refactoring to only use 'lastHpState' and 'relevantData' for 'ThermalGrid' calculations [#916](https://github.com/ie3-institute/simona/issues/916) ### Fixed - Fix rendering of references in documentation [#505](https://github.com/ie3-institute/simona/issues/505) diff --git a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala index 98d18d9ce3..ed146cab9e 100644 --- a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala +++ b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala @@ -134,12 +134,8 @@ final case class HpModel( // Use lastHpState and relevantData to update state of thermalGrid to the current tick val (demandHouse, demandThermalStorage, currentThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - relevantData.currentTick, - lastHpState.ambientTemperature.getOrElse( - relevantData.ambientTemperature - ), - relevantData.ambientTemperature, - lastHpState.thermalGridState, + relevantData, + lastHpState, ) // Determining the operation point and limitations at this tick diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala index 50f56e1849..e1d993f119 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala @@ -14,6 +14,7 @@ import edu.ie3.datamodel.models.result.thermal.{ ThermalHouseResult, } import edu.ie3.simona.exceptions.agent.InconsistentStateException +import edu.ie3.simona.model.participant.HpModel.{HpRelevantData, HpState} import edu.ie3.simona.model.thermal.ThermalGrid.{ ThermalEnergyDemand, ThermalGridState, @@ -45,36 +46,31 @@ final case class ThermalGrid( /** Determine the energy demand of the total grid at the given instance in * time and returns it including the updatedState * - * @param tick - * Questioned instance in time - * @param lastAmbientTemperature - * Ambient temperature until this tick - * @param ambientTemperature - * Ambient temperature in the instance in question - * @param state - * Currently applicable state of the thermal grid + * @param lastHpState + * Last state of the heat pump + * @param relevantData + * data of heat pump including * @return * The total energy demand of the house and the storage and an updated * [[ThermalGridState]] */ def energyDemandAndUpdatedState( - tick: Long, - // FIXME this is also in state - lastAmbientTemperature: Temperature, - ambientTemperature: Temperature, - state: ThermalGridState, + relevantData: HpRelevantData, + lastHpState: HpState, ): (ThermalEnergyDemand, ThermalEnergyDemand, ThermalGridState) = { /* First get the energy demand of the houses but only if inner temperature is below target temperature */ val (houseDemand, updatedHouseState) = - house.zip(state.houseState) match { + house.zip(lastHpState.thermalGridState.houseState) match { case Some((thermalHouse, lastHouseState)) => val (updatedHouseState, _) = thermalHouse.determineState( - tick, + relevantData.currentTick, lastHouseState, - lastAmbientTemperature, - ambientTemperature, + lastHpState.ambientTemperature.getOrElse( + relevantData.ambientTemperature + ), + relevantData.ambientTemperature, lastHouseState.qDot, ) if ( @@ -83,8 +79,8 @@ final case class ThermalGrid( ) { ( thermalHouse.energyDemand( - tick, - ambientTemperature, + relevantData.currentTick, + relevantData.ambientTemperature, updatedHouseState, ), Some(updatedHouseState), @@ -102,10 +98,10 @@ final case class ThermalGrid( val (storageDemand, updatedStorageState) = { storage - .zip(state.storageState) + .zip(lastHpState.thermalGridState.storageState) .map { case (storage, state) => val (updatedStorageState, _) = - storage.updateState(tick, state.qDot, state) + storage.updateState(relevantData.currentTick, state.qDot, state) val storedEnergy = updatedStorageState.storedEnergy val soc = storedEnergy / storage.getMaxEnergyThreshold val storageRequired = { diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala index 7d8d2c27f1..aef9c642ea 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala @@ -7,6 +7,7 @@ package edu.ie3.simona.model.thermal import edu.ie3.datamodel.models.input.thermal.ThermalStorageInput +import edu.ie3.simona.model.participant.HpModel.{HpRelevantData, HpState} import edu.ie3.simona.model.thermal.ThermalGrid.ThermalGridState import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseState import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{ @@ -95,14 +96,23 @@ class ThermalGridWithHouseAndStorageSpec "determining the energy demand" should { "deliver the house demand (no demand) with added flexibility by storage" in { - val tick = 10800 // after three hours - + val relevantData = HpRelevantData( + 10800, // after three hours + testGridAmbientTemperature, + ) + val lastHpState = HpState( + true, + relevantData.currentTick, + Some(testGridAmbientTemperature), + Kilowatts(42), + Kilowatts(42), + ThermalGrid.startingState(thermalGrid), + None, + ) val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, - testGridAmbientTemperature, - ThermalGrid.startingState(thermalGrid), + relevantData, + lastHpState, ) houseDemand.required should approximate(zeroKWh) houseDemand.possible should approximate(KilowattHours(31.05009722d)) @@ -117,19 +127,29 @@ class ThermalGridWithHouseAndStorageSpec } "deliver the correct house and storage demand" in { - val tick = 10800 // after three hours - + val relevantData = HpRelevantData( + 10800, // after three hours + testGridAmbientTemperature, + ) val startingState = ThermalGrid.startingState(thermalGrid) + val lastHpState = HpState( + true, + relevantData.currentTick, + Some(testGridAmbientTemperature), + Kilowatts(42), + Kilowatts(42), + startingState.copy(houseState = + startingState.houseState.map( + _.copy(innerTemperature = Celsius(16d)) + ) + ), + None, + ) + val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, - testGridAmbientTemperature, - startingState.copy(houseState = - startingState.houseState.map( - _.copy(innerTemperature = Celsius(16d)) - ) - ), + relevantData, + lastHpState, ) houseDemand.required should approximate(KilowattHours(45.6000555)) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala index 6b14ee3780..9d7e3e7a54 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala @@ -7,14 +7,15 @@ package edu.ie3.simona.model.thermal import edu.ie3.datamodel.models.input.thermal.ThermalStorageInput +import edu.ie3.simona.model.participant.HpModel.{HpRelevantData, HpState} import edu.ie3.simona.model.thermal.ThermalGrid.ThermalGridState import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseState import edu.ie3.simona.model.thermal.ThermalHouse.ThermalHouseThreshold.{ HouseTemperatureLowerBoundaryReached, HouseTemperatureUpperBoundaryReached, } -import edu.ie3.util.scala.quantities.DefaultQuantities.{zeroKW, zeroKWh} import edu.ie3.simona.test.common.UnitSpec +import edu.ie3.util.scala.quantities.DefaultQuantities.{zeroKW, zeroKWh} import squants.energy._ import squants.thermal.Celsius import squants.{Energy, Kelvin, Power, Temperature} @@ -74,19 +75,29 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { "determining the energy demand" should { "exactly be the demand of the house" in { - val tick = 10800 // after three hours + val relevantData = HpRelevantData( + 10800, // after three hours + testGridAmbientTemperature, + ) + val lastHpState = HpState( + true, + relevantData.currentTick, + Some(testGridAmbientTemperature), + Kilowatts(42), + Kilowatts(42), + ThermalGrid.startingState(thermalGrid), + None, + ) val expectedHouseDemand = thermalHouse.energyDemand( - tick, + relevantData.currentTick, testGridAmbientTemperature, expectedHouseStartingState, ) val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, - testGridAmbientTemperature, - ThermalGrid.startingState(thermalGrid), + relevantData, + lastHpState, ) houseDemand.required should approximate(expectedHouseDemand.required) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala index ead1ff6b03..e6986edb7f 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithStorageOnlySpec.scala @@ -10,6 +10,7 @@ import edu.ie3.datamodel.models.input.thermal.{ ThermalHouseInput, ThermalStorageInput, } +import edu.ie3.simona.model.participant.HpModel.{HpRelevantData, HpState} import edu.ie3.simona.model.thermal.ThermalGrid.ThermalGridState import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageState import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageThreshold.{ @@ -79,14 +80,24 @@ class ThermalGridWithStorageOnlySpec "determining the energy demand" should { "deliver the capabilities of the storage" in { - val tick = 10800 // after three hours + val relevantData = HpRelevantData( + 10800, // after three hours + testGridAmbientTemperature, + ) + val lastHpState = HpState( + true, + relevantData.currentTick, + Some(testGridAmbientTemperature), + Kilowatts(42), + Kilowatts(42), + ThermalGrid.startingState(thermalGrid), + None, + ) val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, - testGridAmbientTemperature, - ThermalGrid.startingState(thermalGrid), + relevantData, + lastHpState, ) houseDemand.required should approximate(zeroKWh) @@ -100,17 +111,27 @@ class ThermalGridWithStorageOnlySpec } "deliver the capabilities of a half full storage" in { - val tick = 10800 // after three hours + val relevantData = HpRelevantData( + 10800, // after three hours + testGridAmbientTemperature, + ) + val lastHpState = HpState( + true, + relevantData.currentTick, + Some(testGridAmbientTemperature), + Kilowatts(42), + Kilowatts(42), + ThermalGridState( + None, + Some(ThermalStorageState(0L, KilowattHours(575d), zeroKW)), + ), + None, + ) val (houseDemand, storageDemand, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( - tick, - testGridAmbientTemperature, - testGridAmbientTemperature, - ThermalGridState( - None, - Some(ThermalStorageState(0L, KilowattHours(575d), zeroKW)), - ), + relevantData, + lastHpState, ) houseDemand.required should approximate(zeroKWh) From 0cbd5e770f125ce618edcf2b8c43cc9f0fb7ce5d Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Sun, 24 Nov 2024 19:07:28 +0100 Subject: [PATCH 152/165] Added all necessary patterns to branchName.gradle --- gradle/scripts/branchName.gradle | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gradle/scripts/branchName.gradle b/gradle/scripts/branchName.gradle index 5ef4e7dd6d..ace0b0c0ab 100644 --- a/gradle/scripts/branchName.gradle +++ b/gradle/scripts/branchName.gradle @@ -6,8 +6,18 @@ tasks.register('checkBranchName') { def branchName = project.property('branchName') - def pattern = /^[a-z]{2}\\/#[0-9]+(?:-.+)?$/ - if (!branchName.matches(pattern)) { + def patterns = [ + /^[a-z]{2}\\/#[0-9]+(?:-.+)?$/, + /.*main/, + /^dependabot\/.*$/, + /.*hotfix\/\pL{2}\/#\d+.*/, + /^(developer|develop|dev)$/, + /.*rel\/.*/ + ] + + def isValid = patterns.any { pattern -> branchName.matches(pattern) } + + if (!isValid) { throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName).") } From a980198c7bb0b987385798a7b5ffc638d9bc4271 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Sun, 24 Nov 2024 19:10:40 +0100 Subject: [PATCH 153/165] empty line --- gradle/scripts/branchName.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/scripts/branchName.gradle b/gradle/scripts/branchName.gradle index ace0b0c0ab..e80e5b6655 100644 --- a/gradle/scripts/branchName.gradle +++ b/gradle/scripts/branchName.gradle @@ -23,4 +23,4 @@ tasks.register('checkBranchName') { println "Branch name is $branchName" } -} \ No newline at end of file +} From eba4a81f8d10a8522c102db118b68fe859f88147 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Sun, 24 Nov 2024 19:11:16 +0100 Subject: [PATCH 154/165] Revert "Added all necessary patterns to branchName.gradle" This reverts commit 0cbd5e770f125ce618edcf2b8c43cc9f0fb7ce5d. --- gradle/scripts/branchName.gradle | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/gradle/scripts/branchName.gradle b/gradle/scripts/branchName.gradle index e80e5b6655..ce22f19ed3 100644 --- a/gradle/scripts/branchName.gradle +++ b/gradle/scripts/branchName.gradle @@ -6,18 +6,8 @@ tasks.register('checkBranchName') { def branchName = project.property('branchName') - def patterns = [ - /^[a-z]{2}\\/#[0-9]+(?:-.+)?$/, - /.*main/, - /^dependabot\/.*$/, - /.*hotfix\/\pL{2}\/#\d+.*/, - /^(developer|develop|dev)$/, - /.*rel\/.*/ - ] - - def isValid = patterns.any { pattern -> branchName.matches(pattern) } - - if (!isValid) { + def pattern = /^[a-z]{2}\\/#[0-9]+(?:-.+)?$/ + if (!branchName.matches(pattern)) { throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName).") } From fada3e5f40e11c22144438ffc387872fc11f79a4 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Sun, 24 Nov 2024 19:12:23 +0100 Subject: [PATCH 155/165] Added all necessary patterns to branchName.gradle --- gradle/scripts/branchName.gradle | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gradle/scripts/branchName.gradle b/gradle/scripts/branchName.gradle index ce22f19ed3..e80e5b6655 100644 --- a/gradle/scripts/branchName.gradle +++ b/gradle/scripts/branchName.gradle @@ -6,8 +6,18 @@ tasks.register('checkBranchName') { def branchName = project.property('branchName') - def pattern = /^[a-z]{2}\\/#[0-9]+(?:-.+)?$/ - if (!branchName.matches(pattern)) { + def patterns = [ + /^[a-z]{2}\\/#[0-9]+(?:-.+)?$/, + /.*main/, + /^dependabot\/.*$/, + /.*hotfix\/\pL{2}\/#\d+.*/, + /^(developer|develop|dev)$/, + /.*rel\/.*/ + ] + + def isValid = patterns.any { pattern -> branchName.matches(pattern) } + + if (!isValid) { throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName).") } From 45a3c4bff8f7d31f7e61391a77c07fa9006c7f43 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Sun, 24 Nov 2024 19:44:51 +0100 Subject: [PATCH 156/165] Fixed the regex List --- gradle/scripts/branchName.gradle | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle/scripts/branchName.gradle b/gradle/scripts/branchName.gradle index e80e5b6655..b1357b16f1 100644 --- a/gradle/scripts/branchName.gradle +++ b/gradle/scripts/branchName.gradle @@ -7,15 +7,15 @@ tasks.register('checkBranchName') { def branchName = project.property('branchName') def patterns = [ - /^[a-z]{2}\\/#[0-9]+(?:-.+)?$/, - /.*main/, - /^dependabot\/.*$/, - /.*hotfix\/\pL{2}\/#\d+.*/, - /^(developer|develop|dev)$/, - /.*rel\/.*/ + ~/^(developer|develop|dev)$/, + ~/.*rel\/.*/, + ~/^dependabot\/.*$/, + ~/.*hotfix\/\pL{2}\/#\d+.*/, + ~/.*main/, + ~/^[a-z]{2}\/#[0-9]+(?:-.+)?$/ ] - def isValid = patterns.any { pattern -> branchName.matches(pattern) } + def isValid = patterns.any { pattern -> branchName ==~ pattern } if (!isValid) { throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName).") From c12948041b899c879618dc330c6462df8bcbc5e5 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Mon, 25 Nov 2024 11:34:51 +0100 Subject: [PATCH 157/165] include reviewers comments --- .../edu/ie3/simona/model/participant/HpModel.scala | 11 ++++------- .../edu/ie3/simona/model/thermal/ThermalGrid.scala | 2 -- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala index 254d18f136..216353be2c 100644 --- a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala +++ b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala @@ -222,13 +222,10 @@ final case class HpModel( updatedGridState: ThermalGridState ): Boolean = { implicit val tolerance: Energy = KilowattHours(1e-3) - val noThermalStorageOrThermalStorageIsEmpty: Boolean = - updatedGridState.storageState.isEmpty || updatedGridState.storageState - .exists( - _.storedEnergy =~ zeroKWh - ) - - noThermalStorageOrThermalStorageIsEmpty + updatedGridState.storageState.isEmpty || updatedGridState.storageState + .exists( + _.storedEnergy =~ zeroKWh + ) } /** Calculate state depending on whether heat pump is needed or not. Also diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala index 6116783509..fa1eb7d017 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala @@ -194,8 +194,6 @@ final case class ThermalGrid( * Current state of the houses * @param qDot * Infeed to the grid - * @param thermalDemands - * holds the thermal demands of the thermal units (house, storage) * @return * Updated thermal grid state */ From e85273524541d18836679a93e93774eaedcf3090 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Mon, 25 Nov 2024 11:59:44 +0100 Subject: [PATCH 158/165] fix after merge conflicts --- src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala | 2 +- .../model/thermal/ThermalGridWithHouseAndStorageSpec.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala index 2f42aa6e15..c7e107d55a 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala @@ -58,7 +58,7 @@ final case class ThermalGrid( def energyDemandAndUpdatedState( relevantData: HpRelevantData, lastHpState: HpState, - ): (ThermalEnergyDemand, ThermalEnergyDemand, ThermalGridState) = { + ): (ThermalDemandWrapper, ThermalGridState) = { /* First get the energy demand of the houses but only if inner temperature is below target temperature */ val (houseDemand, updatedHouseState) = diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala index a7e8118dbc..5d19bfdd73 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseAndStorageSpec.scala @@ -109,7 +109,7 @@ class ThermalGridWithHouseAndStorageSpec ThermalGrid.startingState(thermalGrid), None, ) - val (houseDemand, storageDemand, updatedThermalGridState) = + val (thermalDemands, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( relevantData, lastHpState, @@ -149,7 +149,7 @@ class ThermalGridWithHouseAndStorageSpec None, ) - val (houseDemand, storageDemand, updatedThermalGridState) = + val (thermalDemands, updatedThermalGridState) = thermalGrid.energyDemandAndUpdatedState( relevantData, lastHpState, From 5d6f16a03e8b310b9be251b41d3197f0f516b5d5 Mon Sep 17 00:00:00 2001 From: Daniel Feismann <98817556+danielfeismann@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:49:38 +0100 Subject: [PATCH 159/165] Update CITATION.cff --- CITATION.cff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CITATION.cff b/CITATION.cff index fc6f218dce..0008300e9f 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -9,7 +9,7 @@ authors: - family-names: Kittl given-names: Chris orcid: https://orcid.org/0000-0002-1187-0568 - - family-names: Sen-Sarma + - family-names: Sen Sarma given-names: Debopama orcid: https://orcid.org/0000-0003-3311-3020 - family-names: Oberließen From 511add9d92e2e67519cf0a781bc88aa8a857579d Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Mon, 25 Nov 2024 14:22:10 +0100 Subject: [PATCH 160/165] fix after merge conflicts --- .../scala/edu/ie3/simona/model/thermal/ThermalGrid.scala | 4 +++- .../simona/model/thermal/ThermalGridWithHouseOnlySpec.scala | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala index 2c3a6f4cc4..2e6e684947 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala @@ -67,7 +67,9 @@ final case class ThermalGrid( thermalHouse.determineState( relevantData, lastHouseState, - lastAmbientTemperature, + lastHpState.ambientTemperature.getOrElse( + relevantData.ambientTemperature + ), lastHouseState.qDot, ) if ( diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala index 44ae8caa95..d1e00e1c8d 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridWithHouseOnlySpec.scala @@ -88,10 +88,7 @@ class ThermalGridWithHouseOnlySpec extends UnitSpec with ThermalHouseTestData { ThermalGrid.startingState(thermalGrid), None, ) - val expectedHouseDemand = thermalHouse.energyDemand( - relevantData.currentTick, - testGridAmbientTemperature, - ) + val expectedHouseDemand = thermalHouse.energyDemand( relevantData, expectedHouseStartingState, From 6a0b5f372331907780c3fe12aa18d4f3c2d64026 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Mon, 25 Nov 2024 15:18:48 +0100 Subject: [PATCH 161/165] move method to check for empty storage to ThermalGridState --- .../simona/model/participant/HpModel.scala | 24 ++----------------- .../simona/model/thermal/ThermalGrid.scala | 22 ++++++++++++++++- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala index ab4db17eb2..ead8e89f02 100644 --- a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala +++ b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala @@ -22,8 +22,8 @@ import edu.ie3.util.quantities.PowerSystemUnits import edu.ie3.util.scala.OperationInterval import edu.ie3.util.scala.quantities.DefaultQuantities._ import edu.ie3.util.scala.quantities.{ApparentPower, Kilovoltamperes} -import squants.energy.{KilowattHours, Kilowatts} -import squants.{Energy, Power, Temperature} +import squants.energy.Kilowatts +import squants.{Power, Temperature} import java.time.ZonedDateTime import java.util.UUID @@ -204,26 +204,6 @@ final case class HpModel( ) } - /** This method will return booleans whether there is a heat demand of house - * or thermal storage as well as a boolean indicating if there is no thermal - * storage, or it is empty. - * - * @param updatedGridState - * The updated state of the [[ThermalGrid]] - * @return - * boolean which is true, if there is no thermalStorage, or it's empty. - */ - - private def determineThermalStorageStatus( - updatedGridState: ThermalGridState - ): Boolean = { - implicit val tolerance: Energy = KilowattHours(1e-3) - updatedGridState.storageState.isEmpty || updatedGridState.storageState - .exists( - _.storedEnergy =~ zeroKWh - ) - } - /** Calculate state depending on whether heat pump is needed or not. Also * calculate inner temperature change of thermal house and update its inner * temperature. diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala index c7e107d55a..85627e2057 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala @@ -25,7 +25,7 @@ import edu.ie3.simona.model.thermal.ThermalStorage.ThermalStorageState import edu.ie3.simona.util.TickUtil.TickLong import edu.ie3.util.quantities.QuantityUtils.RichQuantityDouble import edu.ie3.util.scala.quantities.DefaultQuantities._ -import squants.energy.Kilowatts +import squants.energy.{KilowattHours, Kilowatts} import squants.{Energy, Power, Temperature} import java.time.ZonedDateTime @@ -539,6 +539,26 @@ object ThermalGrid { thermalGrid.storage.map(_.startingState), ) + /** This method will return booleans whether there is a heat demand of house + * or thermal storage as well as a boolean indicating if there is no thermal + * storage, or it is empty. + * + * @param updatedGridState + * The updated state of the [[ThermalGrid]] + * @return + * boolean which is true, if there is no thermalStorage, or it's empty. + */ + + def isThermalStorageEmpty( + updatedGridState: ThermalGridState + ): Boolean = { + implicit val tolerance: Energy = KilowattHours(1e-3) + updatedGridState.storageState.isEmpty || updatedGridState.storageState + .exists( + _.storedEnergy =~ zeroKWh + ) + } + /** Wraps the demand of thermal units (thermal house, thermal storage). * * @param houseDemand From 60442a73f61606295fa99998911f4b51cef261b0 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Mon, 25 Nov 2024 15:19:06 +0100 Subject: [PATCH 162/165] rename method --- .../scala/edu/ie3/simona/model/participant/HpModel.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala index ead8e89f02..875f14654a 100644 --- a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala +++ b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala @@ -181,9 +181,10 @@ final case class HpModel( val demandHouse = thermalDemands.houseDemand val demandThermalStorage = thermalDemands.heatStorageDemand - val noThermalStorageOrThermalStorageIsEmpty = determineThermalStorageStatus( - currentThermalGridState - ) + val noThermalStorageOrThermalStorageIsEmpty = + ThermalGrid.isThermalStorageEmpty( + currentThermalGridState + ) val turnHpOn = (demandHouse.hasRequiredDemand && noThermalStorageOrThermalStorageIsEmpty) || From 6d97c3bcfad8a51c00ca1be0781b9ab181e437be Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Mon, 25 Nov 2024 15:19:27 +0100 Subject: [PATCH 163/165] enhancing tests to check for empty storage in ThermalGridState --- .../model/thermal/ThermalGridSpec.scala | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridSpec.scala index e4c1c14c70..b137abde99 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridSpec.scala @@ -6,13 +6,19 @@ package edu.ie3.simona.model.thermal +import edu.ie3.datamodel.models.input.thermal.ThermalStorageInput import edu.ie3.simona.model.thermal.ThermalGrid.ThermalEnergyDemand import edu.ie3.simona.test.common.UnitSpec -import squants.energy.{MegawattHours, WattHours, Watts} +import squants.energy.{KilowattHours, MegawattHours, WattHours, Watts} import squants.thermal.Celsius import squants.{Energy, Power, Temperature} -class ThermalGridSpec extends UnitSpec { +import scala.jdk.CollectionConverters._ + +class ThermalGridSpec + extends UnitSpec + with ThermalHouseTestData + with ThermalStorageTestData { implicit val tempTolerance: Temperature = Celsius(1e-3) implicit val powerTolerance: Power = Watts(1e-3) @@ -97,4 +103,44 @@ class ThermalGridSpec extends UnitSpec { } } } + "ThermalGridState" should { + val thermalGridOnlyHouse = ThermalGrid( + new edu.ie3.datamodel.models.input.container.ThermalGrid( + thermalBusInput, + Set(thermalHouseInput).asJava, + Set.empty[ThermalStorageInput].asJava, + ) + ) + + "return true when there is no storage" in { + val startingState = ThermalGrid.startingState(thermalGridOnlyHouse) + val result = ThermalGrid.isThermalStorageEmpty(startingState) + result shouldBe true + } + + val thermalGrid = ThermalGrid( + new edu.ie3.datamodel.models.input.container.ThermalGrid( + thermalBusInput, + Set(thermalHouseInput).asJava, + Set[ThermalStorageInput](thermalStorageInput).asJava, + ) + ) + + "return true when all stored energy is effectively zero" in { + val startingState = ThermalGrid.startingState(thermalGrid) + val result = ThermalGrid.isThermalStorageEmpty(startingState) + result shouldBe true + } + + "return false when storage is not empty" in { + val startingState = ThermalGrid.startingState(thermalGrid) + val gridState = startingState.copy(storageState = + startingState.storageState.map(storageState => + storageState.copy(storedEnergy = KilowattHours(1)) + ) + ) + val result = ThermalGrid.isThermalStorageEmpty(gridState) + result shouldBe false + } + } } From 202ecb10a2be76879569f6c72aabaeb4f1014fc7 Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Mon, 25 Nov 2024 15:53:42 +0100 Subject: [PATCH 164/165] move isThermalStorageEmpty into ThermalGridState --- .../simona/model/participant/HpModel.scala | 5 +-- .../simona/model/thermal/ThermalGrid.scala | 39 +++++++++---------- .../model/thermal/ThermalGridSpec.scala | 16 ++++---- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala index 875f14654a..5911a9cade 100644 --- a/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala +++ b/src/main/scala/edu/ie3/simona/model/participant/HpModel.scala @@ -180,11 +180,8 @@ final case class HpModel( val demandHouse = thermalDemands.houseDemand val demandThermalStorage = thermalDemands.heatStorageDemand - val noThermalStorageOrThermalStorageIsEmpty = - ThermalGrid.isThermalStorageEmpty( - currentThermalGridState - ) + currentThermalGridState.isThermalStorageEmpty val turnHpOn = (demandHouse.hasRequiredDemand && noThermalStorageOrThermalStorageIsEmpty) || diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala index 85627e2057..70f92e242c 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala @@ -531,7 +531,24 @@ object ThermalGrid { final case class ThermalGridState( houseState: Option[ThermalHouseState], storageState: Option[ThermalStorageState], - ) + ) { + + /** This method will return booleans whether there is a heat demand of house + * or thermal storage as well as a boolean indicating if there is no + * thermal storage, or it is empty. + * + * @return + * boolean which is true, if there is no thermalStorage, or it's empty. + */ + + def isThermalStorageEmpty: Boolean = { + implicit val tolerance: Energy = KilowattHours(1e-3) + storageState.isEmpty || storageState + .exists( + _.storedEnergy =~ zeroKWh + ) + } + } def startingState(thermalGrid: ThermalGrid): ThermalGridState = ThermalGridState( @@ -539,26 +556,6 @@ object ThermalGrid { thermalGrid.storage.map(_.startingState), ) - /** This method will return booleans whether there is a heat demand of house - * or thermal storage as well as a boolean indicating if there is no thermal - * storage, or it is empty. - * - * @param updatedGridState - * The updated state of the [[ThermalGrid]] - * @return - * boolean which is true, if there is no thermalStorage, or it's empty. - */ - - def isThermalStorageEmpty( - updatedGridState: ThermalGridState - ): Boolean = { - implicit val tolerance: Energy = KilowattHours(1e-3) - updatedGridState.storageState.isEmpty || updatedGridState.storageState - .exists( - _.storedEnergy =~ zeroKWh - ) - } - /** Wraps the demand of thermal units (thermal house, thermal storage). * * @param houseDemand diff --git a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridSpec.scala b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridSpec.scala index b137abde99..bb34a88682 100644 --- a/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridSpec.scala +++ b/src/test/scala/edu/ie3/simona/model/thermal/ThermalGridSpec.scala @@ -113,8 +113,8 @@ class ThermalGridSpec ) "return true when there is no storage" in { - val startingState = ThermalGrid.startingState(thermalGridOnlyHouse) - val result = ThermalGrid.isThermalStorageEmpty(startingState) + val initialState = ThermalGrid.startingState(thermalGridOnlyHouse) + val result = initialState.isThermalStorageEmpty result shouldBe true } @@ -127,19 +127,19 @@ class ThermalGridSpec ) "return true when all stored energy is effectively zero" in { - val startingState = ThermalGrid.startingState(thermalGrid) - val result = ThermalGrid.isThermalStorageEmpty(startingState) + val initialState = ThermalGrid.startingState(thermalGrid) + val result = initialState.isThermalStorageEmpty result shouldBe true } "return false when storage is not empty" in { - val startingState = ThermalGrid.startingState(thermalGrid) - val gridState = startingState.copy(storageState = - startingState.storageState.map(storageState => + val initialState = ThermalGrid.startingState(thermalGrid) + val gridState = initialState.copy(storageState = + initialState.storageState.map(storageState => storageState.copy(storedEnergy = KilowattHours(1)) ) ) - val result = ThermalGrid.isThermalStorageEmpty(gridState) + val result = gridState.isThermalStorageEmpty result shouldBe false } } From 005bc21d90dcc72fc3185b2da7041153ba4b2a7d Mon Sep 17 00:00:00 2001 From: danielfeismann Date: Mon, 25 Nov 2024 17:20:12 +0100 Subject: [PATCH 165/165] fmt --- src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala index 70f92e242c..32e1870a03 100644 --- a/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala +++ b/src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala @@ -540,7 +540,6 @@ object ThermalGrid { * @return * boolean which is true, if there is no thermalStorage, or it's empty. */ - def isThermalStorageEmpty: Boolean = { implicit val tolerance: Energy = KilowattHours(1e-3) storageState.isEmpty || storageState