Skip to content

Commit

Permalink
Merge pull request #69 from openbase/feature/#57_switch_build_system_…
Browse files Browse the repository at this point in the history
…from_maven_to_gradle

Feature/#57 switch build system from maven to gradle
  • Loading branch information
DivineThreepwood authored Mar 22, 2022
2 parents 1254a30 + 1b19466 commit c1d8c81
Show file tree
Hide file tree
Showing 475 changed files with 1,750 additions and 2,489 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build and Test

on:
push:
branches:
- dev
pull_request:
branches:
- dev
- beta
- "epic/**"
types: [opened, synchronize, reopened, ready_for_review]

jobs:
build:
name: "Build"
timeout-minutes: 10

if: github.event.pull_request.draft == false

runs-on: ubuntu-latest

steps:
- name: "Checkout Branch"
uses: actions/checkout@v2

- name: "Setup Java"
uses: actions/setup-java@v1
with:
java-version: 17

- name: Setup Gradle cache
uses: actions/[email protected]
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }}
restore-keys: |
${{ runner.os }}-gradle
- name: "build backend"
run: ./gradlew build -x test

- name: Upload Gradle reports
uses: actions/[email protected]
if: ${{ failure() }}
with:
name: Build Backend Reports
path: "**/build/reports"

test:
name: "Test"
timeout-minutes: 30

if: github.event.pull_request.draft == false
needs: build

runs-on: ubuntu-latest

steps:
- name: "Checkout Branch"
uses: actions/checkout@v2

- name: "Setup Java"
uses: actions/setup-java@v1
with:
java-version: 17

- name: Setup Gradle cache
uses: actions/[email protected]
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }}
restore-keys: |
${{ runner.os }}-gradle
- name: "test backend"
run: ./gradlew check
env:
RUN_LONG_INTEGRATION_TESTS: false

- name: Upload Gradle reports
uses: actions/[email protected]
if: ${{ failure() }}
with:
name: Test Backend Reports
path: "**/build/reports"
103 changes: 103 additions & 0 deletions .github/workflows/inspect-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# This workflow performs a static analysis of your Kotlin source code using
# Detekt.
#
# Scans are triggered:
# 1. On every push to default and protected branches
# 2. On every Pull Request targeting the default branch
# 3. On a weekly schedule
# 4. Manually, on demand, via the "workflow_dispatch" event
#
# The workflow should work with no modifications, but you might like to use a
# later version of the Detekt CLI by modifing the $DETEKT_RELEASE_TAG
# environment variable.
name: Scan with Detekt

on:
# Triggers the workflow on push or pull request events but only for default and protected branches
push:
branches: [ dev, beta, stable ]
pull_request:
branches: [ dev ]
schedule:
- cron: '19 11 * * 4'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
# Release tag associated with version of Detekt to be installed
# SARIF support (required for this workflow) was introduced in Detekt v1.15.0
DETEKT_RELEASE_TAG: v1.15.0

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "scan"
scan:
name: Scan
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Gets the download URL associated with the $DETEKT_RELEASE_TAG
- name: Get Detekt download URL
id: detekt_info
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DETEKT_DOWNLOAD_URL=$( gh api graphql --field tagName=$DETEKT_RELEASE_TAG --raw-field query='
query getReleaseAssetDownloadUrl($tagName: String!) {
repository(name: "detekt", owner: "detekt") {
release(tagName: $tagName) {
releaseAssets(name: "detekt", first: 1) {
nodes {
downloadUrl
}
}
}
}
}
' | \
jq --raw-output '.data.repository.release.releaseAssets.nodes[0].downloadUrl' )
echo "::set-output name=download_url::$DETEKT_DOWNLOAD_URL"
# Sets up the detekt cli
- name: Setup Detekt
run: |
dest=$( mktemp -d )
curl --request GET \
--url ${{ steps.detekt_info.outputs.download_url }} \
--silent \
--location \
--output $dest/detekt
chmod a+x $dest/detekt
echo $dest >> $GITHUB_PATH
# Performs static analysis using Detekt
- name: Run Detekt
continue-on-error: true
run: |
detekt --input ${{ github.workspace }} --report sarif:${{ github.workspace }}/detekt.sarif.json
# Modifies the SARIF output produced by Detekt so that absolute URIs are relative
# This is so we can easily map results onto their source files
# This can be removed once relative URI support lands in Detekt: https://git.io/JLBbA
- name: Make artifact location URIs relative
continue-on-error: true
run: |
echo "$(
jq \
--arg github_workspace ${{ github.workspace }} \
'. | ( .runs[].results[].locations[].physicalLocation.artifactLocation.uri |= if test($github_workspace) then .[($github_workspace | length | . + 1):] else . end )' \
${{ github.workspace }}/detekt.sarif.json
)" > ${{ github.workspace }}/detekt.sarif.json
# Uploads results to GitHub repository using the upload-sarif action
- uses: github/codeql-action/upload-sarif@v1
with:
# Path to SARIF file relative to the root of the repository
sarif_file: ${{ github.workspace }}/detekt.sarif.json
checkout_path: ${{ github.workspace }}
55 changes: 0 additions & 55 deletions .github/workflows/maven-publish.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/publish-jars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish
on:
release:
types: [created]
push:
branches:
- dev
jobs:
publish:
name: Publish Artifacts
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Publish package
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_OPENBASE_GPG_PRIVATE_KEY: ${{ secrets.OPENBASE_GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_OPENBASE_GPG_PRIVATE_KEY_PASSPHRASE: ""
ORG_GRADLE_PROJECT_MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
# jul
# JUL - A Java Utility Library

[![Dev](https://github.com/openbase/jul/actions/workflows/build-and-test.yml/badge.svg?branch=dev)](https://github.com/openbase/jul/actions/workflows/build-and-test.yml)
[![Maven Central](https://img.shields.io/maven-central/v/org.openbase/jul.svg?label=Latest%20Version)](https://search.maven.org/artifact/org.openbase/jul)

A collection of java / kotlin utilities featured by [openbase.org](https://openbase.org).

## Features
* MQTT RPC Communication Pattern
* MQTT Server - Client Communication Pattern
* Advanced Exception Handling Utilities
* Protobuf in Memory Repositories with JSon persistence.

## Contribution

Feel free to report feature requests and discovered bugs via [github](https://github.com/openbase/jul/issues/new).
- If you want to contribute to jul, just fork the repositories, apply your changes and create a new pull request.
- For long term contribution you are welcome to apply for an openbase membership via [email protected] or by joining our [Discord Server](https://discord.com/invite/M48eh76f?utm_source=Discord%20Widget&utm_medium=Connect).

## Development

### Update Gradle Dependencies

We are using a plugin called `Gradle refreshVersions` to manage all our backend dependencies. Thus, all dependencies
declared within `build.gradle.kts` provide a placeholder `_` for their version while each version is maintained within
the `versions.properties`.

```
testImplementation("io.mockk:mockk:_")
```

In order to check for updates just execute `gradle refreshVersions`. Afterwards, you will find all latest versions
within the `versions.properties` file.

```
version.mockk=1.11.0
### available=1.12.0
```

In order to update a dependency, just add the version you prefer to the version declaration in `versions.properties`.

```
version.mockk=1.12.0
```

The next gradle build will use the new dependency version without any further steps being required. Don't forget to sync
your gradle settings within IntelliJ in case you are not using the gradle `auto-reload setting` feature.

Further details about the plugin can be found at: https://jmfayard.github.io/refreshVersions/

42 changes: 0 additions & 42 deletions annotation/pom.xml

This file was deleted.

Loading

0 comments on commit c1d8c81

Please sign in to comment.