Skip to content
Draft
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
131 changes: 131 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Publish Artifacts
on:
workflow_dispatch:
inputs:
version:
description: "Version (leave blank to auto-increment)"
required: false
openPr:
type: boolean
description: "Open a PR on slack-android-ng"
required: false
default: true

concurrency:
group: 'fladle-main'

env:
ORG_GRADLE_PROJECT_artifactory_user: ${{ secrets.ARTIFACTORY_USER }}
ORG_GRADLE_PROJECT_artifactory_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check if re-run
run: |
if [ "$GITHUB_RUN_ATTEMPT" -gt 1 ]; then
echo "Cannot re-run a publish."
exit 1
else
echo "Starting"
fi

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.SLACK_OSS_GITHUB_TOKEN }}

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

# Save the previous latest git tag for use in the changelog step later
- name: Get previous tag
id: previous-tag
run: |
git fetch --tags origin
latest_tag=$(git tag --list 'v*' --sort=-v:refname | head -n 1)
echo "tag=$latest_tag" >> $GITHUB_OUTPUT

# Check if there has been any changes from the previous release
- name: Verify has changes
id: verify-changes
if: github.event.inputs.version == ''
run: |
changes=$(git rev-list ${{ steps.previous-tag.outputs.tag }}...HEAD)
if [[ -z $changes ]]; then
echo "No changes from previous version ${{ steps.previous-tag.outputs.tag }}"
exit 1
fi

- name: Increment version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
NEW_VERSION="${{ github.event.inputs.version }}"
else
# Use test version format if on test branch
if [[ "${{ github.ref_name }}" == *"test"* ]]; then
# Test version format: 0.01-kltest##
CURRENT_TEST_VERSION=$(grep "VERSION_NAME=" gradle.properties | grep -o "kltest[0-9]*" || echo "kltest01")
if [ "$CURRENT_TEST_VERSION" = "kltest01" ]; then
NEW_VERSION="0.01-kltest02"
else
# Extract number and increment
TEST_NUM=$(echo $CURRENT_TEST_VERSION | sed 's/kltest//')
NEW_NUM=$((TEST_NUM + 1))
NEW_VERSION="0.01-kltest$(printf "%02d" $NEW_NUM)"
fi
else
# Production version logic - extract current version and increment patch
CURRENT_VERSION=$(grep "VERSION_NAME=" gradle.properties | cut -d'=' -f2 | sed 's/-SNAPSHOT//')
IFS='.' read -r major minor patch <<< "${CURRENT_VERSION#*-slack}"
NEW_PATCH=$((patch + 1))
NEW_VERSION="0.18.1-slack$(printf "%02d" $NEW_PATCH)"
fi
fi

# Update gradle.properties
sed -i "s/VERSION_NAME=.*/VERSION_NAME=$NEW_VERSION/" gradle.properties
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
echo "Updated version to: $NEW_VERSION"

- name: Build and test
run: ./gradlew check --no-daemon --no-configuration-cache

- name: Upload archives
run: ./gradlew :fladle-plugin:publish --no-daemon --no-configuration-cache

- name: Push update to branch
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add gradle.properties
git commit -m "CI: Increment version to $NEW_VERSION

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>"
git tag -a v$NEW_VERSION -m "v$NEW_VERSION"

# Push to current branch (main for production, test branch for testing)
CURRENT_BRANCH="${{ github.ref_name }}"
git push origin $CURRENT_BRANCH
git push origin $CURRENT_BRANCH --tags

# Trigger dispatch in slack-android-ng to update
- name: Open PR in slack-android-ng by triggering the update-dependency.yml workflow
if: github.event.inputs.openPr == 'true'
run: |
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: bearer ${{ secrets.SLACK_OSS_GITHUB_TOKEN }}" \
https://api.github.com/repos/tinyspeck/slack-android-ng/actions/workflows/update-dependency.yml/dispatches \
-d '{"ref":"master","inputs":{"coordinates":"fladle","version":"${{ env.NEW_VERSION }}","reviewers":"${{ github.actor }}","prDescription":""}}'
33 changes: 15 additions & 18 deletions fladle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.gradle.api.tasks.testing.logging.TestLogEvent

group = "com.osacky.flank.gradle"
version = "0.18.1-SNAPSHOT"
group = property("GROUP") as String
version = property("VERSION_NAME") as String
description = "Easily Scale your Android Instrumentation Tests with Firebase Test Lab with Flank"

