Skip to content

CI plans & maven release config #3

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

Merged
merged 19 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## What:
<!--- Describe your changes in detail. -->
*

## Why:
<!--- Why is this change required? What problem does it solve? -->
*

## Example:
<!--- Share some code snippets to show the idea in action. -->
*
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build libraries
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]

jobs:
build:
name: Build libraries
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Check
run: ./gradlew detekt

- name: Build project
run: ./gradlew build

- name: Build xcframework
run: ./createXCFrameworks.sh
37 changes: 37 additions & 0 deletions .github/workflows/pr_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Detekt check
on: pull_request

jobs:
detekt:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Set up reviewdog
uses: reviewdog/action-setup@v1

- name: Run check
run: ./gradlew detekt -i

- name: 'Upload report'
uses: actions/upload-artifact@v2
with:
name: DetektHTMLReport
path: build/reports/detekt/detekt.html

- name: Run reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cat build/reports/detekt/detekt.xml | reviewdog -f=checkstyle -reporter=github-pr-review
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish

on:
release:
types: [ created ]

jobs:
publish:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Publish to maven central
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JsonLogicKMP
======
Kotlin multiplatform [JsonLogic](https://jsonlogic.com/) expressions evaluation engine. Targets iOS and JVM(also Android).
============
Kotlin multiplatform [JsonLogic](https://jsonlogic.com/) expressions evaluation engine. Targets iOS and JVM (also Android).

The project is still in early phase of development and not yet ready for production.

Expand Down
116 changes: 95 additions & 21 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

plugins {
kotlin("multiplatform") version "1.6.10"
kotlin("multiplatform") version Versions.kotlin
id("maven-publish")
id("pl.allegro.tech.build.axion-release") version "1.13.6"
id("java-library")
id("signing")
id("pl.allegro.tech.build.axion-release") version Versions.axion
id("io.gitlab.arturbosch.detekt") version Versions.detekt
id("io.github.gradle-nexus.publish-plugin") version Versions.nexus
}

apply(from = "versionConfig.gradle")

group = "pl.allegro.mobile"
group = LibConfig.group
version = scmVersion.version

repositories {
Expand All @@ -24,27 +29,96 @@ kotlin {
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
::iosArm64
else
::iosX64

iosTarget("ios") {
binaries {
framework {
baseName = "JsonLogicKMP"
isStatic = true

val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
::iosArm64
else
::iosX64

iosTarget("ios") {
binaries {
framework {
baseName = LibConfig.name
isStatic = true
}
}
}
}
sourceSets {
val commonMain by getting
val commonTest by getting
val jvmMain by getting
val jvmTest by getting
val iosMain by getting
val iosTest by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
}
}

detekt {
buildUponDefaultConfig = true
autoCorrect = true
source = files("src/")
ignoreFailures = false
config = files("$projectDir/config/detekt/detekt.yml")
}

tasks.withType<Detekt>().configureEach {
reports {
html.required.set(true)
xml.required.set(true)
txt.required.set(true)
sarif.required.set(true)
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])

pom {
name.set(LibConfig.name)
description.set("Kotlin multiplatform JsonLogic expressions evaluation engine")
url.set(LibConfig.repositoryUrl)
inceptionYear.set("2022")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("allegro")
name.set("opensource@allegro.pl")
}
}
scm {
connection.set("scm:svn:${LibConfig.repositoryUrl}")
developerConnection.set("scm:git@github.com:allegro/json-logic-kmp.git")
url.set(LibConfig.repositoryUrl)
}
}
}
}
}

nexusPublishing {
repositories {
sonatype {
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}

System.getenv("GPG_KEY_ID")?.let { gpgKeyId ->
signing {
useInMemoryPgpKeys(
gpgKeyId,
System.getenv("GPG_PRIVATE_KEY"),
System.getenv("GPG_PRIVATE_KEY_PASSWORD")
)
sign(publishing.publications)
}
}
9 changes: 9 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
mavenLocal()
google()
}
14 changes: 14 additions & 0 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@file:Suppress("SpellCheckingInspection")

object LibConfig {
const val group = "pl.allegro.mobile"
const val repositoryUrl = "https://github.com/allegro/json-logic-kmp"
const val name = "JsonLogicKMP"
}

object Versions {
const val kotlin = "1.6.10"
const val axion = "1.13.6"
const val detekt = "1.19.0"
const val nexus = "1.0.0"
}
Loading