Skip to content

Show the Car Info app without Notifications app #3220

Show the Car Info app without Notifications app

Show the Car Info app without Notifications app #3220

Workflow file for this run

name: build # used as the badge name
on:
push:
branches: ['*']
tags: ['*']
pull_request:
types: [opened, synchronize]
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_ALIAS: upload
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.KEYSTORE_ALIAS_PASSWORD }}
AndroidAutoIdrive_SpotifyApiKey: ${{ secrets.ANDROIDAUTOIDRIVE_SPOTIFYAPIKEY }}
AndroidAutoIdrive_SentryDsn: ${{ secrets.ANDROIDAUTOIDRIVE_SENTRYDSN }}
AndroidAutoIdrive_GmapsApiKey: ${{ secrets.ANDROIDAUTOIDRIVE_GMAPSAPIKEY }}
AndroidAutoIdrive_MapboxAccessToken: ${{ secrets.ANDROIDAUTOIDRIVE_MAPBOXACCESSTOKEN }}
AndroidAutoIdrive_MapboxDownloadToken: ${{ secrets.ANDROIDAUTOIDRIVE_MAPBOXDOWNLOADTOKEN }}
jobs:
unitTest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
map: [Nomap, Gmap, Mapbox]
analytics: [Nonalytics, Sentry]
hasSecret:
- ${{ github.repository == 'BimmerGestalt/AAIdrive' && github.event_name == 'push' }}
exclude: # don't run Mapbox tests if we are in a context that doesn't have the Mapbox secret
- hasSecret: false
map: Mapbox # Mapbox requires secrets to build
steps:
- name: Checkout the project
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Prepare cached external dependencies
uses: actions/cache@v4
with:
key: aaidrive_external_${{ hashFiles('.github/actions/download-externals-action/download.sh') }}
path: |
external
- name: Download build dependencies
uses: ./.github/actions/download-externals-action
# disabled for being flaky
#- name: Validate Gradle Wrapper
# uses: gradle/wrapper-validation-action@v1
- name: Build the project
run: ./gradlew compile${{ matrix.map }}${{ matrix.analytics }}FullDebugKotlin --stacktrace
- name: Run unit tests
run: ./gradlew test${{ matrix.map }}${{ matrix.analytics }}FullDebugUnitTestCoverage
- name: Upload CodeCov report
if: github.event.pull_request.title != 'New Crowdin updates' && github.event.ref != 'refs/heads/l10n_main' # don't upload coverage for Crowdin pushes
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
with:
files: app/build/reports/jacoco/jacoco.xml
flags: unittests
instrumentedTest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
map: [Nomap, Gmap, Mapbox]
hasSecret:
- ${{ github.repository == 'BimmerGestalt/AAIdrive' && github.event_name == 'push' }}
exclude: # don't run Gmap tests if we are in a context that doesn't have the gmap secret
- hasSecret: false
map: Gmap
- hasSecret: false
map: Mapbox # Mapbox requires secrets to build
steps:
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Checkout the project
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Prepare cached external dependencies
uses: actions/cache@v4
with:
key: aaidrive_external_${{ hashFiles('.github/actions/download-externals-action/download.sh') }}
path: |
external
- name: Download build dependencies
uses: ./.github/actions/download-externals-action
- name: Build the project
run: ./gradlew compile${{ matrix.map }}NonalyticsFullDebugKotlin --stacktrace
- name: Prepare emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 28
emulator-build: 7425822
target: google_apis
script: adb install external/BMW_Connected_v3.1.1.3078_apkpure.com.apk
- name: Run instrumented tests
uses: reactivecircus/android-emulator-runner@v2
with:
force-avd-creation: false
api-level: 28
emulator-build: 7425822
target: google_apis
script: >-
adb logcat -c && timeout 30m ./gradlew connected${{ matrix.map }}NonalyticsFullDebugAndroidTestCoverage --stacktrace ||
(adb logcat -d && exit 1)
- name: Upload CodeCov report
if: matrix.map == 'Nomap' && github.event.pull_request.title != 'New Crowdin updates' && github.event.ref != 'refs/heads/l10n_main' # don't upload Gmap test results, which don't run during PRs
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
with:
files: app/build/reports/jacoco/jacoco.xml
# flags: instrumentedtests
# android connectedTests don't leave the app or files installed after the test
# so we have to invoke it manually
- name: Generate screenshots
uses: reactivecircus/android-emulator-runner@v2
with:
force-avd-creation: false
api-level: 28
emulator-build: 7425822
target: google_apis
script: >-
adb logcat -c && ./gradlew install${{ matrix.map }}NonalyticsFullDebug --stacktrace &&
./gradlew install${{ matrix.map }}NonalyticsFullDebugAndroidTest --stacktrace &&
( timeout 30m adb shell am instrument -w -e class me.hufman.androidautoidrive.MainScreenshotTest,me.hufman.androidautoidrive.WelcomeScreenshotTest me.hufman.androidautoidrive.test/me.hufman.androidautoidrive.DexOpenerAndroidJUnitRunner ||
timeout 30m adb shell am instrument -w -e class me.hufman.androidautoidrive.MainScreenshotTest,me.hufman.androidautoidrive.WelcomeScreenshotTest me.hufman.androidautoidrive.test/me.hufman.androidautoidrive.DexOpenerAndroidJUnitRunner ) &&
./gradlew fetchScreenshots --stacktrace || adb logcat -d
- name: Package screenshots
uses: actions/upload-artifact@v4
if: matrix.map == 'Nomap'
with:
retention-days: 7
name: screenshots
path: |
app/build/reports/androidTests/connected/screenshots/*
package:
# Only build on the main repo, which has the secrets configured
if: github.repository == 'BimmerGestalt/AAIdrive' && github.event_name == 'push'
needs: [unitTest] # wait for the tests to succeed
runs-on: ubuntu-latest
steps:
- name: Checkout the project
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Prepare cached external dependencies
uses: actions/cache@v4
with:
key: aaidrive_external_${{ hashFiles('.github/actions/download-externals-action/download.sh') }}
path: |
external
- name: Download build dependencies
uses: ./.github/actions/download-externals-action
- name: Extract signing key
run: "echo ${{ secrets.KEYSTORE_BASE64 }} | base64 -d > keystore.jks"
- name: Build nomap artifacts
run: ./gradlew assembleNomap --stacktrace
- name: Build mapbox artifacts
run: ./gradlew assembleMapbox --stacktrace
- name: Calculate APK hashes
run: "find app/build/outputs/apk -name '*.apk' -execdir sha1sum {} \\;"
- name: Confirm APK hashes
run: "find app/build/outputs/apk -name '*.sha1' -exec cat {} \\; -execdir sha1sum -c {} \\;"
- name: Upload APKs
uses: actions/upload-artifact@v4
with:
retention-days: 7
name: apk
path: |
app/build/outputs/apk/nomapNonalyticsFull/release/*apk
app/build/outputs/apk/nomapNonalyticsFull/release/*apk.sha1
app/build/outputs/apk/nomapSentryFull/release/*apk
app/build/outputs/apk/nomapSentryFull/release/*apk.sha1
app/build/outputs/apk/mapboxNonalyticsFull/release/*apk
app/build/outputs/apk/mapboxNonalyticsFull/release/*apk.sha1
app/build/outputs/apk/mapboxSentryFull/release/*apk
app/build/outputs/apk/mapboxSentryFull/release/*apk.sha1
upload_s3:
if: github.event_name == 'push'
needs: package
runs-on: ubuntu-latest
steps:
- name: Download project artifacts
uses: actions/[email protected]
with:
name: apk
- name: Determine branch name
run: echo "BRANCH_NAME=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
- name: Stage upload directory
run: |
mkdir dist
cp nomapNonalyticsFull/release/*apk dist/androidautoidrive-latest-${BRANCH_NAME}-nomap-nonalytics-release.apk
cp nomapSentryFull/release/*apk dist/androidautoidrive-latest-${BRANCH_NAME}-nomap-sentry-release.apk
cp mapboxNonalyticsFull/release/*apk dist/androidautoidrive-latest-${BRANCH_NAME}-mapbox-nonalytics-release.apk
cp mapboxSentryFull/release/*apk dist/androidautoidrive-latest-${BRANCH_NAME}-mapbox-sentry-release.apk
- name: Upload to S3
uses: shallwefootball/[email protected]
with:
source_dir: dist
destination_dir: aaidrive/builds
aws_bucket: bimmergestalt
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
upload_release:
if: startsWith(github.ref, 'refs/tags/')
needs: package
runs-on: ubuntu-latest
steps:
- name: Download project artifacts
uses: actions/[email protected]
with:
name: apk
- name: Stage upload directory
run: |
mkdir dist
cp */release/*apk* dist/
- name: Upload to Github release
uses: svenstaro/upload-release-action@v2
with:
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: dist/*
overwrite: true