forked from flutter-tizen/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Boram Bae <[email protected]>
- Loading branch information
Showing
3 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Analyze | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
dart: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
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^)) | ||
if [[ ! -z $CHANGED_PACKAGES ]]; then | ||
echo $CHANGED_PACKAGES | ||
echo "HAS_CHANGED_PACKAGES=true" >> "$GITHUB_ENV" | ||
fi | ||
- name: Install flutter-tizen | ||
if: ${{ env.HAS_CHANGED_PACKAGES == 'true' }} | ||
run: | | ||
git clone https://github.com/flutter-tizen/flutter-tizen.git | ||
- name: Analyze changed packages | ||
if: ${{ env.HAS_CHANGED_PACKAGES == 'true' }} | ||
run: | | ||
ROOT_DIR=`pwd` | ||
export PATH=$PATH:`pwd`/flutter-tizen/bin | ||
python3 tools/run_command.py analyze --run-on-changed-packages --base-sha $(git rev-parse HEAD^) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/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): | ||
subprocess.run('flutter-tizen pub get', shell=True, cwd=plugin) | ||
completed_process = subprocess.run('flutter-tizen analyze', shell=True, cwd=plugin) | ||
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) |
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