-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (96 loc) · 3.33 KB
/
android-ci-workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Android CI
on:
push:
branches:
- "dev"
paths: 'android/**'
pull_request:
branches:
- "dev"
paths: 'android/**'
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
steps:
- uses: actions/checkout@v3
- name: Create file
run: cat $GITHUB_WORKSPACE/androidandroid/app/google-services.json | base64
- name: Putting google data
env:
DATA: ${{ secrets.ANDROID_GOOGLE_SERVICE }}
run: echo $DATA > $GITHUB_WORKSPACE/android/app/google-services.json
- name: Add URL
env:
BASE_URL: ${{ secrets.APP_BASE_URL }}
run: |
echo "APP_BASE_URL=\"BASE_URL\"" >> ./local.properties
- name: Access KAKAO KEY
env:
APP_KEY: ${{ secrets.KAKAO_APP_KEY }}
NATIVE_KEY: ${{ secrets.KAKAO_NATIVE_KEY }}
run: |
echo "KAKAO_APP_KEY=\"APP_KEY\"" >> ./local.properties
echo "KAKAO_NATIVE_KEY=\"NATIVE_KEY\"" >> ./local.properties
- name: set up Java JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
# Gradle wrapper 파일 실행 권한
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# Gradle 캐싱: 빌드 시간과 네트워크 통신을 줄이기 위해 의존성 패키지들을 캐싱하여 재사용
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Unit test
run: ./gradlew --info test
- name: Publish Unit test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: '**/build/test-results/test/TEST-*.xml'
- name: Notify Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Android Build Failure Notification
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ANDROID_CI_WEBHOOK_URL }} # required
if: failure()
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Build APK
run: bash ./gradlew assembleDebug --stacktrace
- run: './gradlew assembleDebug'
- uses: MeilCli/slack-upload-file@v1
with:
slack_token: ${{ secrets.ANDROID_CD_BOT_KEY }}
channels: ${{ secrets.ANDROID_CD_CHANNEL_NAME }}
file_path: 'android/app/build/outputs/apk/debug/app-debug.apk'
file_name: 'app-debug.apk'
file_type: 'apk'
initial_comment: '${{ github.ref }} 테스트 앱 슬랙 배포 성공'
- name: 테스트용 apk artifact 업로드
uses: actions/upload-artifact@v1
with:
name: app-slack-debug.apk
path: android/app/build/outputs/apk/debug/app-debug.apk
# Gradle 캐시 제거
- name: Cleanup Gradle Cache
if: always()
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties