Skip to content

Commit

Permalink
Merge pull request #19 from dropbox/rharter/build
Browse files Browse the repository at this point in the history
Updates gradle, kotlin and publishing.
  • Loading branch information
rharter authored Sep 17, 2024
2 parents 129e1c5 + cad0b31 commit e4ff59e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 47 deletions.
61 changes: 18 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,20 @@ jobs:
runs-on: 'macos-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1

- name: Generate cache key
run: .github/scripts/checksum.sh checksum.txt

- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('checksum.txt') }}
restore-keys: |
${{ runner.os }}-gradle
uses: gradle/actions/wrapper-validation@v4

- name: Install JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Test Common JVM
run: ./gradlew jvmTest koverMergedReport --stacktrace

Expand All @@ -47,7 +40,7 @@ jobs:

- name: (Fail-only) Upload the build report
if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: error-report
path: build-reports.zip
Expand All @@ -58,12 +51,6 @@ jobs:
strategy:
matrix:
include:
- snapshot-target: publishIosArm64PublicationToMavenCentralRepository
os: macos-latest
- snapshot-target: publishJvmPublicationToMavenCentralRepository
os: ubuntu-latest
- snapshot-target: publishLinuxX64PublicationToMavenCentralRepository
os: ubuntu-latest
- release-target: publishIosArm64PublicationToMavenCentral
os: macos-latest
- release-target: publishJvmPublicationToMavenCentral
Expand All @@ -73,37 +60,25 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v3
with:
path: |
~/.konan
key: ${{ runner.os }}-${{ hashFiles('**/.lock') }}
uses: actions/checkout@v4

- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v4

- name: Install JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Upload Snapshot
run: ./gradlew ${{ matrix.snapshot-target }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Publish release
run: ./gradlew ${{ matrix.release-target }}
if: success()
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}

- name: Retrieve Version
run: echo "VERSION_NAME=$(./gradlew -q printVersionName)" >> $GITHUB_ENV

- name: Publish release (main only)
run: |
./gradlew ${{ matrix.release-target }}
./gradlew closeAndReleaseRepository
if: success() && !endsWith(env.VERSION_NAME, '-SNAPSHOT')
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
8 changes: 7 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import com.vanniktech.maven.publish.SonatypeHost
import kotlinx.kover.api.CoverageEngine.JACOCO
import kotlinx.kover.tasks.KoverMergedHtmlReportTask
import kotlinx.kover.tasks.KoverMergedXmlReportTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
alias(libs.plugins.kotlin.multiplatform).apply(false)
Expand Down Expand Up @@ -33,7 +35,7 @@ allprojects {

plugins.withId("com.vanniktech.maven.publish.base") {
configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.S01)
publishToMavenCentral(SonatypeHost.S01, automaticRelease = true)
signAllPublications()
pom {
description.set("A simple, lightweight, multiplatform image diffing library.")
Expand Down Expand Up @@ -68,6 +70,10 @@ subprojects {
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
}

repositories {
mavenCentral()
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "1.6.10"
kotlin = "1.9.20"
kover = "0.5.0"

[libraries]
Expand All @@ -11,5 +11,5 @@ okio = { module = "com.squareup.okio:okio", version = "3.0.0" }
[plugins]
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
mavenPublish = { id = "com.vanniktech.maven.publish.base", version = "0.18.0" }
mavenPublish = { id = "com.vanniktech.maven.publish.base", version = "0.29.0" }
dokka = { id = "org.jetbrains.dokka", version.ref = "kotlin" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit e4ff59e

Please sign in to comment.