Flutter Browserstack Android Build #169
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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Flutter Browserstack Android Build | |
defaults: | |
run: | |
working-directory: das_client | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
schedule: | |
- cron: '0 2 * * *' | |
push: | |
paths: | |
- 'das_client/**' | |
branches: [ "main" ] | |
pull_request: | |
paths: | |
- 'das_client/**' | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24.3' | |
- name: Prepare Flutter Build | |
env: | |
ANDROID_KEYSTORE_STRING: ${{ secrets.ANDROID_KEYSTORE }} | |
ANDROID_KEYSTORE: ${{ github.workspace }}/das_client/android/das.keystore | |
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
run: | | |
echo $ANDROID_KEYSTORE_STRING | base64 -d > $ANDROID_KEYSTORE | |
echo "ANDROID_KEYSTORE=$ANDROID_KEYSTORE" >> "$GITHUB_ENV" | |
echo "ANDROID_KEYSTORE_PASSWORD=$ANDROID_KEYSTORE_PASSWORD" >> "$GITHUB_ENV" | |
echo "ANDROID_KEY_ALIAS=$ANDROID_KEY_ALIAS" >> "$GITHUB_ENV" | |
echo "ANDROID_KEY_PASSWORD=$ANDROID_KEY_PASSWORD" >> "$GITHUB_ENV" | |
flutter pub get | |
flutter pub run build_runner build --delete-conflicting-outputs | |
- shell: bash | |
env: | |
MQTT_USERNAME: ${{ secrets.MQTT_USERNAME }} | |
MQTT_PASSWORD: ${{ secrets.MQTT_PASSWORD }} | |
run: | | |
flutter build apk --flavor dev -t integration_test/app_test.dart --no-tree-shake-icons --debug --dart-define=MQTT_USERNAME=$MQTT_USERNAME --dart-define=MQTT_PASSWORD=$MQTT_PASSWORD | |
- name: Build Test Package | |
run: | | |
cd android | |
./gradlew app:assembleAndroidTest | |
cd .. | |
- name: Upload and Run on Browserstack | |
uses: Grodien/[email protected] | |
with: | |
browserstackUsername: ${{ secrets.BROWSERSTACK_USERNAME }} | |
browserstackAccessKey: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
project: das_client | |
customId: das_client_android | |
buildTag: das_client_android | |
appFilePath: ${{ github.workspace }}/das_client/build/app/outputs/flutter-apk/app-dev-debug.apk | |
testFilePath: ${{ github.workspace }}/das_client/build/app/outputs/apk/androidTest/dev/debug/app-dev-debug-androidTest.apk | |
devices: Samsung Galaxy Tab S9-13.0,Samsung Galaxy Tab S8-12.0 |