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

[Feature/#10] : CI/CD setting #13

Merged
merged 9 commits into from
Aug 12, 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
2 changes: 2 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
addReviewers: false
addAssignees: author
79 changes: 64 additions & 15 deletions .github/workflows/develop_PR_builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Wable PR Builder

on:
pull_request:
branches: [ "develop, main" ]
branches: [ develop ]

defaults:
run:
Expand All @@ -14,27 +14,76 @@ jobs:
name: PR Checker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Gradle cache
uses: actions/cache@v3
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 17

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Add Network Base Url
env:
WABLE_DEV_BASE_URL: ${{ secrets.WABLE_DEV_BASE_URL }}
WABLE_REL_BASE_URL: ${{ secrets.WABLE_REL_BASE_URL }}
run: |
echo wable.dev.base.url=$WABLE_DEV_BASE_URL >> ./local.properties
echo wable.rel.base.url=$WABLE_REL_BASE_URL >> ./local.properties

- name: Access Google Services JSON
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $GOOGLE_SERVICES_JSON | base64 -di > ./app/google-services.json

- name: Access Keystore
env:
DEBUG_KEY_STORE: ${{ secrets.DEBUG_KEY_STORE }}
RELEASE_JKS: ${{ secrets.RELEASE_JKS }}
RELEASE_KEY_STORE_PROPERTIES: ${{ secrets.RELEASE_KEY_STORE_PROPERTIES }}
run: |
echo $RELEASE_JKS | base64 -di > ./app/keystore/release.jks
echo $RELEASE_KEY_STORE_PROPERTIES | base64 -di > ./keystore.properties
echo $DEBUG_KEY_STORE | base64 -di > ./app/keystore/debug.keystore

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Build with Gradle
run: ./gradlew build -PcompileSdkVersion=34 --stacktrace

- name: Change gradlew permissions
run: chmod +x ./gradlew
- name: On Success, Notify in Slack
if: ${{ success() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_TITLE: 'โœ… PR check Success โœ…'
SLACK_COLOR: '#36a64f'
MSG_MINIMAL: true
SLACK_USERNAME: Wable Android
SLACK_MESSAGE: '๐ŸŽ‰๐Ÿ’Ÿ PR ์™„๋ฃŒ ๐Ÿ’Ÿ๐ŸŽ‰'

- name: Lint Check
run: ./gradlew ktlintCheck
- name: On Failed, Notify in Slack
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_TITLE: '๐Ÿšซ PR check Failed ๐Ÿšซ'
SLACK_COLOR: '#FF0000'
MSG_MINIMAL: true
SLACK_USERNAME: Wable Android
SLACK_MESSAGE: '๏ธ๐Ÿšซโš ๏ธ PR ์—๋Ÿฌ ๏ธโš ๏ธ๐Ÿšซ'
111 changes: 111 additions & 0 deletions .github/workflows/main_merge_builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Wable Release Note

on:
push:
branches: [ main ]

defaults:
run:
shell: bash
working-directory: .

jobs:
build:
name: Generate Release APK, Note
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 17

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Add Network Base Url
env:
WABLE_DEV_BASE_URL: ${{ secrets.WABLE_DEV_BASE_URL }}
WABLE_REL_BASE_URL: ${{ secrets.WABLE_REL_BASE_URL }}
run: |
echo wable.dev.base.url=$WABLE_DEV_BASE_URL >> ./local.properties
echo wable.rel.base.url=$WABLE_REL_BASE_URL >> ./local.properties

- name: Access Google Services JSON
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $GOOGLE_SERVICES_JSON | base64 -di > ./app/google-services.json

- name: Access Keystore
env:
DEBUG_KEY_STORE: ${{ secrets.DEBUG_KEY_STORE }}
RELEASE_JKS: ${{ secrets.RELEASE_JKS }}
RELEASE_KEY_STORE_PROPERTIES: ${{ secrets.RELEASE_KEY_STORE_PROPERTIES }}
run: |
echo $RELEASE_JKS | base64 -di > ./app/keystore/release.jks
echo $RELEASE_KEY_STORE_PROPERTIES | base64 -di > ./keystore.properties
echo $DEBUG_KEY_STORE | base64 -di > ./app/keystore/debug.keystore

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Extract Version Name
run: |
VERSION=$(grep -oP 'appVersion\s*=\s*"\K[0-9]+\.[0-9]+\.[0-9]+' gradle/libs.versions.toml)
echo "##[set-output name=version;]v$VERSION"
id: extract_version

- name: Build release APK
run: ./gradlew assembleRelease --stacktrace

- name: Upload Release Build to APK
uses: actions/upload-artifact@v4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3: main์— ๋จธ์ง€๋ ๋•Œ๋งŒ cd ์ ์šฉ์‹œํ‚ค๋‚˜์š”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main์— pr์˜ฌ๋ผ์˜ฌ๋•Œ๋„ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค! main์— pr์˜ฌ๋ ค์„œ qa์ง„ํ–‰ํ•˜๊ณ  ๋ณ€๊ฒฝํ•ด์•ผํ•  ์‚ฌํ•ญ์žˆ์œผ๋ฉด pr ํด๋กœ์ฆˆํ•˜๊ณ  ๋‹ค์‹œ ์˜ฌ๋ฆฌ๋Š” ๋ฐฉ์‹์„ ์ƒ๊ฐํ–ˆ์—ˆ์Šต๋‹ˆ๋‹ค!

develop์€ ์ €ํฌ ํ™•์ธ์šฉ์œผ๋กœ apk๊ฐ€ ๋งค pr๋งˆ๋‹ค ํ•„์š”ํ• ์ง€ ๊ณ ๋ฏผํ•ด๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ทธ ๋ฐฉ์‹์ด๋ฉด ์ „ ์ข‹์Šต๋‹ˆ๋‹ค!

with:
name: release-apk
path: app/build/outputs/apk/release/
if-no-files-found: error

- name: Create Github Release note
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.extract_version.outputs.version }}
release_name: ${{ steps.extract_version.outputs.version }}
generate_release_notes: true
files: |
app/build/outputs/apk/release/app-release.apk`

- name: On Success, Notify in Slack
if: ${{ success() }}
uses: MeilCli/slack-upload-file@v3
with:
slack_token: ${{ secrets.SLACK_BOT_TOKEN }}
channel_id: ${{ secrets.SLACK_GENERAL_CHANNEL_ID }}
file_path: 'app/build/outputs/apk/release/app-release.apk'
file_name: 'WABLE-ANDROID.apk'
file_type: 'apk'
initial_comment: '๐Ÿ’Ÿ ์ตœ์ข… Release๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค ๐Ÿ’Ÿ'

- name: On Failed, Notify in Slack
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_TITLE: '๐Ÿšซ Release PR check Failed ๐Ÿšซ'
SLACK_COLOR: '#FF0000'
MSG_MINIMAL: true
SLACK_USERNAME: Wable Android
SLACK_MESSAGE: '๏ธ๐Ÿšซโš ๏ธ Release PR ์—๋Ÿฌ ๏ธโš ๏ธ๐Ÿšซ'
96 changes: 96 additions & 0 deletions .github/workflows/release_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Wable Release Test

on:
pull_request:
branches: [ main ]

defaults:
run:
shell: bash
working-directory: .

jobs:
build:
name: Release Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 17

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Add Network Base Url
env:
WABLE_DEV_BASE_URL: ${{ secrets.WABLE_DEV_BASE_URL }}
WABLE_REL_BASE_URL: ${{ secrets.WABLE_REL_BASE_URL }}
run: |
echo wable.dev.base.url=$WABLE_DEV_BASE_URL >> ./local.properties
echo wable.rel.base.url=$WABLE_REL_BASE_URL >> ./local.properties

- name: Access Google Services JSON
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $GOOGLE_SERVICES_JSON | base64 -di > ./app/google-services.json

- name: Access Keystore
env:
DEBUG_KEY_STORE: ${{ secrets.DEBUG_KEY_STORE }}
RELEASE_JKS: ${{ secrets.RELEASE_JKS }}
RELEASE_KEY_STORE_PROPERTIES: ${{ secrets.RELEASE_KEY_STORE_PROPERTIES }}
run: |
echo $RELEASE_JKS | base64 -di > ./app/keystore/release.jks
echo $RELEASE_KEY_STORE_PROPERTIES | base64 -di > ./keystore.properties
echo $DEBUG_KEY_STORE | base64 -di > ./app/keystore/debug.keystore

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build debug APK
run: ./gradlew assembleDebug --stacktrace

- name: Upload debug Build to APK
uses: actions/upload-artifact@v4
with:
name: debug-apk
path: app/build/outputs/apk/debug/
if-no-files-found: error

- name: On Success, Notify in Slack
if: ${{ success() }}
uses: MeilCli/slack-upload-file@v3
with:
slack_token: ${{ secrets.SLACK_BOT_TOKEN }}
channel_id: ${{ secrets.SLACK_GENERAL_CHANNEL_ID }}
file_path: 'app/build/outputs/apk/debug/app-debug.apk'
file_name: 'WABLE-ANDROID.apk'
file_type: 'apk'
initial_comment: '๐Ÿ’Ÿ Release Test๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค ๐Ÿ’Ÿ'

- name: On Failed, Notify in Slack
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_TITLE: '๐Ÿšซ Release PR check Failed ๐Ÿšซ'
SLACK_COLOR: '#FF0000'
MSG_MINIMAL: true
SLACK_USERNAME: Wable Android
SLACK_MESSAGE: '๏ธ๐Ÿšซโš ๏ธ Release PR ์—๋Ÿฌ ๏ธโš ๏ธ๐Ÿšซ'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ render.experimental.xml
# Keystore files
*.jks
*.keystore
/*/keystore.properties
keystore.properties

# Google Services (e.g. APIs or Firebase)
google-services.json
Expand Down
23 changes: 23 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import java.io.FileInputStream
import java.util.Properties

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("com.teamwable.wable.application")
id("com.teamwable.wable.test")
alias(libs.plugins.google.services)
}

val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
keystoreProperties.load(FileInputStream(keystorePropertiesFile))

android {
namespace = "com.teamwable.wable"
compileSdk = 34
Expand All @@ -15,8 +22,24 @@ android {
versionName = libs.versions.appVersion.get()
}

signingConfigs {
getByName("debug") {
storeFile = file("./keystore/debug.keystore")
}
create("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = file(keystoreProperties["storeFile"] as String)
storePassword = keystoreProperties["storePassword"] as String
}
}

buildTypes {
debug {
signingConfig = signingConfigs.getByName("debug")
}
release {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
Expand Down
Empty file added app/keystore/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.dagger.hilt) apply false
alias(libs.plugins.google.services) apply false
Expand Down
4 changes: 0 additions & 4 deletions core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ android {
getByName("debug") {
val wableDevBaseUrl = properties["wable.dev.base.url"] as? String ?: ""
buildConfigField("String", "WABLE_BASE_URL", "\"${wableDevBaseUrl}\"")

//TODO:ํ…Œ์ŠคํŠธ์šฉ ๋‚˜์ค‘์— ์ง€์šฐ๊ธฐ
val testToken = properties["test.token"] as? String ?: ""
buildConfigField("String", "TEST_TOKEN", "\"${testToken}\"")
}

getByName("release") {
Expand Down
Loading