mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
Make CI fail on black/pylint failure, but not change files
This commit is contained in:
@@ -12,15 +12,10 @@ install:
|
|||||||
- pip3 install -r requirements.txt
|
- pip3 install -r requirements.txt
|
||||||
before_script:
|
before_script:
|
||||||
- pip3 install -r ./tests/requirements_dev.txt
|
- pip3 install -r ./tests/requirements_dev.txt
|
||||||
- pip3 install anybadge
|
- black --check hyperglass
|
||||||
- . ./tests/ci_git_prep.sh
|
- python3 ./manage.py pylint-check --integer-only True
|
||||||
- black hyperglass
|
|
||||||
- python3 ./manage.py pylint-badge --integer-only True
|
|
||||||
- . ./tests/ci_git_commit.sh
|
|
||||||
- python3 ./tests/ci_prepare.py
|
- python3 ./tests/ci_prepare.py
|
||||||
script:
|
script:
|
||||||
- nohup python3 ./tests/ci_dev_server.py &
|
- nohup python3 ./tests/ci_dev_server.py &
|
||||||
- sleep 20
|
- sleep 20
|
||||||
- python3 ./tests/ci_test.py
|
- python3 ./tests/ci_test.py
|
||||||
after_success:
|
|
||||||
- . ./tests/ci_git_push.sh
|
|
||||||
|
@@ -35,8 +35,7 @@ def construct_test(test_query, location, test_target):
|
|||||||
def hg():
|
def hg():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@hg.command("pylint-check", help="Runs Pylint and generates a badge for GitHub")
|
||||||
@hg.command("pylint-badge", help="Runs Pylint and generates a badge for GitHub")
|
|
||||||
@click.option(
|
@click.option(
|
||||||
"-i",
|
"-i",
|
||||||
"--integer-only",
|
"--integer-only",
|
||||||
@@ -45,7 +44,8 @@ def hg():
|
|||||||
default=False,
|
default=False,
|
||||||
help="Output Pylint score as integer",
|
help="Output Pylint score as integer",
|
||||||
)
|
)
|
||||||
def pylint_badge(int_only):
|
@click.option("-b", "--badge", "create_badge", type=bool, default=False, help="Create Pylint badge")
|
||||||
|
def pylint_check(int_only, create_badge):
|
||||||
try:
|
try:
|
||||||
import re
|
import re
|
||||||
import anybadge
|
import anybadge
|
||||||
@@ -58,6 +58,7 @@ def pylint_badge(int_only):
|
|||||||
).group(1)
|
).group(1)
|
||||||
if not pylint_score == "10.00":
|
if not pylint_score == "10.00":
|
||||||
raise RuntimeError(f"Pylint score {pylint_score} not acceptable.")
|
raise RuntimeError(f"Pylint score {pylint_score} not acceptable.")
|
||||||
|
if create_badge:
|
||||||
badge_file = os.path.join(working_directory, "pylint.svg")
|
badge_file = os.path.join(working_directory, "pylint.svg")
|
||||||
if os.path.exists(badge_file):
|
if os.path.exists(badge_file):
|
||||||
os.remove(badge_file)
|
os.remove(badge_file)
|
||||||
|
Reference in New Issue
Block a user