forked from eclipse-uprotocol/up-transport-mqtt5-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: initial implementation up-java 0.1.10 #1 create maven project * feat: initial implementation up-java 0.1.10 #1 - dummy implementation - test setup - basic pipelines - documentation * feat: initial implementation up-java 0.1.11-SNAPSHOT #1 - implementation of send, registerListener and unregisterListener - added test cases for simple use-cases * feat: initial implementation up-java 0.1.11-SNAPSHOT #1 - added parsing of all MqttUserProperties to uAttributes in receiving messages use-case * feat: initial implementation up-java 0.1.11-SNAPSHOT #1 - replaced asserts with proper condition and error handling * feat: update to up-java 0.1.11 * chore: PR feedback inlined async methods, as the interface methods are now async removed incorrect copy right * fix: serialization of Uri in uAttributes * chore: added eclipse license disclaimer * chore: PR feedback sending messages: - added validation for uAttributes - refactor building methods before receiving message: - extract source and sink from MqttUserProperties * chore: check all uAttribute feelds for beeing set before converting these to MQTT Headers * refactor: remove static import to make it more readable
- Loading branch information
1 parent
5b3a639
commit ffe292c
Showing
24 changed files
with
1,573 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
This file contains 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,21 @@ | ||
name: Verify PR | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
verify-pr: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Build and Test with Maven | ||
run: mvn -B package --file pom.xml |
This file contains 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,30 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Apache Maven Central | ||
uses: actions/setup-java@v3 | ||
with: # configure settings.xml | ||
distribution: 'temurin' | ||
java-version: '17' | ||
server-id: ossrh | ||
server-username: OSSRH_USER | ||
server-password: OSSRH_PASSWORD | ||
|
||
- name: Build and Publish to OSSRH snapshot repo | ||
run: mvn clean deploy | ||
env: | ||
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} |
This file contains 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,56 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
# schedule: | ||
# - cron: '16 15 * * 1' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze (${{ matrix.language }}) | ||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} | ||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} | ||
permissions: | ||
# required for all workflows | ||
security-events: write | ||
|
||
# required to fetch internal or private CodeQL packs | ||
packages: read | ||
|
||
# only required for workflows in private repositories | ||
actions: read | ||
contents: read | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
# Analyzes Java code directly from the codebase without a build | ||
- language: java-kotlin | ||
build-mode: none # analyzes Java only | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Setup java 17. | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
build-mode: ${{ matrix.build-mode }} | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:${{matrix.language}}" |
This file contains 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,55 @@ | ||
name: Add coverage comment to PR | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Java Test and Coverage"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
add-coverage-comment: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
if: > | ||
github.event.workflow_run.event == 'pull_request' && | ||
github.event.workflow_run.conclusion == 'success' | ||
steps: | ||
- name: 'Download artifact' | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
script: | | ||
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id }}, | ||
}); | ||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "pr-comment" | ||
})[0]; | ||
var download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/pr-comment.zip', Buffer.from(download.data)); | ||
- run: unzip pr-comment.zip | ||
|
||
- name: 'Comment on PR' | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
var fs = require('fs'); | ||
const issue_number = Number(fs.readFileSync('./pr-number.txt')); | ||
const body = fs.readFileSync('./body.txt', { encoding: 'utf8', flag: 'r' }); | ||
await github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue_number, | ||
body: body | ||
}); |
This file contains 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 @@ | ||
name: Java Test and Coverage | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-and-coverage: | ||
name: Test with coverage | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- run: | | ||
git config --global user.name 'eclipse-uprotocol-bot' | ||
git config --global user.email '[email protected]' | ||
- name: Checkout code | ||
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
|
||
- name: Set up Apache Maven Central | ||
uses: actions/setup-java@v3 | ||
with: # configure settings.xml | ||
distribution: 'temurin' | ||
java-version: '17' | ||
server-id: ossrh | ||
server-username: OSSRH_USER | ||
server-password: OSSRH_PASSWORD | ||
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }} | ||
gpg-passphrase: GPG_PASSPHRASE | ||
|
||
|
||
- name: Run tests with coverage | ||
run: | | ||
mvn clean test jacoco:report | ||
- name: Extract JaCoCo report | ||
run: | | ||
echo "Extracting coverage percentage from JaCoCo report" | ||
INDEX_PATH="target/site/jacoco/index.html" | ||
export COVERAGE_PERCENTAGE=$(grep -oP '(?<=<td class="ctr2">).*?(?=%</td>)' $INDEX_PATH | sed 's/ //g') | ||
export COVERAGE_PERCENTAGE=$(printf "%.2f" "$COVERAGE_PERCENTAGE") | ||
echo "COVERAGE_PERCENTAGE= $COVERAGE_PERCENTAGE" >> $GITHUB_ENV | ||
echo "COVERAGE_PERCENTAGE: $COVERAGE_PERCENTAGE" | ||
- name: Upload JaCoCo Coverage report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-report | ||
path: target/site/jacoco | ||
|
||
- name: Generate coverage comment | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const COVERAGE_PERCENTAGE = `${{ env.COVERAGE_PERCENTAGE }}`; | ||
const COVERAGE_REPORT_PATH = `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/`; | ||
fs.mkdirSync('./pr-comment', { recursive: true }); | ||
var pr_number = `${{ github.event.number }}`; | ||
var body = ` | ||
Code coverage report is ready! :chart_with_upwards_trend: | ||
- **Code Coverage Percentage:** ${COVERAGE_PERCENTAGE}% | ||
- **Code Coverage Report:** [View Coverage Report](${COVERAGE_REPORT_PATH}) | ||
`; | ||
fs.writeFileSync('./pr-comment/pr-number.txt', pr_number); | ||
fs.writeFileSync('./pr-comment/body.txt', body); | ||
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | ||
with: | ||
name: pr-comment | ||
path: pr-comment/ |
This file contains 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,50 @@ | ||
name: Release to maven central | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
if: github.event.ref == 'refs/heads/main' | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- run: | | ||
git config --global user.name 'eclipse-uprotocol-bot' | ||
git config --global user.email '[email protected]' | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
|
||
- name: Set up Apache Maven Central | ||
uses: actions/setup-java@v3 | ||
with: # configure settings.xml | ||
distribution: 'temurin' | ||
java-version: '17' | ||
server-id: ossrh | ||
server-username: OSSRH_USER | ||
server-password: OSSRH_PASSWORD | ||
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }} | ||
gpg-passphrase: GPG_PASSPHRASE | ||
|
||
- name: Stage to Nexus and Release to Maven central | ||
run: | | ||
mvn -B release:clean release:prepare -P release release:perform | ||
env: | ||
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} | ||
GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} | ||
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
|
||
- if: cancelled() || failure() | ||
run: | | ||
mvn -B release:rollback | ||
env: | ||
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} |
This file contains 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,98 @@ | ||
### Maven template | ||
target/ | ||
pom.xml.tag | ||
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
pom.xml.next | ||
release.properties | ||
dependency-reduced-pom.xml | ||
buildNumber.properties | ||
.mvn/timing.properties | ||
# https://github.com/takari/maven-wrapper#usage-without-binary-jar | ||
.mvn/wrapper/maven-wrapper.jar | ||
|
||
# Eclipse m2e generated files | ||
# Eclipse Core | ||
.project | ||
# JDT-specific (Eclipse Java Development Tools) | ||
.classpath | ||
|
||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# AWS User-specific | ||
.idea/**/aws.xml | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# SonarLint plugin | ||
.idea/sonarlint/ | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
Oops, something went wrong.