-
Notifications
You must be signed in to change notification settings - Fork 16
126 lines (102 loc) · 5.05 KB
/
build_benchmark.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
name: Benchmark Builder
# Manually build a dev benchmark on a tag
on:
# Dispatch or Manual triggers
workflow_dispatch:
# push:
# branches:
# - dev-benchmark
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare-build:
runs-on: ubuntu-latest
outputs:
VERSION_TAG: ${{ steps.get_tag.outputs.VERSION_TAG }}
ARTIFACTS_PREFIX: dev/benchmark/app-dev
TAG_NAME: benchmark-${{ steps.tag_name.outputs.TAG_NAME }}
steps:
- name: Get tag name (${{ github.ref }})
id: get_tag
run: |
set -x
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}"
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Clone Repository (${{ steps.get_tag.outputs.VERSION_TAG }})
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@473878a77f1b98e2b5ac4af93489d1656a80a5ed # v4
- name: Prepare env
id: prepare_env
run: |
set -e
commit_count=$(git rev-list --count HEAD)
echo "COMMIT_COUNT=$commit_count"
echo "COMMIT_COUNT=$commit_count" >> $GITHUB_OUTPUT
- name: Tag name
id: tag_name
run: |
set -e
if [ "${{ steps.get_tag.outputs.VERSION_TAG }}" = "master" ]; then
tag_name=${{ steps.get_tag.outputs.VERSION_TAG }}-r${{ steps.prepare_env.outputs.COMMIT_COUNT }}
else
tag_name=${{ steps.get_tag.outputs.VERSION_TAG }}
fi
echo "TAG_NAME=$tag_name"
echo "TAG_NAME=$tag_name" >> $GITHUB_OUTPUT
build-app:
runs-on: ubuntu-latest
needs: prepare-build
if: startsWith(github.ref, 'refs/tags') && github.repository == 'komikku-app/komikku'
steps:
- name: Clone Repository (${{ needs.prepare-build.outputs.TAG_NAME }})
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup Android SDK
run: |
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
- name: Set up JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
java-version: 17
distribution: temurin
- name: Set up gradle
uses: gradle/actions/setup-gradle@473878a77f1b98e2b5ac4af93489d1656a80a5ed # v4
- name: Build Benchmark app and run unit tests
run: ./gradlew spotlessCheck assembleDevBenchmark testDevBenchmarkUnitTest testReleaseUnitTest -Pandroid.signingConfig=debug --stacktrace
- name: Sign APK
uses: r0adkll/sign-android-release@349ebdef58775b1e0d8099458af0816dc79b6407 # v1
with:
releaseDirectory: app/build/outputs/apk/dev/benchmark
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Get SHA & clean up build artifacts
id: get_sha
run: |
set -e
mv app/build/outputs/apk/${{ needs.prepare-build.outputs.ARTIFACTS_PREFIX }}-universal-benchmark-signed.apk Komikku-${{ needs.prepare-build.outputs.TAG_NAME }}.apk
sha=`sha256sum Komikku-${{ needs.prepare-build.outputs.TAG_NAME }}.apk | awk '{ print $1 }'`
echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_OUTPUT
mv app/build/outputs/apk/${{ needs.prepare-build.outputs.ARTIFACTS_PREFIX }}-arm64-v8a-benchmark-signed.apk Komikku-arm64-v8a-${{ needs.prepare-build.outputs.TAG_NAME }}.apk
sha=`sha256sum Komikku-arm64-v8a-${{ needs.prepare-build.outputs.TAG_NAME }}.apk | awk '{ print $1 }'`
echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_OUTPUT
mv app/build/outputs/apk/${{ needs.prepare-build.outputs.ARTIFACTS_PREFIX }}-armeabi-v7a-benchmark-signed.apk Komikku-armeabi-v7a-${{ needs.prepare-build.outputs.TAG_NAME }}.apk
sha=`sha256sum Komikku-armeabi-v7a-${{ needs.prepare-build.outputs.TAG_NAME }}.apk | awk '{ print $1 }'`
echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_OUTPUT
mv app/build/outputs/apk/${{ needs.prepare-build.outputs.ARTIFACTS_PREFIX }}-x86-benchmark-signed.apk Komikku-x86-${{ needs.prepare-build.outputs.TAG_NAME }}.apk
sha=`sha256sum Komikku-x86-${{ needs.prepare-build.outputs.TAG_NAME }}.apk | awk '{ print $1 }'`
echo "APK_X86_SHA=$sha" >> $GITHUB_OUTPUT
mv app/build/outputs/apk/${{ needs.prepare-build.outputs.ARTIFACTS_PREFIX }}-x86_64-benchmark-signed.apk Komikku-x86_64-${{ needs.prepare-build.outputs.TAG_NAME }}.apk
sha=`sha256sum Komikku-x86_64-${{ needs.prepare-build.outputs.TAG_NAME }}.apk | awk '{ print $1 }'`
echo "APK_X86_64_SHA=$sha" >> $GITHUB_OUTPUT
- name: Upload artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
path: "**/*.apk"
retention-days: 90