-
Notifications
You must be signed in to change notification settings - Fork 2
113 lines (109 loc) · 4.02 KB
/
android.yml
File metadata and controls
113 lines (109 loc) · 4.02 KB
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
name: Android CI
on: pull_request
jobs:
setup:
runs-on: ubuntu-latest
steps:
# usesでplugin的なものが使える
- uses: actions/checkout@v2
# ./gradlewを使えるようにする
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# Gradleの依存関係をキャッシュ/リストアしてビルド時間を短くする
- name: Gradle Cache
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
build:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# .gitignoreしているファイルを生成する
- name: Generate google-services.json
env:
GOOGLE_SERVICES_BASE64: ${{ secrets.GOOGLE_SERVICES_BASE64 }}
run: echo $GOOGLE_SERVICES_BASE64 | base64 --decode --ignore-garbage > $GITHUB_WORKSPACE/app/google-services.json
# Build
- name: Build with Gradle
run: ./gradlew assembleDebug
# Unit Test
- name: Unit Test
run: ./gradlew testDebugUnitTest
danger:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# .gitignoreしているファイルを生成する
- name: Generate google-services.json
env:
GOOGLE_SERVICES_BASE64: ${{ secrets.GOOGLE_SERVICES_BASE64 }}
run: echo $GOOGLE_SERVICES_BASE64 | base64 --decode --ignore-garbage > $GITHUB_WORKSPACE/app/google-services.json
- name: Setup ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
architecture: 'x64'
- name: run ktlintMain
run: ./gradlew ktlintMain
- name: run andoidLint
run: ./gradlew lintDebug
- name: Cache Gems
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-danger-${{ env.cache-name }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-danger-${{ env.cache-name }}-gems-
${{ runner.os }}-danger-${{ env.cache-name }}-
${{ runner.os }}-danger-
- name: run danger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gem install bundler:1.17.2
bundle update
bundle install
bundle exec danger
notification:
needs: [setup, build, danger]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: get commit message
run: |
echo "commitmsg=$(git log --format=%B -n 1 ${{ github.event.after }})" >> $GITHUB_ENV
# 失敗したときのSlackへの通知
- name: Slack Notification Failure
if: failure()
uses: rtCamp/action-slack-notify@v2.0.1
env:
SLACK_CHANNEL: todone
SLACK_ICON: https://media-exp1.licdn.com/dms/image/C5603AQFuUfqaHw0HPA/profile-displayphoto-shrink_200_200/0/1598935909258?e=1631750400&v=beta&t=2CMct_2004N566F80Vw7j0DLWQXTYh92HOCa1ePYX3c
SLACK_COLOR: '#ff0000'
SLACK_TITLE: ':fire: Build Failure :fire:'
SLACK_MESSAGE: |
Build failure!
See more detail to check github.
commit -> `$commitmsg`
SLACK_USERNAME: nana
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# 成功した時のSlackへの通知
- name: Slack Notification Success
if: success()
uses: rtCamp/action-slack-notify@v2.0.1
env:
SLACK_CHANNEL: todone
SLACK_ICON: https://media-exp1.licdn.com/dms/image/C5603AQFuUfqaHw0HPA/profile-displayphoto-shrink_200_200/0/1598935909258?e=1631750400&v=beta&t=2CMct_2004N566F80Vw7j0DLWQXTYh92HOCa1ePYX3c
SLACK_TITLE: ':rocket: Build Success :rocket:'
SLACK_MESSAGE: |
Build success! yattane!
commit -> `$commitmsg`
SLACK_USERNAME: nana
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}