feat: add target platform x86 in flutter build #35
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: CI | |
on: [push, workflow_dispatch] | |
# If CI is already running for a branch when that branch is updated, cancel the older jobs. | |
concurrency: | |
group: ci-${{ github.ref }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
flutter_job: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
api-level: [31] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Java 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Setup Flutter 3.10.3 | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.10.3' | |
channel: 'stable' | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: Install Maestro | |
run: | | |
curl -Ls "https://get.maestro.mobile.dev" | bash | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: Run setup script | |
run: ./setup_flutter_as_app.sh | |
- name: Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: android-tv | |
profile: tv_1080p | |
arch: x86 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
avd-name: macos-ci-avd | |
script: echo "Generated AVD snapshot for caching." | |
- name: Run Flutter tests | |
run: flutter test | |
- name: Run integration tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: android-tv | |
arch: x86 | |
profile: tv_1080p | |
force-avd-creation: false | |
avd-name: macos-ci-avd | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: | | |
flutter build apk --release --target-platform=android-x86 | |
adb install build/app/outputs/flutter-apk/app-release.apk | |
~/.maestro/bin/maestro test ./integration_test/run-flow.yml | |
- name : Upload results | |
if : ${{ always() }} | |
uses : actions/upload-artifact@v3 | |
with : | |
name : integration_testing_results-${{ matrix.api-level }} | |
path : ~/.maestro/tests/** | |
android_native_job: | |
needs: flutter_job | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
api-level: [31] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Run setup script | |
run: ./setup_flutter_as_app.sh | |
- name: Build Android App | |
run: | | |
cd ./android_native_app | |
./gradlew assembleRelease | |
- name: Run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: android-tv | |
arch: x86 | |
profile: tv_1080p | |
force-avd-creation: false | |
avd-name: macos-ci-avd | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: | | |
adb uninstall com.android.app.example | |
adb install ./android_native_app/app/build/outputs/apk/release/app-release.apk | |
~/.maestro/bin/maestro test ./integration_test/run-flow.yml | |
- name : Upload results | |
if : ${{ always() }} | |
uses : actions/upload-artifact@v3 | |
with : | |
name : integration_testing_results-2-${{ matrix.api-level }} | |
path : ~/.maestro/tests/** |