Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Check different version of android image, to check which is the fastes
Browse files Browse the repository at this point in the history
  • Loading branch information
kbetl-dlb committed Aug 18, 2023
1 parent b0cbe64 commit e761278
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 22 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/android_ci_upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

on:
push:
branches:
- main
- develop
- release/*
pull_request:
branches:
- main
- develop
- release/*

workflow_dispatch:

jobs:
build-macos-android-23:
name: Flutter Run test on android 23
runs-on: macos-12
env:
FLUTTER_VERSION: "3.0.3"
ANDROID_SDK_ROOT: "/Users/runner/android-sdk"
ANDROID_HOME: "~/.android"
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: 17
distribution: 'zulu'
- name: Set up Flutter version 🔧
uses: ./.github/actions/flutter-action
with:
flutter-version: $FLUTTER_VERSION
- name: Fetch dependencies
run: |
flutter pub get
- name: Set up android enviroment
run: |
./scripts/macos_setup_android_env.sh
- name: Configure sdkmanager
run: |
./scripts/macos_configure-sdkmanager.sh 32 32.0.0 "android-23;default;x86"
- name: Run android integration tests
run: |
./scripts/run-mocked-integration-tests-android.sh "android-23;default;x86"
build-macos-android-27:
name: Flutter Run test on android 27
runs-on: macos-12
env:
FLUTTER_VERSION: "3.0.3"
ANDROID_SDK_ROOT: "/Users/runner/android-sdk"
ANDROID_HOME: "~/.android"
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: 17
distribution: 'zulu'
- name: Set up Flutter version 🔧
uses: ./.github/actions/flutter-action
with:
flutter-version: $FLUTTER_VERSION
- name: Fetch dependencies
run: |
flutter pub get
- name: Set up android enviroment
run: |
./scripts/macos_setup_android_env.sh
- name: Configure sdkmanager
run: |
./scripts/macos_configure-sdkmanager.sh 32 32.0.0 "android-23;default;x86"
- name: Run android integration tests
run: |
./scripts/run-mocked-integration-tests-android.sh "android-23;default;x86"
17 changes: 5 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ jobs:
with:
java-version: 15
distribution: 'adopt'
- name: Enable KVM group perms
run: |
sudo apt -y update
sudo apt-get install -y qemu-kvm
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: Set up Flutter version 🔧
uses: ./.github/actions/flutter-action
with:
Expand All @@ -61,8 +54,8 @@ jobs:
run: |
flutter analyze
build-macos-android:
name: flutter build macos android
build-macos-android-21:
name: flutter build macos android 21
runs-on: macos-12
env:
FLUTTER_VERSION: "3.0.3"
Expand All @@ -78,7 +71,7 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: 15
java-version: 17
distribution: 'zulu'
- name: Set up Flutter version 🔧
uses: ./.github/actions/flutter-action
Expand All @@ -92,10 +85,10 @@ jobs:
./scripts/macos_setup_android_env.sh
- name: Configure sdkmanager
run: |
./scripts/macos_configure-sdkmanager.sh
./scripts/macos_configure-sdkmanager.sh 32 32.0.0 "android-21;default;x86"
- name: Run android integration tests
run: |
./scripts/run-mocked-integration-tests-android.sh
./scripts/run-mocked-integration-tests-android.sh "android-21;default;x86"
build-macos-ios:
name: flutter build macos ios
Expand Down
27 changes: 24 additions & 3 deletions scripts/macos_configure-sdkmanager.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
#! /usr/bin/env bash

build_tools_version="build-tools;32.0.0"
platform_version="platforms;android-32"
system_image="system-images;android-29;default;x86"
ANDROID_VERSION="32"
if [ "$2" ]
then ANDROID_TOOLS=$1
fi

ANDROID_TOOLS="$ANDROID_VERSION"
if [ "$2" ]
then ANDROID_TOOLS=$2
fi

ANDROID_IMAGE="android-29;default;x86"
if [ "$3" ]
then ANDROID_IMAGE=$3
fi

echo $ANDROID_VERSION

build_tools_version="build-tools;$ANDROID_TOOLS"
platform_version="platforms;android-$ANDROID_VERSION"
system_image="system-images;$ANDROID_IMAGE"

echo $platform_version
echo $build_tools_version
echo $system_image

export ANDROID_SDK_ROOT=~/android-sdk

Expand Down
7 changes: 5 additions & 2 deletions scripts/macos_setup_android_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

echo "Setup android"

wget https://dl.google.com/android/repository/commandlinetools-mac-9123335_latest.zip
#TOOLS_VERSION=9123335
TOOLS_VERSION=10406996

unzip commandlinetools-mac-9123335_latest.zip
wget "https://dl.google.com/android/repository/commandlinetools-mac-${TOOLS_VERSION}_latest.zip"

unzip "commandlinetools-mac-${TOOLS_VERSION}_latest.zip"

mkdir ~/android-sdk/
mkdir ~/android-sdk/cmdline-tools
Expand Down
18 changes: 13 additions & 5 deletions scripts/run-mocked-integration-tests-android.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#! /usr/bin/env bash

ANDROID_IMAGE="android-29;default;x86"
if [ "$1" ]
then ANDROID_IMAGE=$1
fi

device_name="testAVD"
system_image="system-images;android-29;default;x86"
system_image="system-images;$ANDROID_IMAGE"
device_port="5554"
serial_no="emulator-$device_port"
gpu_mode="swiftshader_indirect"
#gpu_mode="guest"


export ANDROID_HOME=~/.android/
Expand All @@ -21,8 +27,8 @@ avdmanager list avd
echo "Create system image: $system_image"

echo "no" | avdmanager --verbose create avd --force --name $device_name --abi "default/x86" --package "$system_image"
echo "disk.dataPartition.size=8G" >> ~/.android/avd/$device_name.avd/config.ini
echo "hw.ramSize = 3.072MB" >> ~/.android/avd/$device_name.avd/config.ini
echo "disk.dataPartition.size=5G" >> ~/.android/avd/$device_name.avd/config.ini
echo "hw.ramSize = 3072MB" >> ~/.android/avd/$device_name.avd/config.ini
touch ~/.android/emu-update-last-check.ini

ls -la ~/.android/
Expand All @@ -38,7 +44,9 @@ echo "check emulator list:"
emulator -list-avds

echo "start: $device_name"
$ANDROID_SDK_ROOT/emulator/emulator -avd $device_name -port $device_port -noaudio -no-window -no-snapshot -no-boot-anim &
$ANDROID_SDK_ROOT/emulator/emulator -avd $device_name -port $device_port -noaudio -no-window -no-snapshot -no-boot-anim -no-snapshot-load &

adb devices

echo "Device name: $device_name"

Expand All @@ -65,7 +73,7 @@ currentFolder=`pwd`

cd test_app

USE_SDK_MOCK=true flutter test integration_tests/mocked/master_test.dart -d $serial_no
USE_SDK_MOCK=true flutter test integration_tests/mocked/master_test.dart -d $serial_no -r expanded
test_exit_code=$?

cd $currentFolder
Expand Down

0 comments on commit e761278

Please sign in to comment.