Skip to content

Commit

Permalink
chore: CI and publish support
Browse files Browse the repository at this point in the history
  • Loading branch information
programadorthi committed Feb 20, 2024
1 parent 1ce5331 commit 0615402
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .github/ci-gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
org.gradle.daemon=false

org.gradle.parallel=true
org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1536m
#org.gradle.workers.max=2

kotlin.compiler.execution.strategy=in-process
21 changes: 21 additions & 0 deletions .github/workflows/development.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Development
on: [push]

jobs:
build:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'

- name: Tests
run: |
./gradlew runJvmTests --stacktrace
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release
on:
release:
types: [prereleased, released]

jobs:

release:
name: Publish State Manager
runs-on: macOS-latest
timeout-minutes: 60
steps:

- name: Fetch Sources
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'

- name: Deploy to Sonatype
run: |
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
echo "New version: ${NEW_VERSION}"
./gradlew -Pversion=${NEW_VERSION} kotlinUpgradeYarnLock publish --stacktrace
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }}
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ plugins {
}

group = "dev.programadorthi.state"

tasks.register("runJvmTests") {
group = "other"
description = "Execute JVM tests in each module only"
}
10 changes: 5 additions & 5 deletions buildSrc/src/main/kotlin/BasicSetup.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.tasks.testing.AbstractTestTask
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.jvm.toolchain.JvmVendorSpec
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.invoke
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

fun Project.applyBasicSetup() {
configureTargets()
Expand All @@ -33,6 +29,10 @@ fun Project.applyBasicSetup() {
showStackTraces = true
}
}

rootProject.tasks.named("runJvmTests") {
dependsOn(tasks.named("jvmTest"))
}
}


Expand Down

0 comments on commit 0615402

Please sign in to comment.