Skip to content

Commit

Permalink
Implementing GitHub Actions Pipeline (#982)
Browse files Browse the repository at this point in the history
* Testing Checkout

* Fixed Syntax

* Fixed Syntax

* removed unnecessary steps

* removed unnecessary steps

* Syntax

* Syntax

* Test SSH

* Testing Build ENV

* Added wget

* ENV

* added shell

* check java

* check java

* Created new Docker Image

* Added Build and Test stage

* Fix

* Added right order

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Added Volume

* Set clean to false

* Set clean to true

* Fixed Volume Path

* Fixed Volume Path

* Fixed Volume Path

* Fixed Volume Path

* Fixed Volume Path

* Fixed Volume Path

* Bind Volume

* Fixed Docker Image

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix Volume

* Fix Volume

* Fix Volume

* Fix Volume

* Combined Checkout and Build

* Fix

* Fix

* Fix Vol

* Added Artifact

* Added Artifact

* Added Artifact

* Fix syntax

* Debug

* Debug

* Debug

* STOP

* test

* Volume

* Using Cache

* Cache Fix

* Cache Fix

* Cache Fix

* Cache Fix

* Cache Fix

* Cache Fix

* Cache Fix

* Cache Fix

* Cache Fix

* Cache Fix

* Using artifacts

* Changed approach in passing files

* Changed approach in passing files

* Debug

* Fixed Path

* Fixed Path

* Fixed Path

* Fixed Path

* Fixed Path

* Caching Gradle Dependencies

* Removed workdir

* Fixes

* Fixes

* Removed Artifacting
Trying Cache

* Seperated Build Artifact and Gradle Cache

* All jobs in one stage test

* Fixed permissions

* Test

* Test

* Test

* Changed approach

* Added Sonar

* Added Sonar

* Added sonar credentials

* Moved reportScoverage

* Moved reportScoverage

* Moved reportScoverage

* Switched to action

* Switched to action

* Back to gradle

* Removed dependencies from sonarqube.gradle

* Added deployment step and sonar quality gate

* fixed time format

* debug

* Added dependencie to sonarqube.gradle and changed workflow

* sonar

* Switched to action

* Added path to binaries

* Added path to binaries

* Debug

* Debug

* Debug

* Finished Prototype

* Finished Prototype

* Changed Java-Docs to Scala-Docs

* Resolved Conversations

* Changed branches

* Switched from Sonarqube analysis Action to gradlew

* Create Reports and changed path

* fetch-depth

* Quality-Gate status script

* debug

* debug

* debug

* Using reportScoverage

* debug path

* debug path

* debug path

* debug path

* debug path

* Merged some steps

* rem debug

* switched to sonarqube

* Added CheckScov

* Remove args

* Outcommented sonar stage in jenkins

* Testing Sonar

* Prototype

* Removed DummyCode

* Jenkinsfile back to dev version

* spotless back in test

* Prototype

* Resolved conversations

* changed fetch depth

* seperated spotlessCheck

* debug spotless

* debug spotless

* resolved conversations

* Removed PMDS and replaced with test

* Added dependencies

* fixes

* empty line
  • Loading branch information
PhilippSchmelter authored Nov 18, 2024
1 parent c77f60c commit 96798b1
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 2 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# © 2024. TU Dortmund University,
# Institute of Energy Systems, Energy Efficiency and Energy Economics,
# Research group Distribution grid planning and operation
#

name: CI

on:
push:
paths-ignore:
- 'docs/**'
branches:
- main
- dev
- 'hotfix/*'
- 'rel/*'
- 'dependabot/*'
pull_request:
branches:
- main
- dev

jobs:
buildAndTest:
runs-on: ubuntu-latest

steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build Project
run: ./gradlew --refresh-dependencies clean assemble spotlessCheck

- name: Run Tests
run: ./gradlew test reportScoverage checkScoverage

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

- name: SonarQube
run: |
./gradlew sonar \
-Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \
-Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
SONAR_STATUS_URL="${{ vars.SONAR_HOST_URL }}/api/qualitygates/project_status?projectKey=${{ vars.SONAR_PROJECT_KEY }}"
QUALITY_GATE_STATUS=$(curl -s -u "${{ secrets.SONAR_TOKEN }}:" "$SONAR_STATUS_URL" | jq -r '.projectStatus.status')
echo "Quality Gate Status: $QUALITY_GATE_STATUS"
if [ "$QUALITY_GATE_STATUS" != "OK" ]; then
echo "Quality Gate failed!"
exit 1
fi
- name: Deploy
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
run: |
./gradlew 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"

0 comments on commit 96798b1

Please sign in to comment.