Skip to content

Commit

Permalink
Update the test recipe and workflow (#293)
Browse files Browse the repository at this point in the history
* Update the test recipe and workflow

* Fix recipe

* Fix styles

Co-authored-by: Hakkyu Kim <[email protected]>
  • Loading branch information
swift-kim and HakkyuKim authored Dec 10, 2021
1 parent d2b2404 commit 9d34829
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 68 deletions.
57 changes: 32 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,38 @@ jobs:
fetch-depth: 2
- name: Find changed packages
run: |
CHANGED_PACKAGES=$(python3 tools/run_command.py plugins --run-on-changed-packages --base-sha $(git rev-parse HEAD^))
CHANGED_PACKAGES=$(python3 tools/run_command.py plugins \
--run-on-changed-packages \
--base-sha=$(git rev-parse HEAD^))
if [[ ! -z $CHANGED_PACKAGES ]]; then
echo $CHANGED_PACKAGES
echo "HAS_CHANGED_PACKAGES=true" >> "$GITHUB_ENV"
echo "HAS_CHANGED_PACKAGES=true" >> $GITHUB_ENV
fi
- name: Install prerequisite packages
if: ${{ env.HAS_CHANGED_PACKAGES == 'true' }}
run: |
sudo apt-get update
sudo apt update
sudo apt install -y \
acl \
bridge-utils \
gettext \
openvpn \
libfontconfig1 \
libglib2.0-0 \
libjpeg-turbo8 \
libpixman-1-0 \
libpng16-16 \
libsdl1.2debian \
libsm6 \
libv4l-0 \
libx11-xcb1 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-xfixes0 \
libxi6
acl \
bridge-utils \
gettext \
openvpn \
libfontconfig1 \
libglib2.0-0 \
libjpeg-turbo8 \
libpixman-1-0 \
libpng16-16 \
libsdl1.2debian \
libsm6 \
libv4l-0 \
libx11-xcb1 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-xfixes0 \
libxi6
- name: Install Tizen Studio
if: ${{ env.HAS_CHANGED_PACKAGES == 'true' }}
run: |
Expand All @@ -62,7 +64,10 @@ jobs:
run: |
export PATH=$PATH:$HOME/tizen-studio/tools/ide/bin
tizen certificate -a platform -p platform -f platform
tizen security-profiles add -n platform -a $HOME/tizen-studio-data/keystore/author/platform.p12 -p platform
tizen security-profiles add \
-n platform \
-a $HOME/tizen-studio-data/keystore/author/platform.p12 \
-p platform
- name: Install flutter-tizen
if: ${{ env.HAS_CHANGED_PACKAGES == 'true' }}
uses: actions/checkout@v2
Expand All @@ -73,4 +78,6 @@ jobs:
if: ${{ env.HAS_CHANGED_PACKAGES == 'true' }}
run: |
export PATH=`pwd`/flutter-tizen/bin:$PATH
./tools/run_command.py build --run-on-changed-packages --base-sha $(git rev-parse HEAD^)
./tools/run_command.py build \
--run-on-changed-packages \
--base-sha=$(git rev-parse HEAD^)
25 changes: 4 additions & 21 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,19 @@ jobs:
with:
repository: flutter-tizen/flutter-tizen
path: flutter-tizen
- name: Run tests for changed plugins
- name: Run tests for changed packages
if: ${{ github.event_name == 'pull_request' }}
run: |
export PATH=`pwd`/flutter-tizen/bin:$PATH
./tools/run_command.py test \
--recipe ./tools/recipe.yaml \
--generate-emulators \
--run-on-changed-packages \
--base-sha=$(git rev-parse HEAD^) \
--exclude wearable_rotary image_picker camera webview_flutter \
video_player permission_handler geolocator battery connectivity \
device_info package_info sensors share wifi_info_flutter \
google_maps_flutter tizen_app_control url_launcher network_info_plus
- name: Run tests for all plugins
--base-sha=$(git rev-parse HEAD^)
- name: Run tests for all packages
if: ${{ github.event_name == 'push' }}
run: |
export PATH=`pwd`/flutter-tizen/bin:$PATH
./tools/run_command.py test \
--recipe ./tools/recipe.yaml \
--generate-emulators \
--exclude wearable_rotary image_picker camera webview_flutter \
video_player permission_handler geolocator battery connectivity \
device_info package_info sensors share wifi_info_flutter \
google_maps_flutter tizen_app_control url_launcher network_info_plus
# The following packages are excluded from tests:
# wearable_rotary, image_picker: no tests.
# camera: no supported profiles.
# video_player: test frequently breaks due to memory issue(https://github.com/flutter-tizen/plugins/issues/135).
# permission_handler: permission related test.
# geolocator: test requires console manipulation.
# battery, connectivity, device_info, package_info, sensors, share, wifi_info_flutter: deprecated.
# google_maps_flutter, webview_flutter, url_launcher, network_info_plus: not supported by emulators
# tizen_app_control: test available after Flutter 2.5 migration.
--generate-emulators
6 changes: 3 additions & 3 deletions .github/workflows/pull_request_label.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Pull Request Labeler"
on:
- pull_request_target
name: Pull Request Labeler

on: [pull_request_target]

jobs:
triage:
Expand Down
6 changes: 3 additions & 3 deletions tools/commands/check_tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def report_error(msg, line=None):
if line.endswith(' \n') or line.endswith('\t\n'):
report_error('trailing whitespace', lineno)
if not line.endswith('\n'):
report_error('line ends without NEW LINE character', lineno)
report_error(
'line ends without NEW LINE character', lineno)

if not line.strip():
stats.empty_lines += 1
Expand All @@ -105,8 +106,7 @@ def set_subparser(subparsers):
parser = subparsers.add_parser(
'tidy',
help='Check and update format for C++ files',
usage=
'run_command.py tidy [-h] [--clang-format PATH] [--update] [--dir PATH]'
usage='run_command.py tidy [-h] [--clang-format PATH] [--update] [--dir PATH]'
)
parser.add_argument('--clang-format',
metavar='PATH',
Expand Down
20 changes: 14 additions & 6 deletions tools/commands/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

class Target:
"""A Tizen device that can run Flutter applications.
A target is a Tizen device (either a physical device or an emulator) that can
run Flutter applications. Generally targets are connected when physical devices
are connected to the host PC either with a cable or wirelessly, and when
Expand All @@ -57,7 +57,7 @@ def __init__(self, name, platform, id=None):

def run_integration_test(self, plugin_name, directory, timeout):
"""Runs integration test in the given directory.
Args:
plugin_name (str): The name of the testing plugin.
directory (str): The path to the directory in which to perform
Expand Down Expand Up @@ -374,14 +374,16 @@ def set_subparser(subparsers):
help='''The recipe file path. A recipe refers to a
yaml file that defines a list of target platforms to test for each plugin.
Pass this file if you want to select specific target platform for different
plugins. Note that recipe does not select which plugins to test(that is covered
by the --plugins option), it only defines which target platform to test
for certain plugins if those plugins are being tested.
plugins. Every package listed in the recipe file will be recognized by the tool
(same as --plugins option) and those that specify an empty list will be
explicitly excluded (same as --exclude option). If --recipe is used,
--plugins and --exclude options will be ignored.
(
plugins:
a: [wearable-5.5, tv-6.0]
b: [mobile-6.0]
c: [wearable-4.0]
d: [] # explicitly excluded
)''')
parser.add_argument(
'--generate-emulators',
Expand Down Expand Up @@ -512,6 +514,12 @@ def run_integration_test(args):
print(
f'The recipe file {args.recipe} is not a valid yaml file.')
exit(1)
if not all([isinstance(val, list) for val in platforms_per_plugin.values()]):
print('Every package in the recipe file must specify a list.')
exit(1)
args.plugins = list(platforms_per_plugin.keys())
args.exclude = [item[0] for item in filter(
lambda item: not item[1], platforms_per_plugin.items())]

if args.platforms:
for platform in args.platforms:
Expand Down Expand Up @@ -541,7 +549,7 @@ def run_integration_test(args):
for testing_plugin in testing_plugins:
test_num += 1
print(
f'============= Testing for {testing_plugin} ({test_num}/{total_plugin_num}) ============='
f'============= Testing {testing_plugin} ({test_num}/{total_plugin_num}) ============='
)
platforms = args.platforms
if testing_plugin in platforms_per_plugin:
Expand Down
39 changes: 29 additions & 10 deletions tools/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,45 @@
plugins:
audioplayers: ["wearable-5.5"]
battery_plus: ["wearable-5.5"]
camera: []
connectivity_plus: ["wearable-5.5", "tv-6.0"]
device_info_plus: ["wearable-5.5", "tv-6.0"]
flutter_tts: ["wearable-5.5", "tv-6.0"]
geolocator: ["wearable-5.5"]
google_maps_flutter: []
image_picker: ["wearable-5.5"]
integration_test: ["wearable-5.5", "tv-6.0"]
messageport: ["wearable-5.5", "tv-6.0"]
network_info_plus: []
package_info_plus: ["wearable-5.5", "tv-6.0"]
path_provider: ["tv-6.0"]
permission_handler: ["wearable-5.5"]
sensors_plus: ["wearable-5.5"]
share_plus: ["wearable-5.5"]
shared_preferences: ["wearable-5.5", "tv-6.0"]
sqflite: ["wearable-5.5", "tv-6.0"]
tizen_app_control: ["wearable-5.5", "tv-6.0"]
url_launcher: []
video_player: ["wearable-5.5"]
wakelock: ["wearable-5.5"]
wearable_rotary: ["wearable-5.5"]

# Not supported by emulators.
camera: []
google_maps_flutter: []
network_info_plus: []
url_launcher: []
webview_flutter: []

# No tests.
image_picker: []
wearable_rotary: []

# Permission cannot be granted without manual interaction.
geolocator: []
permission_handler: []

# Only testable with the drive command: https://github.com/flutter-tizen/plugins/issues/272
tizen_app_control: []

# Test frequently breaks due to memory issue: https://github.com/flutter-tizen/plugins/issues/135
video_player: []

# Deprecated.
battery: []
connectivity: []
device_info: []
package_info: []
sensors: []
share: []
wifi_info_flutter: []

0 comments on commit 9d34829

Please sign in to comment.