Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing GitHub Actions Pipeline #982

Draft
wants to merge 121 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
a5e7882
Testing Checkout
PhilippSchmelter Oct 2, 2024
c205a34
Fixed Syntax
PhilippSchmelter Oct 2, 2024
0d7d256
Fixed Syntax
PhilippSchmelter Oct 2, 2024
81864ff
removed unnecessary steps
PhilippSchmelter Oct 2, 2024
e21113c
removed unnecessary steps
PhilippSchmelter Oct 2, 2024
1a322fe
Syntax
PhilippSchmelter Oct 2, 2024
a358186
Syntax
PhilippSchmelter Oct 2, 2024
ef8ef61
Test SSH
PhilippSchmelter Oct 2, 2024
9ff6b0f
Testing Build ENV
PhilippSchmelter Oct 2, 2024
7a63e64
Added wget
PhilippSchmelter Oct 2, 2024
58b398b
ENV
PhilippSchmelter Oct 2, 2024
4907ebd
added shell
PhilippSchmelter Oct 2, 2024
717170d
check java
PhilippSchmelter Oct 2, 2024
868926f
check java
PhilippSchmelter Oct 2, 2024
272364d
Created new Docker Image
PhilippSchmelter Oct 2, 2024
c6f72b1
Added Build and Test stage
PhilippSchmelter Oct 2, 2024
5d624e7
Fix
PhilippSchmelter Oct 2, 2024
cc50142
Added right order
PhilippSchmelter Oct 2, 2024
9979cc8
Fix
PhilippSchmelter Oct 2, 2024
82c04b5
Fix
PhilippSchmelter Oct 2, 2024
2f5d1ed
Fix
PhilippSchmelter Oct 2, 2024
423824b
Fix
PhilippSchmelter Oct 2, 2024
de427e9
Fix
PhilippSchmelter Oct 2, 2024
4801167
Fix
PhilippSchmelter Oct 2, 2024
cc21a2e
Fix
PhilippSchmelter Oct 2, 2024
6ebc5e2
Added Volume
PhilippSchmelter Oct 2, 2024
3434da4
Set clean to false
PhilippSchmelter Oct 2, 2024
485d6c1
Set clean to true
PhilippSchmelter Oct 2, 2024
f136f27
Fixed Volume Path
PhilippSchmelter Oct 2, 2024
f024771
Fixed Volume Path
PhilippSchmelter Oct 2, 2024
ae3f414
Fixed Volume Path
PhilippSchmelter Oct 2, 2024
cc00df1
Fixed Volume Path
PhilippSchmelter Oct 2, 2024
c892a8c
Fixed Volume Path
PhilippSchmelter Oct 2, 2024
442d31b
Fixed Volume Path
PhilippSchmelter Oct 2, 2024
88b4447
Bind Volume
PhilippSchmelter Oct 2, 2024
26273dd
Fixed Docker Image
PhilippSchmelter Oct 2, 2024
b9016d1
Fix
PhilippSchmelter Oct 2, 2024
07e1442
Fix
PhilippSchmelter Oct 2, 2024
16db60d
Fix
PhilippSchmelter Oct 2, 2024
b21805d
Fix
PhilippSchmelter Oct 2, 2024
ddd5a92
Fix
PhilippSchmelter Oct 2, 2024
d9260e9
Fix
PhilippSchmelter Oct 2, 2024
bdd7906
Fix
PhilippSchmelter Oct 2, 2024
d537e09
Fix Volume
PhilippSchmelter Oct 2, 2024
160bd99
Fix Volume
PhilippSchmelter Oct 2, 2024
caafefe
Fix Volume
PhilippSchmelter Oct 2, 2024
f85defe
Fix Volume
PhilippSchmelter Oct 2, 2024
b7440c8
Combined Checkout and Build
PhilippSchmelter Oct 2, 2024
c9f7e42
Fix
PhilippSchmelter Oct 2, 2024
68a7fc1
Fix
PhilippSchmelter Oct 2, 2024
9c53be5
Fix Vol
PhilippSchmelter Oct 2, 2024
0e57156
Added Artifact
PhilippSchmelter Oct 2, 2024
5ff88ec
Merge branch 'dev' into ps/#939-GitHubActionsPipeline
PhilippSchmelter Oct 2, 2024
b0b8a7d
Added Artifact
PhilippSchmelter Oct 2, 2024
7f6a281
Added Artifact
PhilippSchmelter Oct 2, 2024
c14c0a6
Fix syntax
PhilippSchmelter Oct 2, 2024
4b3e51c
Debug
PhilippSchmelter Oct 2, 2024
99a876e
Debug
PhilippSchmelter Oct 2, 2024
50979d2
Debug
PhilippSchmelter Oct 2, 2024
7aa55ba
STOP
PhilippSchmelter Oct 2, 2024
25346e6
test
PhilippSchmelter Oct 2, 2024
8c4b71b
Volume
PhilippSchmelter Oct 2, 2024
517d9e5
Using Cache
PhilippSchmelter Oct 3, 2024
f58d317
Cache Fix
PhilippSchmelter Oct 4, 2024
f113040
Cache Fix
PhilippSchmelter Oct 4, 2024
62656db
Cache Fix
PhilippSchmelter Oct 4, 2024
8999526
Cache Fix
PhilippSchmelter Oct 4, 2024
21835f8
Cache Fix
PhilippSchmelter Oct 4, 2024
47dc2b2
Cache Fix
PhilippSchmelter Oct 4, 2024
f623598
Cache Fix
PhilippSchmelter Oct 4, 2024
a6ee586
Cache Fix
PhilippSchmelter Oct 4, 2024
fed2642
Cache Fix
PhilippSchmelter Oct 4, 2024
c0b408b
Cache Fix
PhilippSchmelter Oct 4, 2024
51a29b8
Using artifacts
PhilippSchmelter Oct 4, 2024
a7d508d
Changed approach in passing files
PhilippSchmelter Oct 4, 2024
9a84f3e
Changed approach in passing files
PhilippSchmelter Oct 4, 2024
26d977f
Debug
PhilippSchmelter Oct 4, 2024
5aa9679
Fixed Path
PhilippSchmelter Oct 7, 2024
da5336b
Fixed Path
PhilippSchmelter Oct 7, 2024
8da5343
Fixed Path
PhilippSchmelter Oct 7, 2024
4b65e11
Fixed Path
PhilippSchmelter Oct 7, 2024
5ec36de
Fixed Path
PhilippSchmelter Oct 7, 2024
fc39fbb
Caching Gradle Dependencies
PhilippSchmelter Oct 8, 2024
e279c01
Removed workdir
PhilippSchmelter Oct 8, 2024
5044de6
Fixes
PhilippSchmelter Oct 8, 2024
711beae
Fixes
PhilippSchmelter Oct 8, 2024
1d0ba09
Removed Artifacting
PhilippSchmelter Oct 8, 2024
f703367
Seperated Build Artifact and Gradle Cache
PhilippSchmelter Oct 8, 2024
d060f80
All jobs in one stage test
PhilippSchmelter Oct 8, 2024
7eab786
Fixed permissions
PhilippSchmelter Oct 8, 2024
cee3934
Test
PhilippSchmelter Oct 8, 2024
54dce13
Test
PhilippSchmelter Oct 8, 2024
c96acf7
Test
PhilippSchmelter Oct 8, 2024
7275f38
Changed approach
PhilippSchmelter Oct 8, 2024
3eb67df
Added Sonar
PhilippSchmelter Oct 8, 2024
cc45c56
Added Sonar
PhilippSchmelter Oct 9, 2024
2ad00b1
Added sonar credentials
PhilippSchmelter Oct 9, 2024
0671015
Merge branch 'dev' into ps/#939-GitHubActionsPipeline
PhilippSchmelter Oct 16, 2024
aaacfdb
Moved reportScoverage
PhilippSchmelter Oct 16, 2024
57534b8
Moved reportScoverage
PhilippSchmelter Oct 16, 2024
9e2f3e8
Moved reportScoverage
PhilippSchmelter Oct 16, 2024
7d76f17
Switched to action
PhilippSchmelter Oct 16, 2024
91a9366
Switched to action
PhilippSchmelter Oct 16, 2024
cfcabbf
Back to gradle
PhilippSchmelter Oct 16, 2024
8db5445
Merge branch 'dev' into ps/#939-GitHubActionsPipeline
PhilippSchmelter Oct 17, 2024
1ff1b5a
Removed dependencies from sonarqube.gradle
PhilippSchmelter Oct 17, 2024
58ada89
Added deployment step and sonar quality gate
PhilippSchmelter Oct 17, 2024
50386fc
fixed time format
PhilippSchmelter Oct 17, 2024
33007be
debug
PhilippSchmelter Oct 17, 2024
5042d36
Added dependencie to sonarqube.gradle and changed workflow
PhilippSchmelter Oct 17, 2024
5c8ea2b
sonar
PhilippSchmelter Oct 17, 2024
e6b7e23
Switched to action
PhilippSchmelter Oct 17, 2024
0a0174b
Added path to binaries
PhilippSchmelter Oct 17, 2024
00fd90a
Added path to binaries
PhilippSchmelter Oct 17, 2024
fa44b06
Debug
PhilippSchmelter Oct 17, 2024
d203385
Debug
PhilippSchmelter Oct 17, 2024
1ff759c
Debug
PhilippSchmelter Oct 17, 2024
9d5d395
Finished Prototype
PhilippSchmelter Oct 17, 2024
15ef2df
Finished Prototype
PhilippSchmelter Oct 17, 2024
a8fd9ee
Changed Java-Docs to Scala-Docs
PhilippSchmelter Oct 17, 2024
39693e6
Merge branch 'dev' into ps/#939-GitHubActionsPipeline
PhilippSchmelter Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# © 2024. TU Dortmund University,
# Institute of Energy Systems, Energy Efficiency and Energy Economics,
# Research group Distribution grid planning and operation
#

name: CI

on:
push:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paths-ignore for docs could also be useful? readthedocs has its separate CI

branches:
- main
- dev
- 'feature/*'
- 'hotfix/*'
- 'release/*'
Comment on lines +13 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably know this, but these have to be adapted to the branch naming scheme that we use

pull_request:
branches:
- main
- dev
Comment on lines +18 to +19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need the pull_request specification, if CI is running on branches already?


jobs:

build:
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: 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

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Setup Gradle 8.10
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: "8.10"
Comment on lines +48 to +49
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you can leave out the specification of the version if the project already configures gradle (which it does).


- name: Build Project
run: |
./gradlew clean assemble

- name: Run Tests
run: |
./gradlew --refresh-dependencies spotlessCheck pmdMain pmdTest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--refresh-dependencies makes more sense before assemble, I think


- name: Build Scala-Docs
run: |
./gradlew scaladoc

- name: SonarQube Analysis
uses: sonarsource/sonarqube-scan-action@master
with:
projectBaseDir: '.'
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 }}

- name: SonarQube Quality Gate
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
# Force to fail step after specific time.
timeout-minutes: 60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably be reduced (but isn't that important)

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 }}
2 changes: 0 additions & 2 deletions gradle/scripts/sonarqube.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ 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"