Skip to content

Commit fc5f5c3

Browse files
authored
Merge pull request #256 from Team-HMH/feature/ci-cd-firebase
[feat/ci_cd_firebase]: Firebase ํ…Œ์ŠคํŠธ ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ workflow ์ถ”๊ฐ€
2 parents 8ad4ca6 + 1af17ba commit fc5f5c3

File tree

7 files changed

+107
-7
lines changed

7 files changed

+107
-7
lines changed

โ€Ž.github/workflows/develop_PR_builder.ymlโ€Ž

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,29 @@ jobs:
3939
- name: Add Local Properties
4040
env:
4141
KAKAO_API_KEY: ${{ secrets.KAKAO_API_KEY }}
42-
HMH_BASE_URL: ${{ secrets.HMH_BASE_URL }}
42+
HMH_DEV_BASE_URL: ${{ secrets.HMH_DEV_BASE_URL }}
43+
HMH_PROD_BASE_URL: ${{ secrets.HMH_PROD_BASE_URL }}
44+
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
45+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
46+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
47+
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
4348
run: |
4449
echo kakaoApiKey=$KAKAO_API_KEY >> ./local.properties
45-
echo hmhBaseUrl=$HMH_BASE_URL >> ./local.properties
50+
echo amplitudeApiKey=$AMPLITUDE_API_KEY >> ./local.properties
51+
echo keyAlias=$KEY_ALIAS >> ./local.properties
52+
echo keyPassword=$KEY_PASSWORD >> ./local.properties
53+
echo storePassword=$STORE_PASSWORD >> ./local.properties
54+
echo hmhDevBaseUrl=$HMH_DEV_BASE_URL >> ./local.properties
55+
echo hmhProdBaseUrl=$HMH_PROD_BASE_URL >> ./local.properties
4656
4757
- name: Access Firebase Service
4858
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > ./app/google-services.json
4959

60+
- name: Run Tests
61+
run: ./gradlew test
62+
63+
- name: Verify Lint
64+
run: ./gradlew lint
65+
5066
- name: Build debug APK
5167
run: ./gradlew assembleDebug --stacktrace
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release Firebase Distribution Workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- release/**
7+
8+
jobs:
9+
build-and-release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Setup JDK
17+
uses: actions/setup-java@v3
18+
with:
19+
distribution: 'temurin'
20+
java-version: '17'
21+
22+
- name: Decode keystore
23+
run: echo "${{ secrets.RELEASE_KEYSTORE_BASE64 }}" | base64 --decode > keystore/release.keystore.jks
24+
25+
- name: Grant execute permission for gradlew
26+
run: chmod +x ./gradlew
27+
28+
- name: Add Local Properties
29+
env:
30+
KAKAO_API_KEY: ${{ secrets.KAKAO_API_KEY }}
31+
HMH_DEV_BASE_URL: ${{ secrets.HMH_DEV_BASE_URL }}
32+
HMH_PROD_BASE_URL: ${{ secrets.HMH_PROD_BASE_URL }}
33+
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
34+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
35+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
36+
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
37+
run: |
38+
echo kakaoApiKey=$KAKAO_API_KEY >> ./local.properties
39+
echo amplitudeApiKey=$AMPLITUDE_API_KEY >> ./local.properties
40+
echo keyAlias=$KEY_ALIAS >> ./local.properties
41+
echo keyPassword=$KEY_PASSWORD >> ./local.properties
42+
echo storePassword=$STORE_PASSWORD >> ./local.properties
43+
echo hmhDevBaseUrl=$HMH_DEV_BASE_URL >> ./local.properties
44+
echo hmhProdBaseUrl=$HMH_PROD_BASE_URL >> ./local.properties
45+
46+
- name: Access Firebase Service
47+
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > ./app/google-services.json
48+
49+
- name: Cache Gradle dependencies
50+
uses: actions/cache@v3
51+
with:
52+
path: ~/.gradle/caches
53+
key: gradle-cache-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
54+
restore-keys: |
55+
gradle-cache-${{ runner.os }}-
56+
57+
- name: Build APK
58+
run: ./gradlew assembleRelease
59+
60+
- name: Verify APK Existence
61+
run: test -f app/build/outputs/apk/release/app-release.apk
62+
63+
- name: Generate Release Notes
64+
id: release-notes
65+
run: echo "RELEASE_NOTES=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
66+
67+
- name: Upload to Firebase App Distribution
68+
uses: wzieba/Firebase-Distribution-Github-Action@v1
69+
with:
70+
appId: ${{ secrets.FIREBASE_APP_ID }}
71+
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
72+
groups: hmh-team
73+
file: app/build/outputs/apk/release/app-release.apk
74+
releaseNotes: ${{ env.RELEASE_NOTES }}

โ€Ž.gitignoreโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ captures/
1818
.cxx/
1919
*.apk
2020
output.json
21+
output-metadata.json
2122

2223
# IntelliJ
2324
*.iml

โ€Žapp/build.gradle.ktsโ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ android {
5252
signingConfig = signingConfigs.getByName("release")
5353
}
5454
}
55+
56+
lint {
57+
disable.add("Instantiatable")
58+
baseline = file("lint-baseline.xml")
59+
}
5560
}
5661

5762
dependencies {

โ€Žapp/lint-baseline.xmlโ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<issues format="6" by="lint 8.1.4" type="baseline" client="gradle" dependencies="false" name="AGP (8.1.4)" variant="fatal" version="8.1.4">
3+
4+
</issues>

โ€Žcore/common/src/main/AndroidManifest.xmlโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<application>
77
<activity
8-
android:name=".permission.PermissionDescriptionActivity"
8+
android:name=".permission.PermissionActivity"
99
android:exported="false" />
1010
</application>
1111

โ€Žcore/common/src/test/java/TimeTest.ktโ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ class TimeUtilsTest {
133133
val expectedStartMillis =
134134
currentDate.toStartOfDayTime().toEpochMilliseconds(defaultTimeZone)
135135
val expectedEndMillis = getNowLocalDateTime().toEpochMilliseconds(defaultTimeZone)
136-
assertEquals(expectedStartMillis, startMillis)
137-
assertEquals(expectedEndMillis, endMillis)
136+
assertTrue(expectedStartMillis - startMillis < 1000)
137+
assertTrue(expectedEndMillis - endMillis < 1000)
138138
}
139139

140140
// ํƒ€๊ฒŸ ๋‚ ์งœ์˜ ์‹œ์ž‘ ์‹œ๊ฐ„๊ณผ ์ข…๋ฃŒ ์‹œ๊ฐ„์„ Epoch ๋ฐ€๋ฆฌ์ดˆ๋กœ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜ ํ…Œ์ŠคํŠธ
@@ -144,8 +144,8 @@ class TimeUtilsTest {
144144
val (startMillis, endMillis) = getTargetDayStartEndEpochMillis(targetDate)
145145
val expectedStartMillis = targetDate.toStartOfDayTime().toEpochMilliseconds(defaultTimeZone)
146146
val expectedEndMillis = getNowLocalDateTime().toEpochMilliseconds(defaultTimeZone)
147-
assertEquals(expectedStartMillis, startMillis)
148-
assertEquals(expectedEndMillis, endMillis)
147+
assertTrue(expectedStartMillis - startMillis < 1000)
148+
assertTrue(expectedEndMillis - endMillis < 1000)
149149
}
150150

151151
// ๊ธฐ๋ณธ ํƒ€์ž„์กด์˜ ํ˜„์žฌ ๋‚ ์งœ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜ ํ…Œ์ŠคํŠธ

0 commit comments

Comments
ย (0)