Skip to content

Commit 73a0e45

Browse files
committed
WIP
Signed-off-by: Boram Bae <boram21.bae@samsung.com>
1 parent f691594 commit 73a0e45

3 files changed

Lines changed: 76 additions & 1 deletion

File tree

.github/workflows/analyze.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Analyze
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
dart:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
fetch-depth: 2
12+
- name: Find changed packages
13+
run: |
14+
CHANGED_PACKAGES=$(python3 tools/run_command.py plugins --run-on-changed-packages --base-sha $(git rev-parse HEAD^))
15+
if [[ ! -z $CHANGED_PACKAGES ]]; then
16+
echo $CHANGED_PACKAGES
17+
echo "HAS_CHANGED_PACKAGES=true" >> "$GITHUB_ENV"
18+
fi
19+
- name: Install flutter-tizen
20+
if: ${{ env.HAS_CHANGED_PACKAGES == 'true' }}
21+
run: |
22+
git clone https://github.com/flutter-tizen/flutter-tizen.git
23+
- name: Analyze changed packages
24+
if: ${{ env.HAS_CHANGED_PACKAGES == 'true' }}
25+
run: |
26+
ROOT_DIR=`pwd`
27+
export PATH=$PATH:`pwd`/flutter-tizen/bin
28+
python3 tools/run_command.py analyze --run-on-changed-packages --base-sha $(git rev-parse HEAD^)

tools/commands/analyze_plugins.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python3
2+
3+
import subprocess
4+
import sys
5+
import os
6+
import commands.command_utils as command_utils
7+
8+
9+
def parse_args(args):
10+
parser = command_utils.get_options_parser(
11+
plugins=True, exclude=True, run_on_changed_packages=True, base_sha=True, command='analyze')
12+
return parser.parse_args(args)
13+
14+
15+
def _run_analyze_plugins(plugin):
16+
subprocess.run('flutter-tizen pub get', shell=True, cwd=plugin)
17+
completed_process = subprocess.run('flutter-tizen analyze', shell=True, cwd=plugin)
18+
if completed_process.returncode == 0:
19+
return True
20+
else:
21+
return False
22+
23+
24+
def run_analyze_plugins(argv):
25+
args = parse_args(argv)
26+
packages_dir = command_utils.get_package_dir()
27+
target_plugins, _ = command_utils.get_target_plugins(
28+
packages_dir, plugins=args.plugins, exclude=args.exclude, run_on_changed_packages=args.run_on_changed_packages,
29+
base_sha=args.base_sha)
30+
results = []
31+
for plugin in target_plugins:
32+
result = _run_analyze_plugins(os.path.join(packages_dir, plugin))
33+
results.append(result)
34+
35+
if False not in results:
36+
exit(0)
37+
else:
38+
exit(1)

tools/run_command.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
from commands import integration_test
77
from commands import build_example
88
from commands import print_plugins
9-
9+
from commands import analyze_plugins
1010

1111
# Check tidy
12+
13+
1214
def run_check_tidy(argv):
1315
check_tidy.run_check_tidy(argv)
1416

@@ -27,12 +29,19 @@ def run_build_examples(argv):
2729
def run_print_plugins(arv):
2830
print_plugins.run_print_plugins(arv)
2931

32+
# Analyze plugin packages
33+
34+
35+
def run_analyze_plugins(arv):
36+
analyze_plugins.run_analyze_plugins(arv)
37+
3038

3139
commands = {}
3240
commands['tidy'] = {'func': run_check_tidy, 'info': 'Check and update format for C++ files'}
3341
commands['test'] = {'func': run_integration_test, 'info': 'Run integration test'}
3442
commands['build'] = {'func': run_build_examples, 'info': 'Build examples of plugin'}
3543
commands['plugins'] = {'func': run_print_plugins, 'info': 'Print plugins list'}
44+
commands['analyze'] = {'func': run_analyze_plugins, 'info': 'Analyze plugins for Dart files'}
3645

3746

3847
def print_usage():

0 commit comments

Comments
 (0)