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

Copy CI publish auto-release from Misk #166

Merged
merged 1 commit into from
Jan 25, 2024
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
82 changes: 82 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build

on:
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
push:
branches:
- master

env:
ENVIRONMENT: TESTING
JVM_OPTS: -Xmx1024M
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=3 -Xmx4096m -Dorg.gradle.configureondemand=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
TERM: dumb

jobs:
jvm:
name: Test JVM
runs-on: [ubuntu-latest]

strategy:
matrix:
cmd:
- gradle check -i --scan --parallel

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV

- name: Test
run: ${{ matrix.cmd }}

- name: Publish Test Report
if: ${{ always() }}
uses: mikepenz/action-junit-report@v3
with:
check_name: Test Report - ${{ matrix.cmd }}
report_paths: '**/build/test-results/test/TEST-*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}

publish:
name: Publish
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'cashapp/tempest' }}
needs: [js, jvm]
runs-on: [ubuntu-latest]
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV

- name: Assign a version
id: assign_version
run: |
# Set a version name like "2023.05.26.091805-c1fcb3a".
# Note the use of %ct which gets the timestamp in UTC, in seconds since UNIX epoch to
# avoid time zone differences leading to non-linear versioning.
VERSION="$(TZ=UTC0 git show --quiet --date='format-local:%Y.%m.%d.%H%M%S' --format='%cd')-$(git rev-parse --short=7 HEAD)"
echo "VERSION_NAME=$VERSION" >> gradle.properties
cat gradle.properties
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Publish the artifacts
run: |
gradle clean publish --stacktrace

- name: Tag Tempest repo
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.assign_version.outputs.version }}
12 changes: 0 additions & 12 deletions .github/workflows/Docs.yaml

This file was deleted.

227 changes: 110 additions & 117 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,148 +2,141 @@ import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URL

buildscript {
repositories {
mavenCentral()
maven(url = "https://plugins.gradle.org/m2/")
}

dependencies {
classpath(libs.dokkaGradlePlugin)
classpath(libs.junitGradlePlugin)
classpath(libs.kotlinGradlePlugin)
classpath(libs.mavenPublishGradlePlugin)
classpath(libs.wireGradlePlugin)
}
repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
classpath(libs.dokkaGradlePlugin)
classpath(libs.junitGradlePlugin)
classpath(libs.kotlinGradlePlugin)
classpath(libs.mavenPublishGradlePlugin)
classpath(libs.wireGradlePlugin)
}
}

apply(plugin = "com.vanniktech.maven.publish.base")

allprojects {
group = project.property("GROUP") as String
version = project.property("VERSION_NAME") as String
}

subprojects {
if (project.name == "tempest-bom") return@subprojects

apply(plugin = "org.jetbrains.dokka")

repositories {
mavenCentral()
maven(url = "https://s3-us-west-2.amazonaws.com/dynamodb-local/release")
}

// Only apply if the project has the kotlin plugin added:
plugins.withType<KotlinPluginWrapper> {
val compileKotlin by tasks.getting(KotlinCompile::class) {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = false
freeCompilerArgs = listOf("-Xjvm-default=all")
}
group = "app.cash.tempest"
version = project.findProperty("VERSION_NAME") as? String ?: "0.0-SNAPSHOT"

plugins.withId("com.vanniktech.maven.publish.base") {
configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.DEFAULT, automaticRelease = true)
signAllPublications()
pom {
description.set("Typesafe DynamoDB in Kotlin")
name.set(project.name)
url.set("https://github.com/cashapp/tempest/")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
val compileTestKotlin by tasks.getting(KotlinCompile::class) {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = false
}
scm {
url.set("https://github.com/cashapp/tempest/")
connection.set("scm:git:git://github.com/cashapp/tempest.git")
developerConnection.set("scm:git:ssh://[email protected]/cashapp/tempest.git")
}

dependencies {
// add("api", project(":tempest-bom"))
add("api", platform(libs.nettyBom))
developers {
developer {
id.set("square")
name.set("Square, Inc.")
}
}
}
}
}
}

