Fix bad HTML in README #152
Workflow file for this run
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: Build Android on PRs | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
jobs: | |
build_android: | |
strategy: | |
matrix: | |
flutter_version: ['stable', 'beta'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Setup Flutter (${{ matrix.flutter_version }} channel) | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ matrix.flutter_version }} # or: 'beta', 'stable', 'master' | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache | |
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path | |
- name: Print flutter version | |
run: flutter --version | |
- name: Setup Melos | |
uses: bluefireteam/melos-action@v3 | |
- name: Pub get | |
run: flutter pub get | |
working-directory: flutter_theoplayer_sdk/flutter_theoplayer_sdk | |
- name: Run unit test | |
run: flutter test | |
working-directory: flutter_theoplayer_sdk/flutter_theoplayer_sdk | |
# configure for emulator | |
- name: Enable KVM | |
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: Gradle cache | |
uses: gradle/actions/setup-gradle@v3 | |
- name: AVD cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-34 | |
- name: create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' #check previous step output | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 34 | |
target: google_apis | |
arch: x86_64 | |
cores: 2 | |
ram-size: 3072M | |
force-avd-creation: true | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: echo "Generated AVD snapshot for caching." | |
- name: Run integration tests on emulator | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 34 | |
target: google_apis | |
arch: x86_64 | |
cores: 2 | |
ram-size: 3072M | |
force-avd-creation: true | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: flutter test integration_test | |
working-directory: flutter_theoplayer_sdk/flutter_theoplayer_sdk/example | |
env: | |
TEST_LICENSE: ${{ secrets.TEST_LICENSE }} | |
- name: Build APK | |
run: flutter build apk | |
working-directory: flutter_theoplayer_sdk/flutter_theoplayer_sdk/example | |
- name: Build app bundle | |
run: flutter build appbundle | |
working-directory: flutter_theoplayer_sdk/flutter_theoplayer_sdk/example | |
- name: Save APK to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: example_app-${{ matrix.flutter_version }}.apk | |
path: flutter_theoplayer_sdk/flutter_theoplayer_sdk/example/build/app/outputs/flutter-apk/app-release.apk | |
retention-days: 5 | |