From 0b78ef7d0e35671e7d6dc5d88ce02322a420212a Mon Sep 17 00:00:00 2001 From: "Tobias (Toby) Heuts" Date: Mon, 30 May 2022 14:41:15 +0700 Subject: [PATCH 01/23] [#211] Update documentation --- README.md | 28 ++++++++-------------------- docs/Home.md | 2 +- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1444f4264..5b30b8746 100644 --- a/README.md +++ b/README.md @@ -4,33 +4,21 @@ --- -A collection of templates: - -* **[CoroutineTemplate](https://github.com/nimblehq/android-templates/tree/kotlin/CoroutineTemplate)** -* **[RxJavaTemplate[DEPRECATED]](https://github.com/nimblehq/android-templates/tree/kotlin/RxJavaTemplate)** +Our Android template: **[CoroutineTemplate](https://github.com/nimblehq/android-templates/tree/kotlin/CoroutineTemplate)** ## Setup 1. Clone or download this repository to your local machine, then extract and open the folder -2. Run `newproject.sh` script to create a new project with the following inputs: - +2. Install [Kscript](https://github.com/holgerbrandl/kscript#installation) +3. Run `kscript new_project.kts` to create a new project with the following arguments: +``` + package-name= New package name (i.e. com.example.package) + app-name= New app name (i.e. MyApp, "My App") ``` - -h, --help Display this usage message and exit - -t, --template [TEMPLATE] Select template: "rx" - RxJavaTemplate or "crt" - CoroutineTemplate (i.e. rx) - -p, --package-name [PACKAGE_NAME] New package name (i.e. com.example.package) - -n, --app-name [APP_NAME] New app name (i.e. MyApp, "My App") -``` - -Example: -- Init a new project with `RxJavaTemplate` - `./newproject.sh -t rx -p co.myproject.example -n "My Project"` -- Init a new project with `CoroutineTemplate` - `./newproject.sh -t crt -p co.myproject.example -n "My Project"` +Example: `kscript new_project.kts package-name=co.myproject.example app-name="My Project"` -3. Update `android_version_code` and `android_version_name` - - `RxJavaTemplate[DEPRECATED]/build.gradle` - - `CoroutineTemplate/build.gradle` +3. Update `android_version_code` and `android_version_name` in `CoroutineTemplate/build.gradle` ## About diff --git a/docs/Home.md b/docs/Home.md index decdcd818..bcc8c1c65 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -2,7 +2,7 @@ Welcome to the android-templates wiki! This repository generates a new project based on our preferences, by running a simple script. -Example: `./newproject.sh -t crt -p co.myproject.example -n "MyProjectExampleCoroutine"` +Example: `kscript new_project.kts package-name=co.myproject.example app-name="My Project"` This script must include all essentials by default, while optional features can be appended with flags. To prevent this repository from becoming a dumping playground, features can be rejected too. From bafd7eeb4070360d7bbb3603f6f4fbca76c44675 Mon Sep 17 00:00:00 2001 From: "Tobias (Toby) Heuts" Date: Wed, 1 Jun 2022 17:58:20 +0700 Subject: [PATCH 02/23] [#210] Update verify script --- .../workflows/verify_newproject_script.yml | 11 +- newproject.sh | 260 ------------------ scripts/new_project.kts | 4 +- 3 files changed, 9 insertions(+), 266 deletions(-) delete mode 100755 newproject.sh diff --git a/.github/workflows/verify_newproject_script.yml b/.github/workflows/verify_newproject_script.yml index 029a85114..51609ca38 100644 --- a/.github/workflows/verify_newproject_script.yml +++ b/.github/workflows/verify_newproject_script.yml @@ -30,8 +30,11 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Verify generating new project from RxTemplate - run: ./newproject.sh -t rx -p co.myproject.example -n "MyProjectExampleRx" - - name: Verify generating new project from CoroutineTemplate - run: ./newproject.sh -t crt -p co.myproject.example -n "MyProjectExampleCoroutine" + working-directory: scripts + run: | + curl -s "https://get.sdkman.io" | bash + source "/home/runner/.sdkman/bin/sdkman-init.sh" + sdk install kotlin + sdk install kscript + kscript new_project.kts package-name=co.myproject.example app-name="My Project" diff --git a/newproject.sh b/newproject.sh deleted file mode 100755 index 375a4429a..000000000 --- a/newproject.sh +++ /dev/null @@ -1,260 +0,0 @@ -#!/bin/bash -set -e - -# Script inspired by https://gist.github.com/szeidner/613fe4652fc86f083cefa21879d5522b - -PROGNAME=$(basename $0) -WORKING_DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P) - -die() { - echo "$PROGNAME: $*" >&2 - exit 1 -} - -usage() { - if [ "$*" != "" ] ; then - echo "Error: $*" - fi - - cat << EOF -Usage: $PROGNAME --template [TEMPLATE] --package-name [PACKAGE_NAME] --app-name [APP_NAME] -Set up an Android app and package name. -Options: --h, --help display this usage message and exit --t, --template [TEMPLATE] Select template: "rx" - RxJavaTemplate or "crt" - CoroutineTemplate (i.e. rx) --p, --package-name [PACKAGE_NAME] new package name (i.e. com.example.package) --n, --app-name [APP_NAME] new app name (i.e. MyApp, "My App") -EOF - - exit 1 -} - -template="" -packagename="" -appname="" -while [ $# -gt 0 ] ; do - case "$1" in - -h|--help) - usage - ;; - -t|--template) - template="$2" - shift - ;; - -p|--package-name) - packagename="$2" - shift - ;; - -n|--app-name) - appname="$2" - shift - ;; - -*) - usage "Unknown option '$1'" - ;; - *) - usage "Too many arguments" - ;; - esac - shift -done - -OLD_APPNAME="" -OLD_NAME="" -OLD_PACKAGE="" - -# Path segments -FIRST_PACKAGE_SEGMENT="co" -SECOND_PACKAGE_SEGMENT="nimblehq" -THIRD_PACKAGE_SEGMENT="" -# Select template -case "$template" in - "crt") - OLD_APPNAME="Coroutine Template" - OLD_NAME="CoroutineTemplate" - OLD_PACKAGE="co.nimblehq.coroutine" - THIRD_PACKAGE_SEGMENT="coroutine" - ;; - "rx") - OLD_APPNAME="RxJava Template" - OLD_NAME="RxJavaTemplate[DEPRECATED]" - OLD_PACKAGE="co.nimblehq.rxjava" - THIRD_PACKAGE_SEGMENT="rxjava" - ;; - -*) - usage "Unknown template '$template'. Please use 'rx' for RxJavaTemplate or 'crt' for CoroutineTemplate" - ;; -esac - -if [ -z "$packagename" ] ; then - usage "No new package provided" -fi - -if [ -z "$appname" ] ; then - usage "No new app name provided" -fi - -# Enforce package name -regex='^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$' -if ! [[ "$packagename" =~ $regex ]]; then - die "Invalid Package Name: $packagename (needs to follow standard pattern {com.example.package})" -fi - -echo "=> ๐Ÿข Staring init $appname with $OLD_APPNAME..." - -# Trim spaces in APP_NAME -NAME_NO_SPACES=$(echo "$appname" | sed "s/ //g") - -# Copy main folder -cp -R $OLD_NAME $NAME_NO_SPACES - -# Clean the old build -./$NAME_NO_SPACES/gradlew -p ./$NAME_NO_SPACES clean -# Get rid of idea settings -rm -rf $NAME_NO_SPACES/.idea -# Get rid of gradle cache -rm -rf $NAME_NO_SPACES/.gradle -# Get rid of the git history -rm -rf $NAME_NO_SPACES/.git - -# Rename folder structure -renameFolderStructure() { - DIR="" - if [ "$*" != "" ] ; then - DIR="$*" - fi - ORIG_DIR=$DIR - - mv $NAME_NO_SPACES/$DIR/$FIRST_PACKAGE_SEGMENT/$SECOND_PACKAGE_SEGMENT/$THIRD_PACKAGE_SEGMENT $NAME_NO_SPACES/$DIR/ - rm -rf $NAME_NO_SPACES/$DIR/$FIRST_PACKAGE_SEGMENT/$SECOND_PACKAGE_SEGMENT - rm -rf $NAME_NO_SPACES/$DIR/$FIRST_PACKAGE_SEGMENT - cd $NAME_NO_SPACES/$DIR - IFS='.' read -ra packages <<< "$packagename" - for i in "${packages[@]}"; do - DIR="$DIR/$i" - mkdir $i - cd $i - done - mv $WORKING_DIR/$NAME_NO_SPACES/$ORIG_DIR/$THIRD_PACKAGE_SEGMENT/* ./ - rmdir $WORKING_DIR/$NAME_NO_SPACES/$ORIG_DIR/$THIRD_PACKAGE_SEGMENT - cd $WORKING_DIR - echo $DIR -} - -# Rename files structure -echo "=> ๐Ÿ”Ž Replacing files structure..." - -# Rename project folder structure -APP_PACKAGE_DIR="app/src/main/java" -APP_PACKAGE_DIR=$( renameFolderStructure $APP_PACKAGE_DIR ) - -DATA_PACKAGE_DIR="data/src/main/java" -DATA_PACKAGE_DIR=$( renameFolderStructure $DATA_PACKAGE_DIR ) - -DOMAIN_PACKAGE_DIR="domain/src/main/java" -DOMAIN_PACKAGE_DIR=$( renameFolderStructure $DOMAIN_PACKAGE_DIR ) - -# Rename android test folder structure -APP_ANDROIDTEST_DIR="app/src/androidTest/java" -if [ -d APP_ANDROIDTEST_DIR ] -then - APP_ANDROIDTEST_DIR=$( renameFolderStructure $APP_ANDROIDTEST_DIR ) -fi - -DATA_ANDROIDTEST_DIR="data/src/androidTest/java" -if [ -d DATA_ANDROIDTEST_DIR ] -then - DATA_ANDROIDTEST_DIR=$( renameFolderStructure $DATA_ANDROIDTEST_DIR ) -fi - -DOMAIN_ANDROIDTEST_DIR="domain/src/androidTest/java" -if [ -d DOMAIN_ANDROIDTEST_DIR ] -then - DOMAIN_ANDROIDTEST_DIR=$( renameFolderStructure $DOMAIN_ANDROIDTEST_DIR ) -fi - -# Rename test folder structure -APP_TEST_DIR="app/src/test/java" -if [ -d APP_TEST_DIR ] -then - APP_TEST_DIR=$( renameFolderStructure $APP_TEST_DIR ) -fi - -DATA_TEST_DIR="data/src/test/java" -if [ -d DATA_TEST_DIR ] -then - DATA_TEST_DIR=$( renameFolderStructure $DATA_TEST_DIR ) -fi - -DOMAIN_TEST_DIR="domain/src/test/java" -if [ -d DOMAIN_TEST_DIR ] -then - DOMAIN_TEST_DIR=$( renameFolderStructure $DOMAIN_TEST_DIR ) -fi - -# Rename common-rx module on RxTemplate -if [ $template = "rx" ] -then - # Rename package folder - COMMON_RX_PACKAGE_DIR="common-rx/src/main/java" - COMMON_RX_PACKAGE_DIR=$( renameFolderStructure $COMMON_RX_PACKAGE_DIR ) - - # Rename androidTest folder - COMMON_RX_ANDROIDTEST_DIR="common-rx/src/androidTest/java" - if [ -d COMMON_RX_ANDROIDTEST_DIR ] - then - COMMON_RX_ANDROIDTEST_DIR=$( renameFolderStructure $COMMON_RX_ANDROIDTEST_DIR ) - fi - - # Rename test folder - COMMON_RX_TEST_DIR="common-rx/src/test/java" - if [ -d COMMON_RX_TEST_DIR ] - then - COMMON_RX_TEST_DIR=$( renameFolderStructure $COMMON_RX_TEST_DIR ) - fi -fi - -echo "โœ… Completed" - -# Search and replace in files -echo "=> ๐Ÿ”Ž Replacing package and package name within files..." -PACKAGE_NAME_ESCAPED="${packagename//./\.}" -OLD_PACKAGE_NAME_ESCAPED="${OLD_PACKAGE//./\.}" -if [[ "$OSTYPE" == "darwin"* ]] # Mac OSX -then - LC_ALL=C find $WORKING_DIR/$NAME_NO_SPACES -type f -exec sed -i "" -e "s/$OLD_PACKAGE_NAME_ESCAPED/$PACKAGE_NAME_ESCAPED/g" {} + - LC_ALL=C find $WORKING_DIR/$NAME_NO_SPACES -type f -exec sed -i "" -e "s/$OLD_NAME/$NAME_NO_SPACES/g" {} + -else - LC_ALL=C find $WORKING_DIR/$NAME_NO_SPACES -type f -exec sed -i -e "s/$OLD_PACKAGE_NAME_ESCAPED/$PACKAGE_NAME_ESCAPED/g" {} + - LC_ALL=C find $WORKING_DIR/$NAME_NO_SPACES -type f -exec sed -i -e "s/$OLD_NAME/$NAME_NO_SPACES/g" {} + -fi -echo "โœ… Completed" - -# Search and replace files <...> -echo "=> ๐Ÿ”Ž Replacing app name in strings.xml..." -if [[ "$OSTYPE" == "darwin"* ]] # Mac OSX -then - sed -i "" -e "s/$OLD_APPNAME/$appname/" "$WORKING_DIR/$NAME_NO_SPACES/app/src/main/res/values/strings.xml" - sed -i "" -e "s/$OLD_APPNAME/$appname/" "$WORKING_DIR/$NAME_NO_SPACES/app/src/staging/res/values/strings.xml" -else - sed -i -e "s/$OLD_APPNAME/$appname/" "$WORKING_DIR/$NAME_NO_SPACES/app/src/main/res/values/strings.xml" - sed -i -e "s/$OLD_APPNAME/$appname/" "$WORKING_DIR/$NAME_NO_SPACES/app/src/staging/res/values/strings.xml" -fi -echo "โœ… Completed" - -echo "=> ๐Ÿ”Ž Replacing Application class..." -OLD_APPLICATION_CLASS_PATH=$(find $WORKING_DIR/$NAME_NO_SPACES -type f -iname "*Application.*";) -APPLICATION_CLASS_PATH="${OLD_APPLICATION_CLASS_PATH/$OLD_NAME/$NAME_NO_SPACES}" -mv $OLD_APPLICATION_CLASS_PATH $APPLICATION_CLASS_PATH -echo "โœ… Completed" - -echo "=> ๐Ÿ› ๏ธ Building generated project..." -./$NAME_NO_SPACES/gradlew -p ./$NAME_NO_SPACES assembleDebug -echo "โœ… Build success" - -echo "=> ๐Ÿš“ Executing all unit tests..." -./$NAME_NO_SPACES/gradlew -p ./$NAME_NO_SPACES testStagingDebugUnitTest -echo "โœ… All unit tests passed" - -# Done! -echo "=> ๐Ÿš€ Done! The project is ready for development ๐Ÿ™Œ" diff --git a/scripts/new_project.kts b/scripts/new_project.kts index 1d9a8bfc2..cd3fc7fa4 100644 --- a/scripts/new_project.kts +++ b/scripts/new_project.kts @@ -172,9 +172,9 @@ object NewProject { private fun buildProjectAndRunTests() { showMessage("=> ๐Ÿ› ๏ธ Building project...") - executeCommand("sh $projectPath${fileSeparator}gradlew -p /$projectPath assembleDebug") + executeCommand("sh $projectPath${fileSeparator}gradlew -p $fileSeparator$projectPath assembleDebug") showMessage("=> ๐Ÿš“ Running tests...") - executeCommand("sh $projectPath${fileSeparator}gradlew -p /$projectPath testStagingDebugUnitTest") + executeCommand("sh $projectPath${fileSeparator}gradlew -p $fileSeparator$projectPath testStagingDebugUnitTest") showMessage("=> ๐Ÿš€ Done! The project is ready for development") } From 9ab373290e4022a8a28afb0bb67104a4fe753a51 Mon Sep 17 00:00:00 2001 From: "Tobias (Toby) Heuts" Date: Thu, 2 Jun 2022 17:13:21 +0700 Subject: [PATCH 03/23] [CHORE] Bump version to 3.9.0 --- CoroutineTemplate/buildSrc/src/main/java/Versions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CoroutineTemplate/buildSrc/src/main/java/Versions.kt b/CoroutineTemplate/buildSrc/src/main/java/Versions.kt index 77cd0c998..50a27c8dd 100644 --- a/CoroutineTemplate/buildSrc/src/main/java/Versions.kt +++ b/CoroutineTemplate/buildSrc/src/main/java/Versions.kt @@ -6,7 +6,7 @@ object Versions { const val ANDROID_TARGET_SDK_VERSION = 30 const val ANDROID_VERSION_CODE = 1 - const val ANDROID_VERSION_NAME = "3.8.0" + const val ANDROID_VERSION_NAME = "3.9.0" // Dependencies (Alphabet sorted) const val ANDROID_COMMON_KTX_VERSION = "0.1.1" From ff734c8672cc8b7d0fa8cdcc0b85a491d31d4f7b Mon Sep 17 00:00:00 2001 From: "Tobias (Toby) Heuts" Date: Tue, 7 Jun 2022 10:06:49 +0700 Subject: [PATCH 04/23] [#210] Apply code review changes --- .github/workflows/verify_newproject_script.yml | 11 +++++++---- README.md | 14 +++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/verify_newproject_script.yml b/.github/workflows/verify_newproject_script.yml index 51609ca38..1ebfca866 100644 --- a/.github/workflows/verify_newproject_script.yml +++ b/.github/workflows/verify_newproject_script.yml @@ -30,11 +30,14 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Verify generating new project from CoroutineTemplate - working-directory: scripts + - name: Install Kscript run: | curl -s "https://get.sdkman.io" | bash - source "/home/runner/.sdkman/bin/sdkman-init.sh" + source "$HOME/.sdkman/bin/sdkman-init.sh" sdk install kotlin sdk install kscript - kscript new_project.kts package-name=co.myproject.example app-name="My Project" + echo $PATH >> $GITHUB_PATH + + - name: Verify generating new project from CoroutineTemplate + working-directory: scripts + run: kscript new_project.kts package-name=co.myproject.example app-name="My Project" diff --git a/README.md b/README.md index 5b30b8746..407467f83 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,21 @@ --- -Our Android template: **[CoroutineTemplate](https://github.com/nimblehq/android-templates/tree/kotlin/CoroutineTemplate)** +Our Android template: **[CoroutineTemplate](https://github.com/nimblehq/android-templates/tree/develop/CoroutineTemplate)** ## Setup 1. Clone or download this repository to your local machine, then extract and open the folder 2. Install [Kscript](https://github.com/holgerbrandl/kscript#installation) 3. Run `kscript new_project.kts` to create a new project with the following arguments: -``` - package-name= New package name (i.e. com.example.package) - app-name= New app name (i.e. MyApp, "My App") -``` + ``` + package-name= New package name (i.e. com.example.package) + app-name= New app name (i.e. MyApp, "My App") + ``` -Example: `kscript new_project.kts package-name=co.myproject.example app-name="My Project"` + Example: `kscript new_project.kts package-name=co.myproject.example app-name="My Project"` -3. Update `android_version_code` and `android_version_name` in `CoroutineTemplate/build.gradle` +4. Update `android_version_code` and `android_version_name` in `CoroutineTemplate/build.gradle` ## About From 394e84f21c54c0f0d6c3eda78da726ae89c7a6a4 Mon Sep 17 00:00:00 2001 From: "Tobias (Toby) Heuts" Date: Fri, 10 Jun 2022 15:35:34 +0700 Subject: [PATCH 05/23] [#233] Enable `isMinifyEnabled` for `data` --- CoroutineTemplate/data/build.gradle.kts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CoroutineTemplate/data/build.gradle.kts b/CoroutineTemplate/data/build.gradle.kts index c6b13c214..88f21ba99 100644 --- a/CoroutineTemplate/data/build.gradle.kts +++ b/CoroutineTemplate/data/build.gradle.kts @@ -19,11 +19,14 @@ android { buildTypes { getByName(BuildType.RELEASE) { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + isMinifyEnabled = true + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + ) } getByName(BuildType.DEBUG) { + isMinifyEnabled = false /** * From AGP 4.2.0, Jacoco generates the report incorrectly, and the report is missing * some code coverage from module. On the new version of Gradle, they introduce a new From 682778d606a0696faa1a1624988dc6f1bc60f8af Mon Sep 17 00:00:00 2001 From: "Tobias (Toby) Heuts" Date: Mon, 13 Jun 2022 14:34:26 +0700 Subject: [PATCH 06/23] [#237] Set a fixed version for kotlin and script --- .github/workflows/verify_newproject_script.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify_newproject_script.yml b/.github/workflows/verify_newproject_script.yml index 1ebfca866..247bd29f7 100644 --- a/.github/workflows/verify_newproject_script.yml +++ b/.github/workflows/verify_newproject_script.yml @@ -34,8 +34,8 @@ jobs: run: | curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" - sdk install kotlin - sdk install kscript + sdk install kotlin 1.6.21 + sdk install kscript 4.0.3 echo $PATH >> $GITHUB_PATH - name: Verify generating new project from CoroutineTemplate From 65029dbe828a63e3b2135e3b264aab63eb2c04d7 Mon Sep 17 00:00:00 2001 From: Ryan Conway Date: Mon, 13 Jun 2022 12:45:38 +0700 Subject: [PATCH 07/23] [#172] Add section for voting process to Wiki --- docs/Home.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/Home.md b/docs/Home.md index bcc8c1c65..b9265adbd 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -45,4 +45,10 @@ Keep in mind, the features are based on _our team's_ requirements. In case the c Please note that the above examples are not definitive as new and existing libraries keep on emerging and evolving. +How do we vote on an issue? ๐Ÿ—ณ + +- If we agree with the RFC, we must react with ๐Ÿ‘. +- If we disagree with the RFC, we must react with ๐Ÿ‘Ž and leave a comment explaining why. +- It is the responsibility of the RFC creator to label their proposed change as **essential** or **optional**. + Still unsure where your future contribution belongs? Let's discuss! ๐Ÿš€ From ae9d9d4c393ef800276ddc69aeb060ffd3f8f4c3 Mon Sep 17 00:00:00 2001 From: Trung Le Date: Mon, 13 Jun 2022 16:13:56 +0700 Subject: [PATCH 08/23] Support light/dark logo --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 407467f83..356339722 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@

- Nimble logo + + + + Nimble logo + +

--- From 4554b62786f10c76ee73688eb41464d93423948a Mon Sep 17 00:00:00 2001 From: Trung Le Date: Tue, 14 Jun 2022 10:26:54 +0700 Subject: [PATCH 09/23] Update the footer logo too --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 356339722..9adcaeaa2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,12 @@ Our Android template: **[CoroutineTemplate](https://github.com/nimblehq/android- ## About -![Nimble](https://assets.nimblehq.co/logo/dark/logo-dark-text-160.png) + + + + Nimble logo + + This project is maintained and funded by Nimble. From 1f6b1308cebece6c76f24f83047a74a5e3bc8be9 Mon Sep 17 00:00:00 2001 From: Ryan Conway Date: Tue, 14 Jun 2022 11:36:51 +0700 Subject: [PATCH 10/23] [#172] Add additional details to voting process --- docs/Home.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/Home.md b/docs/Home.md index b9265adbd..32bff04cf 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -45,10 +45,15 @@ Keep in mind, the features are based on _our team's_ requirements. In case the c Please note that the above examples are not definitive as new and existing libraries keep on emerging and evolving. +Before an issue can be worked on, it must go through our voting process. + How do we vote on an issue? ๐Ÿ—ณ -- If we agree with the RFC, we must react with ๐Ÿ‘. -- If we disagree with the RFC, we must react with ๐Ÿ‘Ž and leave a comment explaining why. +- If we agree with the RFC, we must react with ๐Ÿ‘. + - If there are 3 x ๐Ÿ‘, then the issue is approved. +- If we disagree with the RFC, we must react with ๐Ÿ‘Ž and leave a comment explaining why. + - If there are 3 x ๐Ÿ‘Ž, then the issue is rejected. - It is the responsibility of the RFC creator to label their proposed change as **essential** or **optional**. +- If there are differing opinions, then the repository maintainer must resolve it. Still unsure where your future contribution belongs? Let's discuss! ๐Ÿš€ From dbbfd30a5baab9de4f0f57e12c641977368d5e1c Mon Sep 17 00:00:00 2001 From: Ryan Conway Date: Tue, 14 Jun 2022 16:49:35 +0700 Subject: [PATCH 11/23] [#172] Rearrange voting process details --- docs/Home.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Home.md b/docs/Home.md index 32bff04cf..9aa09a7da 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -49,11 +49,11 @@ Before an issue can be worked on, it must go through our voting process. How do we vote on an issue? ๐Ÿ—ณ +- It is the responsibility of the RFC creator to label their proposed change as **essential** or **optional**. - If we agree with the RFC, we must react with ๐Ÿ‘. - If there are 3 x ๐Ÿ‘, then the issue is approved. - If we disagree with the RFC, we must react with ๐Ÿ‘Ž and leave a comment explaining why. - If there are 3 x ๐Ÿ‘Ž, then the issue is rejected. -- It is the responsibility of the RFC creator to label their proposed change as **essential** or **optional**. - If there are differing opinions, then the repository maintainer must resolve it. Still unsure where your future contribution belongs? Let's discuss! ๐Ÿš€ From c53523cac98b3d75c802001bec6210a6810afd9f Mon Sep 17 00:00:00 2001 From: Avishek Khan Date: Thu, 23 Jun 2022 16:18:55 +0700 Subject: [PATCH 12/23] [#100] Add new workflow to generate release note and version tag automatically --- .github/release-drafter-config.yml | 16 ++++++++++++++++ .github/workflows/release-drafter.yml | 25 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .github/release-drafter-config.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release-drafter-config.yml b/.github/release-drafter-config.yml new file mode 100644 index 000000000..5bbaaaa0e --- /dev/null +++ b/.github/release-drafter-config.yml @@ -0,0 +1,16 @@ +name-template: '$RESOLVED_VERSION' + +tag-template: '$RESOLVED_VERSION' + +categories: + - title: 'Features' + label: 'feature' + - title: 'Chores' + label: 'chore' + - title: 'Bugs' + label: 'bug' + +change-template: '- $TITLE' + +template: | + $CHANGES diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..3cd0ed291 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,25 @@ +name: Create Draft Release + +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + contents: write # for release-drafter/release-drafter to create a github release + pull-requests: write # for release-drafter/release-drafter to add label to PR + runs-on: ubuntu-latest + steps: + # TODO: determine the next version before the following step and pass it as an input. + - uses: release-drafter/release-drafter@v5 + with: + config-name: release-drafter-config.yml + disable-autolabeler: true + # version: here goes the next version + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e7c1d3f69af520c5275dffd963ce03cb347a5999 Mon Sep 17 00:00:00 2001 From: Avishek Khan Date: Tue, 28 Jun 2022 20:03:28 +0700 Subject: [PATCH 13/23] [#100] Add step to determine version from the last commit message and set to env variable --- .github/release-drafter-config.yml | 6 +++--- .github/workflows/release-drafter.yml | 27 ++++++++++++++++++++------- scripts/get_version.kts | 17 +++++++++++++++++ 3 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 scripts/get_version.kts diff --git a/.github/release-drafter-config.yml b/.github/release-drafter-config.yml index 5bbaaaa0e..96f4590e5 100644 --- a/.github/release-drafter-config.yml +++ b/.github/release-drafter-config.yml @@ -4,11 +4,11 @@ tag-template: '$RESOLVED_VERSION' categories: - title: 'Features' - label: 'feature' + label: 'type : feature' - title: 'Chores' - label: 'chore' + label: 'type : chore' - title: 'Bugs' - label: 'bug' + label: 'type : bug' change-template: '- $TITLE' diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 3cd0ed291..9ec537bd8 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,4 +1,4 @@ -name: Create Draft Release +name: Draft a new release on: push: @@ -11,15 +11,28 @@ permissions: jobs: update_release_draft: permissions: - contents: write # for release-drafter/release-drafter to create a github release - pull-requests: write # for release-drafter/release-drafter to add label to PR + contents: write runs-on: ubuntu-latest steps: - # TODO: determine the next version before the following step and pass it as an input. - - uses: release-drafter/release-drafter@v5 + - name: Checkout code + uses: actions/checkout@v2 + - name: Install Kscript + run: | + curl -s "https://get.sdkman.io" | bash + source "$HOME/.sdkman/bin/sdkman-init.sh" + sdk install kotlin 1.6.21 + sdk install kscript 4.0.3 + echo $PATH >> $GITHUB_PATH + - name: Set version + working-directory: scripts + run: | + COMMIT_MESSAGE="${{ github.event.head_commit.message }}" + VERSION=$(kscript get_version.kts "$COMMIT_MESSAGE") + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Draft release + uses: release-drafter/release-drafter@v5 with: config-name: release-drafter-config.yml - disable-autolabeler: true - # version: here goes the next version + version: ${{ env.VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/get_version.kts b/scripts/get_version.kts new file mode 100644 index 000000000..9cad5123d --- /dev/null +++ b/scripts/get_version.kts @@ -0,0 +1,17 @@ +import java.io.File + +object GetVersion { + + private const val PATTERN_VERSION = "[0-9].[0-9].[0-9]" + + fun search(commitMessage: String): String? { + return PATTERN_VERSION + .toRegex() + .find(commitMessage) + ?.value + } +} + +val version = GetVersion.search(commitMessage = args.first()) + +println(version) From 2f15922928981186503f084dfabfb9d786940103 Mon Sep 17 00:00:00 2001 From: Avishek Khan Date: Wed, 29 Jun 2022 12:15:22 +0700 Subject: [PATCH 14/23] [#100] Update regex pattern to account for any number of digits to search for version in the commit message --- scripts/get_version.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get_version.kts b/scripts/get_version.kts index 9cad5123d..8c1496bbc 100644 --- a/scripts/get_version.kts +++ b/scripts/get_version.kts @@ -2,7 +2,7 @@ import java.io.File object GetVersion { - private const val PATTERN_VERSION = "[0-9].[0-9].[0-9]" + private const val PATTERN_VERSION = "[0-9]+.[0-9]+.[0-9]+" fun search(commitMessage: String): String? { return PATTERN_VERSION From dc41e67ff04a6ca8e68fc985b597c5364434fc78 Mon Sep 17 00:00:00 2001 From: Avishek Khan Date: Wed, 29 Jun 2022 12:32:21 +0700 Subject: [PATCH 15/23] [#100] Remove unused import --- scripts/get_version.kts | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/get_version.kts b/scripts/get_version.kts index 8c1496bbc..ff46d1cd9 100644 --- a/scripts/get_version.kts +++ b/scripts/get_version.kts @@ -1,5 +1,3 @@ -import java.io.File - object GetVersion { private const val PATTERN_VERSION = "[0-9]+.[0-9]+.[0-9]+" From 295f14d57c63ffc1884a008080361039716a4e7e Mon Sep 17 00:00:00 2001 From: Avishek Khan Date: Wed, 29 Jun 2022 12:34:55 +0700 Subject: [PATCH 16/23] [#100] Rename file, workflow, and job names and add new lines between successive steps and timeout to follow the convention --- .../{release-drafter.yml => draft-new-release.yml} | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) rename .github/workflows/{release-drafter.yml => draft-new-release.yml} (93%) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/draft-new-release.yml similarity index 93% rename from .github/workflows/release-drafter.yml rename to .github/workflows/draft-new-release.yml index 9ec537bd8..711386de4 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/draft-new-release.yml @@ -1,4 +1,4 @@ -name: Draft a new release +name: Draft new release on: push: @@ -9,13 +9,15 @@ permissions: contents: read jobs: - update_release_draft: + draft_new_release: permissions: contents: write runs-on: ubuntu-latest + timeout-minutes: 30 steps: - name: Checkout code uses: actions/checkout@v2 + - name: Install Kscript run: | curl -s "https://get.sdkman.io" | bash @@ -23,12 +25,14 @@ jobs: sdk install kotlin 1.6.21 sdk install kscript 4.0.3 echo $PATH >> $GITHUB_PATH + - name: Set version working-directory: scripts run: | COMMIT_MESSAGE="${{ github.event.head_commit.message }}" VERSION=$(kscript get_version.kts "$COMMIT_MESSAGE") echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Draft release uses: release-drafter/release-drafter@v5 with: From ccda570f7bbe0040eaad57edfc99beddc9cd553a Mon Sep 17 00:00:00 2001 From: Avishek Khan Date: Wed, 29 Jun 2022 12:36:49 +0700 Subject: [PATCH 17/23] [#100] Add emojis to the section titles --- .github/release-drafter-config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/release-drafter-config.yml b/.github/release-drafter-config.yml index 96f4590e5..417a84445 100644 --- a/.github/release-drafter-config.yml +++ b/.github/release-drafter-config.yml @@ -3,11 +3,11 @@ name-template: '$RESOLVED_VERSION' tag-template: '$RESOLVED_VERSION' categories: - - title: 'Features' + - title: 'โญ Features' label: 'type : feature' - - title: 'Chores' + - title: '๐Ÿงน Chores' label: 'type : chore' - - title: 'Bugs' + - title: '๐Ÿž Bugs' label: 'type : bug' change-template: '- $TITLE' From d9821deaa5da2458cebf882b57e1aca26050cd9c Mon Sep 17 00:00:00 2001 From: Avishek Khan Date: Thu, 30 Jun 2022 10:46:18 +0700 Subject: [PATCH 18/23] [#100] Fix pattern --- scripts/get_version.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get_version.kts b/scripts/get_version.kts index ff46d1cd9..205186f6b 100644 --- a/scripts/get_version.kts +++ b/scripts/get_version.kts @@ -1,6 +1,6 @@ object GetVersion { - private const val PATTERN_VERSION = "[0-9]+.[0-9]+.[0-9]+" + private const val PATTERN_VERSION = "[0-9]+[.][0-9]+[.][0-9]+" fun search(commitMessage: String): String? { return PATTERN_VERSION From a62d3d318583ccaf6e0a4a9e0b544e14d4ebbed7 Mon Sep 17 00:00:00 2001 From: Avishek Khan Date: Thu, 30 Jun 2022 10:47:57 +0700 Subject: [PATCH 19/23] [#100] Rename and rearrange --- .github/workflows/draft-new-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/draft-new-release.yml b/.github/workflows/draft-new-release.yml index 711386de4..dd6e4e363 100644 --- a/.github/workflows/draft-new-release.yml +++ b/.github/workflows/draft-new-release.yml @@ -26,7 +26,7 @@ jobs: sdk install kscript 4.0.3 echo $PATH >> $GITHUB_PATH - - name: Set version + - name: Get version from the latest commit message working-directory: scripts run: | COMMIT_MESSAGE="${{ github.event.head_commit.message }}" @@ -35,8 +35,8 @@ jobs: - name: Draft release uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: config-name: release-drafter-config.yml version: ${{ env.VERSION }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a3e5dc8e0d8a0bb9507030489a5b5de5f9d85747 Mon Sep 17 00:00:00 2001 From: Bruce - Thien Nguyen Date: Fri, 1 Jul 2022 15:08:37 +0700 Subject: [PATCH 20/23] [#217] Increase timeout in http client to 30 seconds --- .../co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt b/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt index 5ecf3c6e0..444f687f2 100644 --- a/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt +++ b/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt @@ -7,6 +7,7 @@ import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor +import java.util.concurrent.TimeUnit @Module @InstallIn(SingletonComponent::class) @@ -18,6 +19,10 @@ class OkHttpClientModule { addInterceptor(HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY }) + connectTimeout(30, TimeUnit.SECONDS) + writeTimeout(30, TimeUnit.SECONDS) + readTimeout(30, TimeUnit.SECONDS) } - }.build() + } + .build() } From 2cb331a19a25e2a37770481887fa48f6174edc55 Mon Sep 17 00:00:00 2001 From: Bruce - Thien Nguyen Date: Fri, 1 Jul 2022 15:17:44 +0700 Subject: [PATCH 21/23] [#217] Fix detekt of magic number --- .../coroutine/di/modules/OkHttpClientModule.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt b/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt index 444f687f2..18c41677e 100644 --- a/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt +++ b/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt @@ -9,6 +9,10 @@ import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import java.util.concurrent.TimeUnit +private const val CONNECT_TIME_OUT = 30L +private const val WRITE_TIME_OUT = 30L +private const val READ_TIME_OUT = 30L + @Module @InstallIn(SingletonComponent::class) class OkHttpClientModule { @@ -19,9 +23,9 @@ class OkHttpClientModule { addInterceptor(HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY }) - connectTimeout(30, TimeUnit.SECONDS) - writeTimeout(30, TimeUnit.SECONDS) - readTimeout(30, TimeUnit.SECONDS) + connectTimeout(CONNECT_TIME_OUT, TimeUnit.SECONDS) + writeTimeout(WRITE_TIME_OUT, TimeUnit.SECONDS) + readTimeout(READ_TIME_OUT, TimeUnit.SECONDS) } } .build() From 0de815efbe7b7811f7a5da67d4e86e4daf58e3e3 Mon Sep 17 00:00:00 2001 From: Bruce - Thien Nguyen Date: Fri, 1 Jul 2022 16:15:00 +0700 Subject: [PATCH 22/23] [#217] Delete redundant time out --- .../co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt b/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt index 18c41677e..36af171d6 100644 --- a/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt +++ b/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt @@ -9,8 +9,6 @@ import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import java.util.concurrent.TimeUnit -private const val CONNECT_TIME_OUT = 30L -private const val WRITE_TIME_OUT = 30L private const val READ_TIME_OUT = 30L @Module @@ -23,8 +21,6 @@ class OkHttpClientModule { addInterceptor(HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY }) - connectTimeout(CONNECT_TIME_OUT, TimeUnit.SECONDS) - writeTimeout(WRITE_TIME_OUT, TimeUnit.SECONDS) readTimeout(READ_TIME_OUT, TimeUnit.SECONDS) } } From 02acc423f37620ee5794e848f84b19aa22f5e274 Mon Sep 17 00:00:00 2001 From: Bruce - Thien Nguyen Date: Fri, 1 Jul 2022 16:22:41 +0700 Subject: [PATCH 23/23] [#217] Revert enter new line --- .../co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt b/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt index 36af171d6..338d28f6c 100644 --- a/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt +++ b/CoroutineTemplate/app/src/main/java/co/nimblehq/coroutine/di/modules/OkHttpClientModule.kt @@ -23,6 +23,5 @@ class OkHttpClientModule { }) readTimeout(READ_TIME_OUT, TimeUnit.SECONDS) } - } - .build() + }.build() }