Benchmark Builder #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
- name: Validate Gradle Wrapper | |
uses: gradle/actions/wrapper-validation@d156388eb19639ec20ade50009f3d199ce1e2808 # 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') | |
steps: | |
- name: Clone Repository (${{ needs.prepare-build.outputs.TAG_NAME }}) | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
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@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Set up gradle | |
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # 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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
path: "**/*.apk" | |
retention-days: 90 |