repositories {
Expand Down Expand Up @@ -62,18 +62,15 @@ val isReleaseBuild : Boolean = !version.toString().endsWith("SNAPSHOT")
val sonatypeUsername : String? by project
val sonatypePassword : String? by project

publishing {
configure<PublishingExtension> {
repositories {
repositories {
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (isReleaseBuild) releasesRepoUrl else snapshotsRepoUrl
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
maven {
name = "SlackArtifactory"
val url = "https://slack.jfrog.io/slack/libs-release-local"
val snapshotUrl = "https://slack.jfrog.io/slack/libs-snapshot-local"
val versionName = findProperty("VERSION_NAME").toString()
setUrl(if (versionName.endsWith("-SNAPSHOT")) snapshotUrl else url)
credentials(PasswordCredentials::class.java)
}
}
publications {
Expand Down Expand Up @@ -133,11 +130,11 @@ tasks.withType(ValidatePlugins::class.java).configureEach {
}

// Ensure Java 11 Compatibility. See https://github.com/runningcode/fladle/issues/246
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java).configureEach {
kotlinOptions {
jvmTarget = "11"
languageVersion = "1.7"
apiVersion = "1.7"
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
compilerOptions {
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
}
}

Expand Down
3 changes: 3 additions & 0 deletions fladle-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Versioning bits
GROUP=slack.internal.fladle
VERSION_NAME=0.18.1-slack02-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class VersionNumber private constructor(
private val qualifier: String?,
private val scheme: AbstractScheme,
) : Comparable<VersionNumber> {

override fun compareTo(other: VersionNumber): Int {
if (major != other.major) {
return major - other.major
Expand Down Expand Up @@ -67,6 +66,7 @@ class VersionNumber private constructor(
*/
interface Scheme {
fun parse(versionString: String): VersionNumber

fun format(versionNumber: VersionNumber): String
}

Expand All @@ -77,7 +77,6 @@ class VersionNumber private constructor(
}
val scanner = Scanner(versionString)


if (!scanner.hasDigit()) {
return UNKNOWN
}
Expand Down Expand Up @@ -162,7 +161,7 @@ class VersionNumber private constructor(
versionNumber.major,
versionNumber.minor,
versionNumber.micro,
if (versionNumber.qualifier == null) "" else "-" + versionNumber.qualifier
if (versionNumber.qualifier == null) "" else "-" + versionNumber.qualifier,
)
}

Expand All @@ -176,7 +175,10 @@ class VersionNumber private constructor(
val UNKNOWN: VersionNumber = version(0)

@JvmOverloads
fun version(major: Int, minor: Int = 0): VersionNumber {
fun version(
major: Int,
minor: Int = 0,
): VersionNumber {
return VersionNumber(
major = major,
minor = minor,
Expand All @@ -191,4 +193,4 @@ class VersionNumber private constructor(
return DEFAULT_SCHEME.parse(versionString)
}
}
}
}
57 changes: 45 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,24 +1,57 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
org.gradle.jvmargs=-Xms1g -Xmx4g -Dfile.encoding=UTF-8

# Performance optimizations
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.caching=true
# Disable configuration cache due to Fulladle plugin compatibility issues
# TODO: Re-enable once Fulladle plugin is made compatible with configuration cache
# org.gradle.configuration-cache=true

# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=false


kotlin.code.style=official
org.gradle.parallel=true
org.gradle.caching=true

# Ironically, this property itself is also experimental, so we have to suppress it too.
android.suppressUnsupportedOptionWarnings=android.suppressUnsupportedOptionWarnings,\
android.lint.useK2Uast,\
android.experimental.lint.missingBaselineIsEmptyBaseline,\
android.experimental.lint.version

# Force use of the latest android lint version
android.experimental.lint.version=8.13.0-alpha03
android.experimental.lint.missingBaselineIsEmptyBaseline=true

# Disable noisy DAGP logs
dependency.analysis.compatibility=NONE

# Use new K2 UAST for lint
android.lint.useK2Uast=true


# Versioning bits
GROUP=slack.internal.fladle
VERSION_NAME=0.18.1-slack02-SNAPSHOT
POM_URL=https://github.com/tinyspeck/fladle/
POM_SCM_URL=https://github.com/tinyspeck/fladle/
POM_SCM_CONNECTION=scm:git:git://github.com/tinyspeck/fladle.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/tinyspeck/fladle.git
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=tinyspeck
POM_DEVELOPER_NAME=Slack Technologies, Inc.
POM_DEVELOPER_URL=https://github.com/tinyspeck
POM_INCEPTION_YEAR=2017
POM_PACKAGING=jar

# Release signing isn't necessary for artifactory nor is this publicly distributed
RELEASE_SIGNING_ENABLED=false