subprojects {
if (project.name == "tempest-bom") return@subprojects

apply(plugin = "org.jetbrains.dokka")

repositories {
mavenCentral()
maven(url = "https://s3-us-west-2.amazonaws.com/dynamodb-local/release")
}

// Only apply if the project has the kotlin plugin added:
plugins.withType<KotlinPluginWrapper> {
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
// dependsOn("spotlessKotlinApply")
}

tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("started", "passed", "skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showStackTraces = true
}
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
dependencies {
// add("api", project(":tempest-bom"))
add("api", platform(libs.nettyBom))
}
}

tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("started", "passed", "skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showStackTraces = true
}
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
}

// We have to set the dokka configuration after evaluation since the com.vanniktech.maven.publish
// plugin overwrites our dokka configuration on projects where it's applied.
afterEvaluate {
tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(8)
if (name == "dokkaGfm" || name == "dokkaHtml") {
outputDirectory.set(project.file("$rootDir/docs/1.x"))
}
val dokkaTask = this
dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(8)

externalDocumentationLink {
url.set(URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/"))
packageListUrl.set(URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/package-list"))

url.set(URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/"))
packageListUrl.set(
URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/package-list")
)
}

// externalDocumentationLink {
// url.set(URL("https://sdk.amazonaws.com/java/api/latest/"))
// }
if (dokkaTask.name == "dokkaGfm") {
outputDirectory.set(project.file("$rootDir/docs/0.x"))
}
}
}
// SLF4J uses the classpath to decide which logger to use! Banish the Log4J to prevent this:
// org.apache.logging.slf4j.Log4jLogger cannot be cast to class ch.qos.logback.classic.Logger
configurations.all {
exclude(group = "org.apache.logging.log4j", module = "log4j-slf4j-impl")
}

// Workaround the Gradle bug resolving multiplatform dependencies.
// https://github.com/square/okio/issues/647
configurations.all {
if (name.contains("kapt") || name.contains("wire") || name.contains("proto")) {
attributes.attribute(
Usage.USAGE_ATTRIBUTE,
[email protected](Usage::class, Usage.JAVA_RUNTIME)
)
}
}

// SLF4J uses the classpath to decide which logger to use! Banish the Log4J to prevent this:
// org.apache.logging.slf4j.Log4jLogger cannot be cast to class ch.qos.logback.classic.Logger
configurations.all {
exclude(group = "org.apache.logging.log4j", module = "log4j-slf4j-impl")
}

// Workaround the Gradle bug resolving multiplatform dependencies.
// https://github.com/square/okio/issues/647
configurations.all {
if (name.contains("kapt") || name.contains("wire") || name.contains("proto")) {
attributes.attribute(
Usage.USAGE_ATTRIBUTE,
[email protected](Usage::class, Usage.JAVA_RUNTIME)
)
}
}
}

allprojects {
plugins.withId("com.vanniktech.maven.publish.base") {
val publishingExtension = extensions.getByType(PublishingExtension::class.java)
configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.DEFAULT, automaticRelease = true)
signAllPublications()
pom {
description.set("Typesafe DynamoDB in Kotlin")
name.set(project.name)
url.set("https://github.com/cashapp/tempest/")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
scm {
url.set("https://github.com/cashapp/tempest/")
connection.set("scm:git:git://github.com/cashapp/tempest.git")
developerConnection.set("scm:git:ssh://[email protected]/cashapp/tempest.git")
}
developers {
developer {
id.set("square")
name.set("Square, Inc.")
}
}
}
}
}
}

28 changes: 0 additions & 28 deletions gradle-mvn-publish.gradle.old

This file was deleted.

5 changes: 0 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
kotlin.code.style=official

GROUP=app.cash.tempest
VERSION_NAME=1.10.3

#org.gradle.jvmargs=-Xmx2024m

org.gradle.caching=true
org.gradle.parallel=true
org.gradle.vfs.watch=true
Expand Down
Loading
Loading