-
Notifications
You must be signed in to change notification settings - Fork 280
79 lines (66 loc) · 2.78 KB
/
pr_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
# A workflow to build and upload APKs for pull requests
name: PR Build
on:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ master ]
# Only allow the latest build to run for a given PR, and cancel any previous builds
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
env:
CMAKE_VERSION: "3.22.1"
NDK_VERSION: "26.1.10909125"
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore CCache
uses: hendrikmuhs/[email protected]
with:
max-size: 3Gi
- name: Restore Gradle Cache
uses: actions/cache@v4
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: Android Assemble
env:
CMAKE_C_COMPILER_LAUNCHER: "ccache"
CMAKE_CXX_COMPILER_LAUNCHER: "ccache"
CCACHE_COMPILERCHECK: "string:${{ env.NDK_VERSION }}" # Use NDK version instead of compiler timestamp
PR_NUMBER: ${{ github.event.number }}
run: ./gradlew --stacktrace --build-cache --parallel --configure-on-demand assembleDevRelease assembleDevReldebug
- name: Rename APKs
run: |
mv app/build/outputs/apk/dev/release/app-dev-release.apk strato-pr${{ github.event.number }}-release.apk
mv app/build/outputs/apk/dev/reldebug/app-dev-reldebug.apk strato-pr${{ github.event.number }}-reldebug.apk
- name: Upload Release APK
uses: actions/upload-artifact@v4
with:
name: strato-pr${{ github.event.number }}-release.apk
path: strato-pr${{ github.event.number }}-release.apk
- name: Upload Debug APK
uses: actions/upload-artifact@v4
with:
name: strato-pr${{ github.event.number }}-reldebug.apk
path: strato-pr${{ github.event.number }}-reldebug.apk