Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: subosito/flutter-action@v1
with:
flutter-version: "2.2.1"
Expand All @@ -18,6 +20,8 @@ jobs:
done
- name: Verify formatting
run: flutter format --set-exit-if-changed packages
- name: Analyze the plugin's Dart code
run: tools/run_command.py analyze --run-on-changed-packages --base-sha $(git rev-parse HEAD^)
clang:
runs-on: ubuntu-latest
steps:
Expand Down
37 changes: 37 additions & 0 deletions tools/commands/analyze_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python3

import subprocess
import sys
import os
import commands.command_utils as command_utils


def parse_args(args):
parser = command_utils.get_options_parser(
plugins=True, exclude=True, run_on_changed_packages=True, base_sha=True, command='analyze')
return parser.parse_args(args)


def _run_analyze_plugins(plugin_dir):
completed_process = subprocess.run('flutter analyze --pub', shell=True, cwd=plugin_dir)
if completed_process.returncode == 0:
return True
else:
return False


def run_analyze_plugins(argv):
args = parse_args(argv)
packages_dir = command_utils.get_package_dir()
target_plugins, _ = command_utils.get_target_plugins(
packages_dir, plugins=args.plugins, exclude=args.exclude, run_on_changed_packages=args.run_on_changed_packages,
base_sha=args.base_sha)
results = []
for plugin in target_plugins:
result = _run_analyze_plugins(os.path.join(packages_dir, plugin))
results.append(result)

if False not in results:
exit(0)
else:
exit(1)
5 changes: 2 additions & 3 deletions tools/commands/build_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ def parse_args(args):
return parser.parse_args(args)


def _build_examples(plugin):
name = os.path.basename(plugin)
example_dir = os.path.join(plugin, 'example')
def _build_examples(plugin_dir):
example_dir = os.path.join(plugin_dir, 'example')
subprocess.run('flutter-tizen pub get', shell=True, cwd=example_dir)

completed_process = subprocess.run('flutter-tizen build tpk --device-profile wearable -v',
Expand Down
7 changes: 7 additions & 0 deletions tools/run_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from commands import integration_test
from commands import build_example
from commands import print_plugins
from commands import analyze_plugins


# Check tidy
Expand All @@ -28,11 +29,17 @@ def run_print_plugins(arv):
print_plugins.run_print_plugins(arv)


# Analyze plugin packages
def run_analyze_plugins(arv):
analyze_plugins.run_analyze_plugins(arv)


commands = {}
commands['tidy'] = {'func': run_check_tidy, 'info': 'Check and update format for C++ files'}
commands['test'] = {'func': run_integration_test, 'info': 'Run integration test'}
commands['build'] = {'func': run_build_examples, 'info': 'Build examples of plugin'}
commands['plugins'] = {'func': run_print_plugins, 'info': 'Print plugins list'}
commands['analyze'] = {'func': run_analyze_plugins, 'info': 'Analyze the plugin\'s Dart code'}


def print_usage():
Expand Down