Skip to content

Commit

Permalink
Update CI and Add Release Github Action workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
pacphi committed Oct 18, 2024
1 parent e6c9d32 commit 34f0c6b
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 4 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ jobs:
name: Java ${{ matrix.java }} build
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: liberica
java-version: ${{ matrix.java }}
- name: Build with Gradle
run: ./gradlew build
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle, target Chroma vector store and leverage OpenAI API for model interaction
run: ./gradlew clean build -Pvector-db-provider=chroma
- name: Build with Gradle, target Chroma vector store and leverage Ollama for model interaction
run: ./gradlew clean build -Pvector-db-provider=chroma -Pmodel-api-provider=ollama
- name: Build with Gradle, target PgVector vector store and leverage OpenAI API for model interaction
run: ./gradlew clean build -Pvector-db-provider=pgvector
- name: Build with Gradle, target PgVector vector store and leverage Ollama for model interaction
run: ./gradlew clean build -Pvector-db-provider=pgvector -Pmodel-api-provider=ollama
72 changes: 72 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Publish package to GitHub Packages
on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- vector-db: chroma
model-api: openai
jar-base-name: robert-openai-chroma
- vector-db: chroma
model-api: ollama
jar-base-name: robert-ollama-chroma
- vector-db: pgvector
model-api: openai
jar-base-name: robert-openai-pgvector
- vector-db: pgvector
model-api: ollama
jar-base-name: robert-ollama-pgvector
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: liberica
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build artifact
run: |
./gradlew clean setVersion -PnewVersion=${{ github.event.release.tag_name }}
cat gradle.properties
./gradlew build -Pvector-db-provider=${{ matrix.vector-db }} -Pmodel-api-provider=${{ matrix.model-api }} -PjarBaseName=${{ matrix.jar-base-name }}
echo "Contents of build/libs:"
ls -l build/libs
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.jar-base-name }}
path: build/libs/${{ matrix.jar-base-name }}-${{ github.event.release.tag_name }}.jar
if-no-files-found: error
retention-days: 1

publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
actions: read
issues: read
packages: write
pull-requests: read
repository-projects: read
statuses: read
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Publish assets and generate release notes
uses: softprops/action-gh-release@v2
with:
files: |
*/*.jar
fail_on_unmatched_files: true
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}

27 changes: 25 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ plugins {
}

group = 'org.cftoolsuite'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
Expand Down Expand Up @@ -70,6 +69,30 @@ tasks.named('test') {
useJUnitPlatform()
}

bootJar {
archiveBaseName = project.findProperty('jarBaseName') ?: project.name
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

bootRun {
systemProperties System.properties
}
}

jar {
archiveBaseName = project.findProperty('jarBaseName') ?: project.name
}

task setVersion {
doLast {
def newVersion = project.hasProperty('newVersion') ? project.newVersion : version
ant.propertyfile(file: "gradle.properties") {
entry(key: "version", value: newVersion)
}
}
}

task printArtifactPath {
doLast {
println bootJar.archiveFile.get().asFile.absolutePath
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=0.0.1-SNAPSHOT

0 comments on commit 34f0c6b

Please sign in to comment.