From 25fae366a7c6af596a7192bec6e2f8be2226a314 Mon Sep 17 00:00:00 2001 From: Kate Liu Date: Fri, 15 Aug 2025 19:01:00 -0400 Subject: [PATCH 1/7] Add test branch publishing logic Use httpbin.org/post as fake repository when branch contains 'test' Co-Authored-By: Claude --- .github/workflows/publish.yml | 113 ++++++++++++++++++++++++++++++++ fladle-plugin/build.gradle.kts | 30 +++++---- fladle-plugin/gradle.properties | 3 + gradle.properties | 27 ++++++++ 4 files changed, 160 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 fladle-plugin/gradle.properties diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..f3e42a61 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,113 @@ +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 + # Auto-increment 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 + + # 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 + + - name: Upload archives + run: ./gradlew :fladle-plugin:publish --no-daemon + + - name: Push update to main + 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 + + git tag -a v$NEW_VERSION -m "v$NEW_VERSION" + git push origin main + git push origin main --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":"main","inputs":{"coordinates":"fladle","version":"${{ env.NEW_VERSION }}","reviewers":"${{ github.actor }}","prDescription":""}}' \ No newline at end of file diff --git a/fladle-plugin/build.gradle.kts b/fladle-plugin/build.gradle.kts index a622d9b7..74cff355 100644 --- a/fladle-plugin/build.gradle.kts +++ b/fladle-plugin/build.gradle.kts @@ -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 { @@ -62,18 +62,22 @@ val isReleaseBuild : Boolean = !version.toString().endsWith("SNAPSHOT") val sonatypeUsername : String? by project val sonatypePassword : String? by project -publishing { +configure { 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 testUrl = "https://httpbin.org/post" // Fake URL for testing + val versionName = findProperty("VERSION_NAME").toString() +// setUrl(if (versionName.endsWith("-SNAPSHOT")) snapshotUrl else url) + + // Use fake URL if on test branch, otherwise use real URLs + val currentBranch = System.getenv("GITHUB_REF_NAME") ?: "unknown" + setUrl(if (currentBranch.contains("test")) testUrl + else if (versionName.endsWith("-SNAPSHOT")) snapshotUrl + else url) + credentials(PasswordCredentials::class.java) } } publications { diff --git a/fladle-plugin/gradle.properties b/fladle-plugin/gradle.properties new file mode 100644 index 00000000..9a235c25 --- /dev/null +++ b/fladle-plugin/gradle.properties @@ -0,0 +1,3 @@ +# Versioning bits +GROUP=slack.internal.fladle +VERSION_NAME=0.18.1-slack02-SNAPSHOT \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index b2732dd2..9ded8424 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,5 +20,32 @@ android.enableJetifier=false kotlin.code.style=official + +# Performance optimizations org.gradle.parallel=true org.gradle.caching=true + +# Enable Gradle configuration cache, still not enabled by default. +# https://docs.gradle.org/current/userguide/configuration_cache.html + +org.gradle.configuration-cache=true +# Faster load/store of CC entries +# https://docs.gradle.org/8.11-rc-1/release-notes.html#config-cache +org.gradle.configuration-cache.parallel=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 From 20713e3eebc4068a9cc57e0eac0a98d6a10b8409 Mon Sep 17 00:00:00 2001 From: Kate Liu Date: Fri, 15 Aug 2025 19:03:42 -0400 Subject: [PATCH 2/7] Update test workflow logic - Use test version format 0.01-kltest## for test branches - Push to current branch instead of hardcoded main - Will publish to httpbin.org/post for safe testing Co-Authored-By: Claude --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f3e42a61..aa6ba043 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -72,11 +72,25 @@ jobs: if [ -n "${{ github.event.inputs.version }}" ]; then NEW_VERSION="${{ github.event.inputs.version }}" else - # Auto-increment 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)" + # 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 @@ -90,16 +104,20 @@ jobs: - name: Upload archives run: ./gradlew :fladle-plugin:publish --no-daemon - - name: Push update to main + - 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 " git tag -a v$NEW_VERSION -m "v$NEW_VERSION" - git push origin main - git push origin main --tags + + # 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 From eb4335f647111f81e91c7a994032839fb8658cb0 Mon Sep 17 00:00:00 2001 From: Kate Liu Date: Fri, 15 Aug 2025 19:08:32 -0400 Subject: [PATCH 3/7] Revert to real Artifactory URLs Keep real Slack Artifactory URLs but use test version format. Test versions like 0.01-kltest02 won't conflict with production. Co-Authored-By: Claude --- .github/workflows/publish.yml | 2 +- fladle-plugin/build.gradle.kts | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aa6ba043..514eccd6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -128,4 +128,4 @@ jobs: -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":"main","inputs":{"coordinates":"fladle","version":"${{ env.NEW_VERSION }}","reviewers":"${{ github.actor }}","prDescription":""}}' \ No newline at end of file + -d '{"ref":"master","inputs":{"coordinates":"fladle","version":"${{ env.NEW_VERSION }}","reviewers":"${{ github.actor }}","prDescription":""}}' \ No newline at end of file diff --git a/fladle-plugin/build.gradle.kts b/fladle-plugin/build.gradle.kts index 74cff355..8f2e9644 100644 --- a/fladle-plugin/build.gradle.kts +++ b/fladle-plugin/build.gradle.kts @@ -68,15 +68,8 @@ configure { name = "SlackArtifactory" val url = "https://slack.jfrog.io/slack/libs-release-local" val snapshotUrl = "https://slack.jfrog.io/slack/libs-snapshot-local" - val testUrl = "https://httpbin.org/post" // Fake URL for testing val versionName = findProperty("VERSION_NAME").toString() -// setUrl(if (versionName.endsWith("-SNAPSHOT")) snapshotUrl else url) - - // Use fake URL if on test branch, otherwise use real URLs - val currentBranch = System.getenv("GITHUB_REF_NAME") ?: "unknown" - setUrl(if (currentBranch.contains("test")) testUrl - else if (versionName.endsWith("-SNAPSHOT")) snapshotUrl - else url) + setUrl(if (versionName.endsWith("-SNAPSHOT")) snapshotUrl else url) credentials(PasswordCredentials::class.java) } } From 8f416e9ba11890a82016a9ac323969ce2f9f6cee Mon Sep 17 00:00:00 2001 From: Kate Liu Date: Fri, 15 Aug 2025 19:27:40 -0400 Subject: [PATCH 4/7] update kotlin, no config cache --- .github/workflows/publish.yml | 4 ++-- fladle-plugin/build.gradle.kts | 10 +++++----- gradle.properties | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 514eccd6..f037f234 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -99,10 +99,10 @@ jobs: echo "Updated version to: $NEW_VERSION" - name: Build and test - run: ./gradlew check --no-daemon + run: ./gradlew check --no-daemon --no-configuration-cache - name: Upload archives - run: ./gradlew :fladle-plugin:publish --no-daemon + run: ./gradlew :fladle-plugin:publish --no-daemon --no-configuration-cache - name: Push update to branch run: | diff --git a/fladle-plugin/build.gradle.kts b/fladle-plugin/build.gradle.kts index 8f2e9644..05af62b0 100644 --- a/fladle-plugin/build.gradle.kts +++ b/fladle-plugin/build.gradle.kts @@ -130,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().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) } } diff --git a/gradle.properties b/gradle.properties index 9ded8424..9faf3bbc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -33,6 +33,23 @@ org.gradle.configuration-cache=true # https://docs.gradle.org/8.11-rc-1/release-notes.html#config-cache org.gradle.configuration-cache.parallel=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 From fafe34bea9152b01fb9e81faa840109d245a78d7 Mon Sep 17 00:00:00 2001 From: Kate Liu Date: Fri, 15 Aug 2025 19:42:31 -0400 Subject: [PATCH 5/7] fix lint errors --- .../osacky/flank/gradle/validation/VersionNumber.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fladle-plugin/src/main/java/com/osacky/flank/gradle/validation/VersionNumber.kt b/fladle-plugin/src/main/java/com/osacky/flank/gradle/validation/VersionNumber.kt index d6942764..d17b4b3e 100644 --- a/fladle-plugin/src/main/java/com/osacky/flank/gradle/validation/VersionNumber.kt +++ b/fladle-plugin/src/main/java/com/osacky/flank/gradle/validation/VersionNumber.kt @@ -27,7 +27,6 @@ class VersionNumber private constructor( private val qualifier: String?, private val scheme: AbstractScheme, ) : Comparable { - override fun compareTo(other: VersionNumber): Int { if (major != other.major) { return major - other.major @@ -67,6 +66,7 @@ class VersionNumber private constructor( */ interface Scheme { fun parse(versionString: String): VersionNumber + fun format(versionNumber: VersionNumber): String } @@ -77,7 +77,6 @@ class VersionNumber private constructor( } val scanner = Scanner(versionString) - if (!scanner.hasDigit()) { return UNKNOWN } @@ -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, ) } @@ -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, @@ -191,4 +193,4 @@ class VersionNumber private constructor( return DEFAULT_SCHEME.parse(versionString) } } -} \ No newline at end of file +} From 0babd3d6b71066f4fed5500fa32ebcbc329c03e7 Mon Sep 17 00:00:00 2001 From: Kate Liu Date: Fri, 15 Aug 2025 19:42:43 -0400 Subject: [PATCH 6/7] update gradle.properties according to foundry --- gradle.properties | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9faf3bbc..acca9b14 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,16 @@ # 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 +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 @@ -18,21 +18,8 @@ android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=false - kotlin.code.style=official -# Performance optimizations -org.gradle.parallel=true -org.gradle.caching=true - -# Enable Gradle configuration cache, still not enabled by default. -# https://docs.gradle.org/current/userguide/configuration_cache.html - -org.gradle.configuration-cache=true -# Faster load/store of CC entries -# https://docs.gradle.org/8.11-rc-1/release-notes.html#config-cache -org.gradle.configuration-cache.parallel=true - # Ironically, this property itself is also experimental, so we have to suppress it too. android.suppressUnsupportedOptionWarnings=android.suppressUnsupportedOptionWarnings,\ android.lint.useK2Uast,\ From 423d396247b2f29d22a7f982574fb05ddb1d6f81 Mon Sep 17 00:00:00 2001 From: Kate Liu Date: Fri, 15 Aug 2025 20:02:14 -0400 Subject: [PATCH 7/7] disable config cache --- gradle.properties | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index acca9b14..fed826d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,9 @@ org.gradle.jvmargs=-Xms1g -Xmx4g -Dfile.encoding=UTF-8 org.gradle.parallel=true org.gradle.configureondemand=true org.gradle.caching=true -org.gradle.configuration-cache=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