Skip to content

Commit

Permalink
Merge pull request #26 from dddj698/up1.5.8
Browse files Browse the repository at this point in the history
Update to uProtocol 1.5.8
  • Loading branch information
dddj698 authored Jul 10, 2024
2 parents f57b440 + 2683c57 commit 3953648
Show file tree
Hide file tree
Showing 82 changed files with 2,290 additions and 10,984 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build and Test with Maven
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/setup-java@v3
with: # configure settings.xml
distribution: 'temurin'
java-version: '11'
java-version: '17'
server-id: ossrh
server-username: OSSRH_USER
server-password: OSSRH_PASSWORD
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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}}"
<!--
~ SPDX-FileCopyrightText: 2024 Contributors to the Eclipse Foundation
~
~ See the NOTICE file(s) distributed with this work for additional
~ information regarding copyright ownership.
~
~ This program and the accompanying materials are made available under the
~ terms of the Apache License Version 2.0 which is available at
~ https://www.apache.org/licenses/LICENSE-2.0
~
~ SPDX-License-Identifier: Apache-2.0
-->

55 changes: 55 additions & 0 deletions .github/workflows/coverage-comment-pr.yml
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
});
78 changes: 78 additions & 0 deletions .github/workflows/coverage.yml
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/
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-java@v3
with: # configure settings.xml
distribution: 'temurin'
java-version: '11'
java-version: '17'
server-id: ossrh
server-username: OSSRH_USER
server-password: OSSRH_PASSWORD
Expand Down
1 change: 0 additions & 1 deletion NOTICE.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ SPDX-License-Identifier: Apache-2.0

The following are libraries that uProtocol project uses:

* http://cloudevents.io
* http://protobuf.dev

NOTE: Please refer to link:pom.xml[] for more information of library dependencies
33 changes: 6 additions & 27 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,24 @@ To pull the Library from maven central, setting ${uprotocol.version} to the late

=== Using The Library

.Package Folders
[#pkg-folders,width=100%,cols="20%,80%",options="header"]
|===

| Folder | Purpose

| `*builder*` or `*factory*`
| Contains factory methods for creating uProtocol data types

| `*serializer*`
| Contains serializers to convert the objects into byte or string form representation of said object

| `*validator*`
| Contains validators to validate the data types and report errors if the objects are missing or incorrect

|===


.SDK Packages
[#sdk-packages,width=100%,cols="20%,80%",options="header"]
|===

| Package | Purpose

| xref:src/main/kotlin/org/eclipse/uprotocol/communication/README.adoc[`*communication*`]
| Top level client-facing https://github.com/eclipse-uprotocol/up-spec/tree/main/up-l2[communication layer (uP-L2)] interfaces that applications and services use to implement the publisher/subscriber, notification, and RPC patterns on top of the transport layer (uTransport) API.

| link:src/main/kotlin/org/eclipse/uprotocol/uri/README.adoc[`*uuri*`]
| Uniform Resource Identifier (RFC3986), how uProtocol addresses things (devices, software, methods, topics, etc...) on the network
| Builders, validators, and serializers for uProtocol addressing scheme (UUri).


| link:src/main/kotlin/org/eclipse/uprotocol/uuid/README.adoc[`*uuid*`]
| Identifier used to uniquely identify (and timestamp) messages that are sent

| link:src/main/java/org/eclipse/uprotocol/transport/README.adoc[`*transport*`]
| Interface declaration used for bidirectional point-2-point communication between uEs. This interface is then implemented by https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/upclient.adoc[uPClient] libraries for a given underlining transport (ex. Binder, MQTT, Zenoh, SOME/IP, DDS, HTTP, etc…​)

| link:src/main/kotlin/org/eclipse/uprotocol/cloudevent/README.adoc[`*cloudevent*`]
| Common way to represent uProtocol messages using CloudEvent data model used by some transports (ex. MQTT, HTTP, etc…​)

| link:src/main/java/org/eclipse/uprotocol/rpc/README.adoc[`*rpc*`]
| RPC client and server-side interfaces that are to be implemented by uLink libraries
| link:src/main/kotlin/org/eclipse/uprotocol/transport/README.adoc[`*transport*`]
| https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l1/README.adoc[uP-L1 Transport Layer] interface and data model that wraps communication middlewares like zenoh, mqtt, http, etc... into a thin and simple to use transport interface. This model is used by the communication layer (uP-L2) to send and receive messages and transports are expected to implement the link:src/main/kotlin/org/eclipse/uprotocol/transport/UTransport.kt[uTransport] interface.

|===

Expand Down
Loading

0 comments on commit 3953648

Please sign in to comment.