Skip to content

Commit

Permalink
refactor event hash generator: rename packages
Browse files Browse the repository at this point in the history
add support for Quarkus arc deployments
  • Loading branch information
sboeckelmann committed Jun 25, 2024
1 parent 8ea43c6 commit cd5846f
Show file tree
Hide file tree
Showing 48 changed files with 821 additions and 254 deletions.
60 changes: 32 additions & 28 deletions .github/workflows/maven-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
steps:
- name: checkout from git
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up GraalVM 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'temurin'
java-version: '21'
distribution: 'graalvm-community'
cache: maven
- name: Install gpg secret key
run: |
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: 'quarkus-app/target/openepcis-event-hash-generator-service-runner.jar'
asset_path: 'quarkus/quarkus-app/target/openepcis-event-hash-generator-service-runner.jar'
asset_name: 'openepcis-event-hash-generator-service-${{env.GIT_TAG_NAME}}.jar'
asset_content_type: application/java-archive
- name: 'Upload Release CLI Asset'
Expand Down Expand Up @@ -139,11 +139,11 @@ jobs:
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up GraalVM 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'temurin'
java-version: '21'
distribution: 'graalvm-community'
cache: maven

- name: "Prepare Build"
Expand All @@ -152,7 +152,7 @@ jobs:
- name: "Build ${{matrix.platform}} native Image"
run: |
mvn --no-transfer-progress --batch-mode -Pci-build package -Dnative -DskipTests -f ./quarkus-app/pom.xml \
mvn --no-transfer-progress --batch-mode -Pci-build package -Dnative -DskipTests -f ./quarkus/quarkus-app/pom.xml \
-Dquarkus.native.container-build=true \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.name=event-hash-generator-service-native \
Expand Down Expand Up @@ -232,11 +232,11 @@ jobs:
id: builder
uses: docker/setup-buildx-action@v1

- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up GraalVM 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'temurin'
java-version: '21'
distribution: 'graalvm-community'
cache: maven

- name: "Prepare Build"
Expand All @@ -246,7 +246,7 @@ jobs:
- name: "Build linux/amd64 Image"
run: |
mvn --no-transfer-progress --batch-mode \
clean package -Pci-build -f ./quarkus-app/pom.xml \
clean package -Pci-build -f ./quarkus/quarkus-app/pom.xml \
-Dquarkus.container-image.name=event-hash-generator-service \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.registry=ghcr.io \
Expand All @@ -258,7 +258,7 @@ jobs:
- name: "Build linux/arm64 Image"
run: |
mvn --no-transfer-progress --batch-mode \
clean package -Pci-build -f ./quarkus-app/pom.xml \
clean package -Pci-build -f ./quarkus/quarkus-app/pom.xml \
-Dquarkus.container-image.name=event-hash-generator-service \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.registry=ghcr.io \
Expand Down Expand Up @@ -290,16 +290,19 @@ jobs:

strategy:
matrix:
os: ['ubuntu-latest', 'ubuntu-22.04-arm64', 'macos-latest', 'windows-latest']
os: ['ubuntu-latest', 'ubuntu-22.04-arm64', "macos-13", 'macos-latest', 'windows-latest']
include:
- os: 'ubuntu-latest'
label: 'linux-amd64'
exe: ""
- os: 'ubuntu-22.04-arm64'
label: 'linux-arm64'
exe: ""
- os: 'macos-13'
label: 'mac-x64'
exe: ""
- os: 'macos-latest'
label: 'mac'
label: 'mac-arm'
exe: ""
- os: 'windows-latest'
label: 'windows'
Expand Down Expand Up @@ -330,10 +333,10 @@ jobs:
run: |
echo "::set-env name=UPLOAD_URL::$(cat upload_url.txt)"
- name: Set up GraalVM
- name: Set up GraalVM 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
java-version: '21'
distribution: 'graalvm-community'
native-image-job-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -344,7 +347,7 @@ jobs:
- name: "Build Native Quarkus Executable"
run: |
mvn --no-transfer-progress --batch-mode clean package -Pnative -Pci-build -DskipTests -f ./quarkus-app/pom.xml
mvn --no-transfer-progress --batch-mode clean package -Pnative -Pci-build -DskipTests -f ./quarkus/quarkus-app/pom.xml
- name: 'Release Native Quarkus Executable'
if: success() && contains(github.ref, 'v')
Expand All @@ -355,24 +358,27 @@ jobs:
with:
upload_url: ${{env.UPLOAD_URL}}
asset_name: 'openepcis-event-hash-generator-service-runner-${{env.GIT_TAG_NAME}}-${{matrix.label}}${{matrix.exe}}'
asset_path: 'quarkus-app/target/openepcis-event-hash-generator-service-runner${{matrix.exe}}'
asset_path: 'quarkus/quarkus-app/target/openepcis-event-hash-generator-service-runner${{matrix.exe}}'
asset_content_type: application/octet-stream

