-
Notifications
You must be signed in to change notification settings - Fork 30
145 lines (119 loc) · 3.6 KB
/
build.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: CI
on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize ]
concurrency:
group: ci-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
TMDB_API_KEY: ${{ secrets.TMDB_API_KEY }}
TMDB_API_URL: ${{ secrets.TMDB_API_URL }}
TRAKT_CLIENT_ID: ${{ secrets.TRAKT_CLIENT_ID }}
TRAKT_CLIENT_SECRET: ${{ secrets.TRAKT_CLIENT_SECRET }}
TRAKT_REDIRECT_URI: ${{ secrets.TRAKT_REDIRECT_URI }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/[email protected]
- name: Add App Secrets
run: |
echo -e "\TMDB_API_KEY=$TMDB_API_KEY" >> ./local.properties
echo -e "\TMDB_API_URL=$TMDB_API_URL" >> ./local.properties
echo -e "\TRAKT_CLIENT_ID=$TRAKT_CLIENT_ID" >> ./local.properties
echo -e "\TRAKT_CLIENT_SECRET=$TRAKT_CLIENT_SECRET" >> ./local.properties
echo -e "\TRAKT_REDIRECT_URI=$TRAKT_REDIRECT_URI" >> ./local.properties
- name: Build with gradle
run: ./gradlew assemble
android-lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: lintDebug
run: ./gradlew lint
- uses: actions/upload-artifact@v3
with:
name: android-lint-report
path: ~/**/build/reports/lint-results*.html
spotless:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: spotless
run: ./gradlew spotlessCheck --init-script tooling/checks/spotless.gradle.kts --no-configuration-cache
- uses: actions/upload-artifact@v3
with:
name: detekt-report
path: ./**/build/reports/detekt/detekt.*
unit-test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: unitTest
run: ./gradlew testDemoDebug
- name: Jvm Test
run: ./gradlew jvmTest
- uses: actions/upload-artifact@v3
with:
name: unit-test-report
path: ./**/build/reports/tests/
create-release:
runs-on: ubuntu-latest
needs: [
build,
android-lint,
spotless,
unit-test
]
if: ${{ always() && !cancelled() && needs.build.result == 'success' }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: Create release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: android/app/build/outputs/apk/demo/debug/app-demo-debug.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build outputs (APKs)
uses: actions/upload-artifact@v3
with:
name: build-outputs
path: android/app/build/outputs