Skip to content

Implementing GitHub Actions Pipeline #81

Implementing GitHub Actions Pipeline

Implementing GitHub Actions Pipeline #81

Workflow file for this run

# © 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:
build:
runs-on: ubuntu-latest
container:
image: gradle:8.10-jdk17
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: 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
git rev-parse --abbrev-ref HEAD
pwd
ls -la
- name: Checking Gradle & Java
run: |
java -version && gradle --version
- name: Building Project
run: |
gradle clean assemble
ls -la
- 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
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
- name: Download Build Artifact
uses: actions/download-artifact@v3
with:
name: simona-build
- name: Running tests
working-directory: ./simona
run: |
gradle --no-daemon --info --refresh-dependencies spotlessCheck pmdMain pmdTest
- name: Generate JavaDoc
run: |
set +x
cd simona
./gradlew javadoc