forked from strato-emu/strato
-
Notifications
You must be signed in to change notification settings - Fork 5
113 lines (97 loc) · 4.51 KB
/
ci.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
name: CI
on:
push:
pull_request:
types: [opened, synchronize, reopened, labeled]
jobs:
build:
# Skip 'labeled' events that didn't add the 'ci' label
if: |
github.event_name != 'pull_request' ||
github.event.action != 'labeled' ||
github.event.label.name == 'ci'
runs-on: ubuntu-latest
env:
JVM_OPTS: -Xmx6G
IS_BUILD_SIGNED: ${{ secrets.KEYSTORE != '' }}
UPLOAD_ARTIFACTS: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci') }}
CMAKE_VERSION: "3.22.1"
NDK_VERSION: "26.1.10909125"
steps:
- name: Git Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Restore CCache
uses: hendrikmuhs/[email protected]
with:
max-size: 3Gi
- name: Restore Gradle Cache
uses: actions/cache@v3
with:
path: ~/.gradle/
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('app/**/*.xml') }}-${{ hashFiles('app/**.kt', 'app/**.java') }}
restore-keys: |
${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('app/**/*.xml') }}-
${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-
${{ runner.os }}-gradle-
- name: Install Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin' # Temurin should come pre-installed on GitHub-hosted runners
java-version: '17'
- name: Install Ninja Build
run: |
sudo apt-get install -y ninja-build
ln -s /usr/bin/ninja .
- name: Install CMake & Android NDK
run: echo "yes" | $ANDROID_HOME/tools/bin/sdkmanager "cmake;${{ env.CMAKE_VERSION }}" "ndk;${{ env.NDK_VERSION }}" --channel=3 | grep -v = || true
- name: Decode Keystore
if: env.IS_BUILD_SIGNED == 'true'
env:
KEYSTORE_ENCODED: ${{ secrets.KEYSTORE }}
run: echo $KEYSTORE_ENCODED | base64 --decode > "/home/runner/keystore.jks"
- name: Android Assemble
env:
SIGNING_STORE_PATH: "/home/runner/keystore.jks"
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
CMAKE_C_COMPILER_LAUNCHER: "ccache"
CMAKE_CXX_COMPILER_LAUNCHER: "ccache"
CCACHE_COMPILERCHECK: "string:${{ env.NDK_VERSION }}"
run: ./gradlew --stacktrace --configuration-cache --build-cache --parallel --configure-on-demand assembleFullRelease assembleFullReldebug
- name: Rename APKs (Signed)
if: env.IS_BUILD_SIGNED == 'true' && env.UPLOAD_ARTIFACTS == 'true'
run: |
mv app/build/outputs/apk/full/reldebug/app-full-reldebug.apk strato-$GITHUB_RUN_NUMBER-reldebug.apk
mv app/build/outputs/apk/full/release/app-full-release.apk strato-$GITHUB_RUN_NUMBER-release.apk
- name: Upload Signed Debug APK
if: env.IS_BUILD_SIGNED == 'true' && env.UPLOAD_ARTIFACTS == 'true'
uses: actions/upload-artifact@v3
with:
name: strato-${{ github.run_number }}-reldebug.apk
path: strato-${{ github.run_number }}-reldebug.apk
- name: Upload Signed Release APK
if: env.IS_BUILD_SIGNED == 'true' && env.UPLOAD_ARTIFACTS == 'true'
uses: actions/upload-artifact@v3
with:
name: strato-${{ github.run_number }}-release.apk
path: strato-${{ github.run_number }}-release.apk
- name: Rename APKs (Unsigned)
if: env.IS_BUILD_SIGNED == 'false' && env.UPLOAD_ARTIFACTS == 'true'
run: |
mv app/build/outputs/apk/full/reldebug/app-full-reldebug.apk strato-$GITHUB_RUN_NUMBER-unsigned-reldebug.apk
mv app/build/outputs/apk/full/release/app-full-release.apk strato-$GITHUB_RUN_NUMBER-unsigned-release.apk
- name: Upload Unsigned Debug APK
if: env.IS_BUILD_SIGNED == 'false' && env.UPLOAD_ARTIFACTS == 'true'
uses: actions/upload-artifact@v3
with:
name: strato-${{ github.run_number }}-unsigned-reldebug.apk
path: strato-${{ github.run_number }}-unsigned-reldebug.apk
- name: Upload Unsigned Release APK
if: env.IS_BUILD_SIGNED == 'false' && env.UPLOAD_ARTIFACTS == 'true'
uses: actions/upload-artifact@v3
with:
name: strato-${{ github.run_number }}-unsigned-release.apk
path: strato-${{ github.run_number }}-unsigned-release.apk