Skip to content

Commit

Permalink
Infra improvements and minor updates (#27)
Browse files Browse the repository at this point in the history
* Tweak GHA configs

- Check build task for pushes and PRs.
- Use `gradle/actions/setup-gradle` to cache Gradle.
- Merge deployment and release workflows, most of the steps could be reused.

* Configure Renovate

* Add renovate.json

* Update and rename renovate.json to renovate.json5

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Zongle Wang <[email protected]>

* Update dependency com.squareup:kotlinpoet to v1.18.1

* Update dependency com.android.tools:sdk-common to v31.5.1

* Update dependency org.jetbrains.kotlinx:kotlinx-io-core to v0.5.1

* Update dependency gradle to v8.9

* Remove version update plugin

It could be replaced by Renovate now.

* Add project icon

* Tweak Gradle flags

* Validate build on Windows

* Optimize maven repositories

* Optimize plugin applying

* Use lazy APIs to provide secrets

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
Goooler and renovate[bot] authored Jul 22, 2024
1 parent 6d294a3 commit 4f4704a
Show file tree
Hide file tree
Showing 19 changed files with 215 additions and 210 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/marketplace_deploy.yml

This file was deleted.

13 changes: 12 additions & 1 deletion .github/workflows/build.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Create release
name: Release

on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
Expand All @@ -15,6 +18,7 @@ jobs:
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}

outputs:
version: ${{ steps.properties.outputs.artifactName }}
Expand All @@ -28,6 +32,10 @@ jobs:
distribution: temurin
java-version: 17

- uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true

- name: Setup properties
id: properties
shell: bash
Expand Down Expand Up @@ -71,6 +79,9 @@ jobs:
INVALID_PLUGIN
NOT_DYNAMIC
- name: Publish to Marketplace
run: ./gradlew publishPlugin

- name: Remove old drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
name: Validation

on:
push:
branches:
- main
pull_request:
branches: [ "main" ]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
Expand All @@ -18,6 +23,10 @@ jobs:
with:
distribution: temurin
java-version: 17

- name: Run tests
run: ./gradlew test

- uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true

- name: Run build
run: ./gradlew build
14 changes: 14 additions & 0 deletions .idea/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 2 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

plugins {
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.gradle.dependency.check)
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.jetbrains.compose) apply false
alias(libs.plugins.jetbrains.intellij) apply false
alias(libs.plugins.kotlin.jvm) apply false
}

tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version)
}
}

fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any {
version.uppercase().contains(it)
}
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
4 changes: 0 additions & 4 deletions components/generator/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ plugins {
alias(libs.plugins.kotlin.jvm)
}

repositories {
mavenCentral()
}

dependencies {
implementation(libs.kotlinpoet)

Expand Down
4 changes: 0 additions & 4 deletions components/generator/iconpack/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ plugins {
alias(libs.plugins.kotlin.jvm)
}

repositories {
mavenCentral()
}

dependencies {
implementation(projects.components.generator.common)

Expand Down
5 changes: 0 additions & 5 deletions components/generator/imagevector/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ plugins {
alias(libs.plugins.kotlin.jvm)
}

repositories {
google()
mavenCentral()
}

dependencies {
implementation(projects.components.generator.common)
implementation(projects.components.google)
Expand Down
4 changes: 0 additions & 4 deletions components/google/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ plugins {
alias(libs.plugins.kotlin.jvm)
}

repositories {
mavenCentral()
}

dependencies {
implementation(projects.components.generator.common)

Expand Down
5 changes: 0 additions & 5 deletions components/parser/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ plugins {
alias(libs.plugins.kotlin.jvm)
}

repositories {
google()
mavenCentral()
}

dependencies {
api(projects.components.google)

Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
org.gradle.configuration-cache=true
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx4g
org.gradle.parallel=true

kotlin.stdlib.default.dependency=false
kotlin.code.style=official
11 changes: 5 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
kotlin = "2.0.0"

[libraries]
android-build-tools = "com.android.tools:sdk-common:31.5.0"
android-build-tools = "com.android.tools:sdk-common:31.5.1"

koin-compose = "io.insert-koin:koin-compose:1.1.5"

kotlin-io = "org.jetbrains.kotlinx:kotlinx-io-core:0.4.0"
kotlin-io = "org.jetbrains.kotlinx:kotlinx-io-core:0.5.1"

kotlinpoet = "com.squareup:kotlinpoet:1.18.0"
kotlinpoet = "com.squareup:kotlinpoet:1.18.1"
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }

tiamat = "io.github.composegears:tiamat:1.1.0-rc02"
Expand All @@ -17,8 +17,7 @@ tiamat-koin = "io.github.composegears:tiamat-koin:1.1.0-rc02"
xpp3 = "org.ogce:xpp3:1.1.6"

[plugins]
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
gradle-dependency-check = { id = "com.github.ben-manes.versions", version = "0.51.0" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
jetbrains-compose = { id = "org.jetbrains.compose", version = "1.6.11" }
jetbrains-intellij = "org.jetbrains.intellij:1.17.4"
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
44 changes: 31 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +82,12 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +134,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,18 +201,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
Loading

0 comments on commit 4f4704a

Please sign in to comment.