-
Notifications
You must be signed in to change notification settings - Fork 3
Initial version #5
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
Open
gerritdrost
wants to merge
14
commits into
main
Choose a base branch
from
initial-version
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8053106
Initial commit of java/gradle project
gerritdrost f6bf4cb
Work on automatically generating wrapper using JExtract
Mahmuttumkaya eccd04d
First attempt at building using gradle.
gerritdrost c8073eb
Fully working code generation for PGM wrapper using JExtract in gradle
Mahmuttumkaya 6a83c42
Getting Java code for loading/checking PGM ready for production
gerritdrost 523aae1
Add and apply checkstyle and PMD
wei-qiang e6d2b7d
Move example class to lfenergy package
gerritdrost 30dd17b
Introduce spotless
wei-qiang 4eeed0a
Add license header to gradle files (#2)
wei-qiang 6accce4
GitHub actions (#3)
wei-qiang 1a808f2
Update gradle wrapper
gerritdrost bedd8a3
Fix root project name
gerritdrost fe5ce1f
Rename last occurence of jpgm to libpower-grid-model-java in exceptio…
gerritdrost 3e49eaa
Improve README.md, remove all occurences of pgm-template-repo
gerritdrost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org> | ||
| # | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| name: create-build-tag | ||
|
|
||
| outputs: | ||
| build_tag: | ||
| description: 'The generated build tag' | ||
| value: ${{ steps.create-build-tag.outputs.build_tag }} | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Create build tag | ||
| id: create-build-tag | ||
| env: | ||
| # head_ref is available when a pull request triggers workflow, ref_name contains branch name outside of pull requests | ||
| BRANCH_NAME_RAW: ${{ github.head_ref || github.ref_name }} | ||
| COMMIT_SHA_RAW: ${{ github.sha }} | ||
| run: | | ||
| DATETIME=`date -u +"%Y-%m-%dT%H-%M-%S"` | ||
| BRANCH_NAME=`echo "${BRANCH_NAME_RAW}" | cut -c1-20 | sed 's|/|-|g'` | ||
| COMMIT_SHA=`echo "${COMMIT_SHA_RAW}" | cut -c 1-7` | ||
| echo "build_tag=${BRANCH_NAME}-${DATETIME}-${COMMIT_SHA}" >> "$GITHUB_OUTPUT" | ||
| shell: bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org> | ||
| # | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| name: Java & Gradle Setup | ||
| description: Setup runtime | ||
|
|
||
| inputs: | ||
| java_version: | ||
| description: 'The Java version to install.' | ||
| required: false | ||
| default: '25' | ||
| gradle_version: | ||
| description: 'The Gradle version to install. It do not force using this gradle version in other workflow steps, normally the installed gradle version of the project will be used.' | ||
| required: false | ||
| default: '9.1.0' | ||
| fetch-depth: | ||
| description: 'Number of commits to fetch. 0 indicates all history for all branches and tags.' | ||
| default: '1' | ||
| enable_caching: | ||
| description: 'If build and configuration caching should be enabled or disabled.' | ||
| default: 'true' | ||
| enable_daemon: | ||
| description: 'If build should be done using a separate gradle daemon.' | ||
| default: 'false' | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1 | ||
| with: | ||
| fetch-depth: ${{ inputs.fetch-depth }} | ||
|
|
||
| - name: Set up JDK | ||
| uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # 5.6.0 | ||
| with: | ||
| java-version: ${{ inputs.java_version }} | ||
| distribution: 'zulu' | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # 6.2.0 | ||
| with: | ||
| gradle-version: ${{ inputs.gradle_version }} | ||
|
|
||
| - name: Cache Gradle | ||
| if: ${{ inputs.enable_caching == 'true' }} | ||
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/settings.gradle*') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
|
|
||
| - name: Configure Gradle properties | ||
| shell: bash | ||
| env: | ||
| CACHING: ${{ inputs.enable_caching }} | ||
| DAEMON: ${{ inputs.enable_daemon }} | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p ~/.gradle | ||
| { | ||
| echo "ci=true" | ||
| echo "org.gradle.caching=${CACHING}" | ||
| echo "org.gradle.configuration-cache=${CACHING}" | ||
| echo "org.gradle.daemon=${DAEMON}" | ||
| } >> ~/.gradle/gradle.properties | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org> | ||
| # | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| name: Java CI with Gradle for library | ||
|
|
||
| on: | ||
| push: | ||
| workflow_dispatch: | ||
| inputs: | ||
| local_image_tag: | ||
| description: Local image tag used before push | ||
| required: false | ||
| type: string | ||
| default: application:0.0.1-SNAPSHOT | ||
| deploy_branch: | ||
| description: Branch required to push image | ||
| required: false | ||
| type: string | ||
| default: main | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| name: Build & Test | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write # Needed to load credentials | ||
| contents: read # Needed to read repository (content) | ||
| outputs: | ||
| build_tag: ${{ steps.create_tag.outputs.build_tag }} | ||
| environment: | ||
| name: ci | ||
| env: | ||
| LOCAL_IMAGE_TAG: ${{ inputs.local_image_tag }} | ||
| DEPLOY_BRANCH: ${{ inputs.deploy_branch }} | ||
| IMAGE_REPOSITORY_PREFIX: ${{ inputs.image_repository_prefix }}${{ inputs.namespace }} | ||
| IS_TAG: ${{ github.ref_type == 'tag' }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1 | ||
| with: | ||
| fetch-depth: 1 | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup runtime | ||
| uses: ./.github/actions/setup-runtime | ||
|
|
||
| - name: Cache Gradle | ||
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/settings.gradle*') }} | ||
|
|
||
| - name: Optimize Gradle | ||
| shell: bash | ||
| run: | | ||
| mkdir -p ~/.gradle | ||
| echo "org.gradle.caching=true" >> ~/.gradle/gradle.properties | ||
| echo "org.gradle.configuration-cache=true" >> ~/.gradle/gradle.properties | ||
|
|
||
| - name: Build & Run Tests | ||
| run: ./gradlew build --configuration-cache | ||
|
|
||
| - name: Create Build Tag | ||
| id: create_tag | ||
| uses: ./.github/actions/create-build-tag | ||
|
|
||
| - name: Repository Name | ||
| id: repo | ||
| shell: bash | ||
| run: | | ||
| echo "name=${GITHUB_REPOSITORY#*/}" >> "$GITHUB_OUTPUT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably needs to become temurin. Double check this.