Skip to content

Commit

Permalink
Set up Release Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez committed Oct 11, 2024
1 parent 3815068 commit d6c5413
Show file tree
Hide file tree
Showing 38 changed files with 468 additions and 1,482 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
4 changes: 4 additions & 0 deletions .github/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: SmallRye LLM
release:
current-version: 1.0.0-SNAPSHOT
next-version: 1.0.0-SNAPSHOT
64 changes: 64 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: SmallRye Build

on:
push:
branches:
- main
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- 'NOTICE'
- 'README*'
pull_request:
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- 'NOTICE'
- 'README*'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [17, 21]
name: build with jdk ${{matrix.java}}

steps:
- uses: actions/checkout@v4
name: checkout

- uses: actions/setup-java@v4
name: set up jdk ${{matrix.java}}
with:
distribution: 'temurin'
java-version: ${{matrix.java}}
cache: 'maven'
cache-dependency-path: '**/pom.xml'

- name: build with maven
run: mvn -B formatter:validate verify --file pom.xml

build-windows:
runs-on: windows-latest
strategy:
matrix:
java: [17, 21]
name: build with jdk ${{matrix.java}} windows

steps:
- uses: actions/checkout@v4
name: checkout

- uses: actions/setup-java@v4
name: set up jdk ${{matrix.java}}
with:
distribution: 'temurin'
java-version: ${{matrix.java}}
cache: 'maven'
cache-dependency-path: '**/pom.xml'

- name: build with maven
run: mvn -B formatter:validate verify --file pom.xml
18 changes: 18 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: SmallRye Prepare Release

on:
pull_request:
types: [ closed ]
paths:
- '.github/project.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
prepare-release:
name: Prepare Release
if: ${{ github.event.pull_request.merged == true}}
uses: smallrye/.github/.github/workflows/prepare-release.yml@main
secrets: inherit
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: SmallRye Release
run-name: Release ${{github.event.inputs.tag || github.ref_name}}
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release'
required: true

permissions:
attestations: write
id-token: write
# Needed for the publish-* workflows
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
perform-release:
name: Perform Release
uses: smallrye/.github/.github/workflows/perform-release.yml@main
secrets: inherit
with:
version: ${{github.event.inputs.tag || github.ref_name}}
31 changes: 31 additions & 0 deletions .github/workflows/review-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: SmallRye Review Release

on:
pull_request:
paths:
- '.github/project.yml'

jobs:
release:
runs-on: ubuntu-latest
name: pre release

steps:
- uses: radcortez/project-metadata-action@main
name: retrieve project metadata
id: metadata
with:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yml'

- name: Validate version
if: contains(steps.metadata.outputs.current-version, 'SNAPSHOT')
run: |
echo '::error::Cannot release a SNAPSHOT version.'
exit 1
- uses: radcortez/milestone-review-action@main
name: milestone review
with:
github-token: ${{secrets.GITHUB_TOKEN}}
milestone-title: ${{steps.metadata.outputs.current-version}}
17 changes: 17 additions & 0 deletions .github/workflows/update-milestone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Update Milestone

on:
pull_request_target:
types: [closed]

jobs:
update:
runs-on: ubuntu-latest
name: update-milestone
if: ${{github.event.pull_request.merged == true}}

steps:
- uses: radcortez/milestone-set-action@main
name: milestone set
with:
github-token: ${{secrets.GITHUB_TOKEN}}
11 changes: 9 additions & 2 deletions examples/glassfish-car-booking/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
<artifactId>examples</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>glassfish-car-booking</artifactId>
<packaging>war</packaging>
<name>glassfish-car-booking Maven Webapp</name>
<url>http://maven.apache.org</url>
<name>SmallRye LLM Examples: Glassfish Car Booking</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
Expand All @@ -18,6 +19,7 @@
<cargo.servlet.port>8080</cargo.servlet.port>
<cargo.zipUrlInstaller.downloadDir>${project.build.directory}/../installs</cargo.zipUrlInstaller.downloadDir>
</properties>

<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
Expand Down Expand Up @@ -94,6 +96,11 @@
<build>
<finalName>glassfish-car-booking</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven3-plugin</artifactId>
Expand Down
30 changes: 23 additions & 7 deletions examples/helidon-car-booking-portable-ext/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,38 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.helidon.applications</groupId>
<artifactId>helidon-mp</artifactId>
<version>4.0.7</version>
<relativePath />
<groupId>io.smallrye.llm.examples</groupId>
<artifactId>examples</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>helidon-car-booking-portable-ext</artifactId>
<groupId>io.smallrye.llm.examples</groupId>
<version>1.0</version>
<name>SmallRye LLM Examples: Helidon Car Booking Portable Extension</name>

<properties>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dev.langchain4j.version>0.34.0</dev.langchain4j.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.helidon</groupId>
<artifactId>helidon-bom</artifactId>
<version>4.0.7</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.helidon</groupId>
<artifactId>helidon-dependencies</artifactId>
<version>4.0.7</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.smallrye.llm</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.jefrajames.booking;

import java.time.LocalDate;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Data
@NoArgsConstructor
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ public class BookingAlreadyCanceledException extends RuntimeException {
public BookingAlreadyCanceledException(String bookingNumber) {
super("Booking " + bookingNumber + " already canceled");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ public class BookingCannotBeCanceledException extends RuntimeException {
public BookingCannotBeCanceledException(String bookingNumber) {
super("Booking " + bookingNumber + " cannot be canceled");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class BookingService {
}

// Simulate database accesses
private Booking checkBookingExists(String bookingNumber,String name, String surname) {
private Booking checkBookingExists(String bookingNumber, String name, String surname) {
Booking booking = BOOKINGS.get(bookingNumber);
if (booking == null || !booking.getCustomer().getName().equals(name)
|| !booking.getCustomer().getSurname().equals(surname)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,7 @@ public class CarBookingResource {
@Operation(summary = "Chat with an asssitant.", description = "Ask any car booking related question.", operationId = "chatWithAssistant")
@APIResponse(responseCode = "200", description = "Anwser provided by assistant", content = @Content(mediaType = "text/plain"))
public String chatWithAssistant(
@Parameter(
description = "The question to ask the assistant",
required = true,
example = "I want to book a car how can you help me?"
)
@QueryParam("question")
String question
) {
@Parameter(description = "The question to ask the assistant", required = true, example = "I want to book a car how can you help me?") @QueryParam("question") String question) {

String answer;
try {
Expand All @@ -55,19 +48,9 @@ public String chatWithAssistant(
@Operation(summary = "Detect for a customer.", description = "Detect fraud for a customer given his name and surname.", operationId = "detectFraudForCustomer")
@APIResponse(responseCode = "200", description = "Anwser provided by assistant", content = @Content(mediaType = "application/json"))
public FraudResponse detectFraudForCustomer(
@Parameter(
description = "Name of the customer to detect fraud for.",
required = true,
example = "Bond")
@QueryParam("name")
String name,

@QueryParam("surname")
@Parameter(
description = "Surname of the customer to detect fraud for.",
required = true,
example = "James")
String surname) {
@Parameter(description = "Name of the customer to detect fraud for.", required = true, example = "Bond") @QueryParam("name") String name,

@QueryParam("surname") @Parameter(description = "Surname of the customer to detect fraud for.", required = true, example = "James") String surname) {
return fraudService.detectFraudForCustomer(name, surname);
}

Expand Down
Loading

0 comments on commit d6c5413

Please sign in to comment.