Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Publishing & Dokka #13

Merged
merged 8 commits into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/githubpages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: githubpages

on:
release:
types: [published]

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.kotlin.dsl.internal.io.timeout=120000 -Dorg.gradle.jvmargs="-Xmx5g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"

jobs:
githubpages:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Dokka
id: Dokka
run: ./gradlew -Pversion=${{ github.event.release.tag_name }} dokkaHtml

- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Publish stable version"

on:
workflow_dispatch:
branches: [main]
inputs:
version:
description: 'Version'
required: true
type: string

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.kotlin.dsl.internal.io.timeout=120000 -Dorg.gradle.jvmargs="-Xmx5g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
OSS_USER: '${{ secrets.OSS_USER }}'
OSS_TOKEN: '${{ secrets.OSS_TOKEN }}'
OSS_STAGING_PROFILE_ID: '${{ secrets.OSS_STAGING_PROFILE_ID }}'
SIGNING_KEY_NAME: '${{ secrets.SIGNING_KEY_NAME }}'
SIGNING_KEY_ID: '${{ secrets.SIGNING_KEY_ID }}'
franciscodr marked this conversation as resolved.
Show resolved Hide resolved
SIGNING_KEY_PASSPHRASE: '${{ secrets.SIGNING_KEY_PASSPHRASE }}'
SIGNING_KEY: '${{ secrets.SIGNING_KEY }}'

jobs:
publish:
timeout-minutes: 90
franciscodr marked this conversation as resolved.
Show resolved Hide resolved
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11

- name: assemble
uses: gradle/gradle-build-action@v2
with:
arguments: assemble -Pversion=${{ inputs.version }}

- name: Upload reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: 'reports-${{ matrix.os }}'
path: '**/build/reports/**'

- name: Publish final version
uses: gradle/gradle-build-action@v2
with:
arguments: -Pversion=${{ inputs.version }} publishToSonatype closeSonatypeStagingRepository
48 changes: 48 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Publish SNAPSHOT"

on:
push:
branches:
- main

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.kotlin.dsl.internal.io.timeout=120000 -Dorg.gradle.jvmargs="-Xmx5g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
OSS_USER: '${{ secrets.OSS_USER }}'
OSS_TOKEN: '${{ secrets.OSS_TOKEN }}'
OSS_STAGING_PROFILE_ID: '${{ secrets.OSS_STAGING_PROFILE_ID }}'
franciscodr marked this conversation as resolved.
Show resolved Hide resolved
SIGNING_KEY_NAME: '${{ secrets.SIGNING_KEY_NAME }}'
franciscodr marked this conversation as resolved.
Show resolved Hide resolved
SIGNING_KEY_ID: '${{ secrets.SIGNING_KEY_ID }}'
franciscodr marked this conversation as resolved.
Show resolved Hide resolved
SIGNING_KEY_PASSPHRASE: '${{ secrets.SIGNING_KEY_PASSPHRASE }}'
SIGNING_KEY: '${{ secrets.SIGNING_KEY }}'

jobs:
publish:
timeout-minutes: 90
franciscodr marked this conversation as resolved.
Show resolved Hide resolved
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11

- name: assemble
uses: gradle/gradle-build-action@v2
with:
arguments: assemble

- name: Upload reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: 'reports-${{ matrix.os }}'
path: '**/build/reports/**'

- name: Publish final version
uses: gradle/gradle-build-action@v2
with:
arguments: -Pversion=0.0.1-SNAPSHOT publishToSonatype
47 changes: 46 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@file:Suppress("DSL_SCOPE_VIOLATION")

import org.jetbrains.dokka.gradle.DokkaTask

group = "com.xebia.functional"
franciscodr marked this conversation as resolved.
Show resolved Hide resolved
version = "1.0-SNAPSHOT"

Expand All @@ -10,13 +12,23 @@ repositories {
plugins {
base
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.spotless)
alias(libs.plugins.kotlinx.serialization)
alias(libs.plugins.spotless)
alias(libs.plugins.dokka)
alias(libs.plugins.arrow.gradle.nexus)
alias(libs.plugins.arrow.gradle.publish)
}

allprojects {
group = property("projects.group").toString()
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

kotlin {
Expand Down Expand Up @@ -86,3 +98,36 @@ spotless {
ktfmt().googleStyle()
}
}

tasks {
withType<Test>().configureEach {
maxParallelForks = Runtime.getRuntime().availableProcessors()
useJUnitPlatform()
testLogging {
setExceptionFormat("full")
setEvents(listOf("passed", "skipped", "failed", "standardOut", "standardError"))
}
}

withType<DokkaTask>().configureEach {
kotlin.sourceSets.forEach { kotlinSourceSet ->
dokkaSourceSets.named(kotlinSourceSet.name) {
perPackageOption {
matchingRegex.set(".*\\.internal.*")
suppress.set(true)
}
skipDeprecated.set(true)
reportUndocumented.set(false)
val baseUrl: String = checkNotNull(project.properties["pom.smc.url"]?.toString())

kotlinSourceSet.kotlin.srcDirs.filter { it.exists() }.forEach { srcDir ->
sourceLink {
localDirectory.set(srcDir)
remoteUrl.set(uri("$baseUrl/blob/main/${srcDir.relativeTo(rootProject.rootDir)}").toURL())
remoteLineSuffix.set("#L")
}
}
}
}
}
}
18 changes: 18 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
kotlin.code.style=official
kotlin.js.compiler=ir

projects.group=com.xebia.functional
franciscodr marked this conversation as resolved.
Show resolved Hide resolved
pom.description=Building applications with LLMs through composability, in Kotlin
pom.url=https://github.com/xebia-functional/langchain4k
pom.license.name=The Apache Software License, Version 2.0
pom.license.url=https://www.apache.org/licenses/LICENSE-2.0.txt
pom.developer.id=arrow-kt
pom.developer.name=Xebia Functional
pom.smc.url=https://github.com/xebia-functional/langchain4k
pom.smc.connection=scm:git:git://github.com/xebia-functional/langchain4k.git
pom.smc.developerConnection=scm:git:ssh://git@github.com/xebia-functional/langchain4k.git

org.gradle.jvmargs=-Xmx4g
org.gradle.parallel=true
systemProp.org.gradle.unsafe.kotlin.assignment=true

# Workaround to disable Dokka setup from Arrow Gradle Config
dokkaEnabled=false
5 changes: 5 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[versions]
arrow = "1.2.0-RC"
arrowGradle = "0.11.0-alpha.1"
kotlin = "1.8.20"
openai = "0.12.0"
kotlinx-json = "1.5.0"
Expand All @@ -14,6 +15,7 @@ uuid = "0.0.18"
postgresql = "42.5.1"
testcontainers = "1.17.6"
hikari = "5.0.1"
dokka = "1.8.10"

[libraries]
arrow-fx = { module = "io.arrow-kt:arrow-fx-coroutines", version.ref = "arrow" }
Expand Down Expand Up @@ -48,3 +50,6 @@ ktor-client = [
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
arrow-gradle-nexus = { id = "io.arrow-kt.arrow-gradle-config-nexus", version.ref = "arrowGradle" }
arrow-gradle-publish = { id = "io.arrow-kt.arrow-gradle-config-publish", version.ref = "arrowGradle" }