-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (89 loc) · 2.45 KB
/
main_android.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
name: Android build on main
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Test source code
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Load Gradle from cache
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Run tests
run: ./gradlew testDebugUnitTest --continue --stacktrace
- name: Upload reports
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test-reports
path:
./app/build/reports/tests/**
lint:
name: Lint source code
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Load Gradle from cache
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Run linting
run: ./gradlew lintDebug --stacktrace
- name: Upload reports
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: lint-reports
path:
./app/build/reports/lint*
build:
name: Build APK
needs: [test, lint]
runs-on: ubuntu-latest
env:
VERSION_CODE: ${{ github.run_id }}
VERSION_SUFFIX: SNAPSHOT
steps:
- uses: actions/checkout@v3
- name: Load Gradle from cache
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: gradle
- id: appVersion
run: echo "::set-output name=VERSION::$(./gradlew -q printVersion)"
- name: Build APK
id: buildApk
run: ./gradlew assembleRelease --stacktrace
- name: Sign APK
id: signApk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: ./app/build/outputs/apk/release
alias: ${{ secrets.ALIAS }}
signingKeyBase64: ${{ secrets.KEYSTORE }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.PASSWORD }}
env:
BUILD_TOOLS_VERSION: 30.0.3
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app-${{ steps.appVersion.outputs.version }}
path: |
./app/build/outputs/apk/release/**.apk
./app/release/**.apk