build-cli-native-executable:
name: 'Build CLI Native Executable'
needs: [build-jar-job]
strategy:
matrix:
os: ['ubuntu-latest', 'ubuntu-22.04-arm64', 'macos-latest', 'windows-latest']
os: ['ubuntu-latest', 'ubuntu-22.04-arm64', "macos-13", 'macos-latest', 'windows-latest']
include:
- os: 'ubuntu-latest'
label: 'linux-amd64'
exe: ""
- os: 'ubuntu-22.04-arm64'
label: 'linux-arm64'
exe: ""
- os: 'macos-13'
label: 'mac-x64'
exe: ""
- os: 'macos-latest'
label: 'mac'
label: 'mac-arm'
exe: ""
- os: 'windows-latest'
label: 'windows'
Expand All @@ -382,13 +388,11 @@ jobs:
- name: checkout from git
uses: actions/checkout@v3

- name: Set up GraalVM
- name: Set up GraalVM 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
java-version: '21'
distribution: 'graalvm-community'
native-image-job-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: 'Get Version Number'
env:
Expand Down
4 changes: 2 additions & 2 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.openepcis.epc.eventhash.main.HashGenerator</Main-Class>
<Main-Class>io.openepcis.eventhash.main.HashGenerator</Main-Class>
<Specification-Title>${project.artifactId}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Title>${project.artifactId}</Implementation-Title>
Expand Down Expand Up @@ -136,7 +136,7 @@
</executions>
<configuration>
<imageName>epcis-event-hash</imageName>
<mainClass>io.openepcis.epc.eventhash.main.HashGenerator</mainClass>
<mainClass>io.openepcis.eventhash.main.HashGenerator</mainClass>
<buildArgs>
<arg>--enable-all-security-services</arg>
<arg>--enable-http</arg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash.main;
package io.openepcis.eventhash.main;

import io.openepcis.epc.eventhash.EventHashGenerator;
import io.openepcis.eventhash.EventHashGenerator;
import java.io.*;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash;
package io.openepcis.eventhash;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import io.openepcis.constants.CBVVersion;
import io.openepcis.constants.EPCIS;
import io.openepcis.epc.eventhash.constant.ConstantEventHashInfo;
import io.openepcis.eventhash.constant.ConstantEventHashInfo;
import io.openepcis.epc.translator.util.ConverterUtil;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -29,7 +29,7 @@
import java.util.*;
import java.util.stream.Collectors;

import static io.openepcis.epc.eventhash.constant.ConstantEventHashInfo.*;
import static io.openepcis.eventhash.constant.ConstantEventHashInfo.*;

/**
* This class is utilized by EventHash and SaxHandler during the parsing of XML/JSON EPCIS document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash;
package io.openepcis.eventhash;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.JsonNode;
import io.openepcis.epc.eventhash.exception.EventHashException;
import jakarta.inject.Inject;
import io.openepcis.eventhash.exception.EventHashException;
import jakarta.inject.Singleton;
import lombok.RequiredArgsConstructor;
import org.eclipse.microprofile.context.ManagedExecutor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash;
package io.openepcis.eventhash;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.openepcis.constants.CBVVersion;
import io.openepcis.constants.EPCIS;
import io.openepcis.epc.eventhash.constant.ConstantEventHashInfo;
import io.openepcis.epc.eventhash.exception.EventHashException;
import io.openepcis.eventhash.constant.ConstantEventHashInfo;
import io.openepcis.eventhash.exception.EventHashException;
import io.openepcis.reactive.publisher.ObjectNodePublisher;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.subscription.MultiEmitter;
Expand All @@ -31,7 +31,6 @@
import java.util.function.Consumer;
import javax.xml.parsers.SAXParserFactory;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash;
package io.openepcis.eventhash;

import io.openepcis.constants.CBVVersion;
import jakarta.xml.bind.DatatypeConverter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash;
package io.openepcis.eventhash;

import java.util.ArrayList;
import java.util.Comparator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash;
package io.openepcis.eventhash;

import io.openepcis.constants.EPCIS;
import io.openepcis.epc.eventhash.constant.ConstantEventHashInfo;
import io.openepcis.eventhash.constant.ConstantEventHashInfo;
import io.smallrye.mutiny.subscription.MultiEmitter;
import java.util.ArrayDeque;
import java.util.Deque;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash;
package io.openepcis.eventhash;

import io.openepcis.constants.EPCIS;
import io.openepcis.epc.eventhash.constant.ConstantEventHashInfo;
import io.openepcis.eventhash.constant.ConstantEventHashInfo;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash.constant;
package io.openepcis.eventhash.constant;

import static java.util.Map.entry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash.exception;
package io.openepcis.eventhash.exception;

public class EventHashException extends RuntimeException {
public EventHashException(String msg, Throwable parent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash;
package io.openepcis.eventhash;

import io.openepcis.constants.CBVVersion;
import io.smallrye.mutiny.Multi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.openepcis.epc.eventhash;
package io.openepcis.eventhash;

import static org.junit.Assert.assertEquals;

Expand Down
Loading

0 comments on commit cd5846f

Please sign in to comment.