Skip to content

Commit

Permalink
v4.0.1
Browse files Browse the repository at this point in the history
* Fix KeyError with skip-dependency-check flag during ci

* Add skip-web-compile flag to CI

* Fix ci_analyze.py

* Add table output to CI
  • Loading branch information
maxnz committed Apr 8, 2020
1 parent 829c4f1 commit 36cf89e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

setup(
name='stograde',
version='4.0.0',
version='4.0.1',
description='The StoGrade Toolkit',
author='Hawken Rives',
author_email='hawkrives@gmail.com',
Expand Down
4 changes: 3 additions & 1 deletion stograde/student/ci_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import re
from typing import List, TYPE_CHECKING

from ..common.run_status import RunStatus

if TYPE_CHECKING:
from ..student.student_result import StudentResult

Expand All @@ -22,7 +24,7 @@ def ci_analyze(student_results: List['StudentResult']) -> bool:
else:
# Alert student about any compilation errors
for compilation in file.compile_results:
if compilation.status != 'success':
if compilation.status is not RunStatus.SUCCESS:
if file.compile_optional:
logging.warning("{}: File {} compile error (This did not fail the build)"
.format(result.spec_id, file.file_name))
Expand Down
6 changes: 3 additions & 3 deletions stograde/toolkit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def main():
course: str = args['course']
skip_dependency_check: bool = args['skip_dependency_check']
skip_version_check: bool = args['skip_version_check']
stogit: str = args['stogit']
stogit: str = args.get('stogit', '')

if not skip_version_check:
current_version, new_version = update_available()
Expand Down Expand Up @@ -56,8 +56,8 @@ def main():
assignments = [path.split('/')[-1].split('.')[0]
for path in find_all_specs(os.path.join(base_dir, 'data', 'specs'))]

date: str = args['date']
skip_spec_update: bool = args['skip_spec_update']
date: str = args.get('date', '')
skip_spec_update: bool = args.get('skip_spec_update', False)

if date:
logging.debug('Checking out {}'.format(date))
Expand Down
20 changes: 12 additions & 8 deletions stograde/toolkit/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def build_argparser():
help=('Check out last submission on GIT_DATE (eg, "last week", "tea time", "2 hrs ago")'
'(see `man git-rev-list`)'))

compile_options = argparse.ArgumentParser(add_help=False)
compile_options.add_argument('--skip-web-compile', action='store_true',
help='Skip compilation and testing of files marked with web: true')

# Student selection
student_selection = argparse.ArgumentParser(add_help=False)
selection_args = student_selection.add_argument_group('student selection')
Expand All @@ -83,13 +87,14 @@ def build_argparser():
sub_parsers = parser.add_subparsers(dest='command')

# CI SubParser
parser_ci = sub_parsers.add_parser('ci', help="Check a single student's assignment as part of a CI job")
parser_ci = sub_parsers.add_parser('ci', parents=[base_options, compile_options], conflict_handler='resolve',
help="Check a single student's assignment as part of a CI job")
parser_ci.set_defaults(func=do_ci)

# Record SubParser
parser_record = sub_parsers.add_parser('record', help="Record students' work",
parents=[base_options, record_options, repo_selection, table_options,
student_selection],
parents=[base_options, record_options, compile_options,
repo_selection, table_options, student_selection],
conflict_handler='resolve')
parser_record.set_defaults(func=do_record)
parser_record.add_argument('assignments', nargs='+', metavar='HW',
Expand All @@ -102,8 +107,6 @@ def build_argparser():
help="Interact with each student's submission individually")
parser_record.add_argument('--skip-branch-check', '-B', action='store_true',
help='Do not check for unmerged branches')
parser_record.add_argument('--skip-web-compile', action='store_true',
help='Skip compilation and testing of files marked with web: true')

# Repo SubParser
parser_repo = sub_parsers.add_parser('repo', help='Tools for cloning and updating student repositories',
Expand All @@ -118,14 +121,15 @@ def build_argparser():

# Table SubParser
parser_table = sub_parsers.add_parser('table', help='Print an table of the assignments submitted by students',
parents=[base_options, record_options, repo_selection, table_options,
student_selection],
parents=[base_options, record_options, compile_options, repo_selection,
table_options, student_selection],
conflict_handler='resolve')
parser_table.set_defaults(func=do_table)

# Web SubParser
parser_web = sub_parsers.add_parser('web', help='Run the CLI for grading React App files',
parents=[base_options, record_options, repo_selection, student_selection],
parents=[base_options, record_options, compile_options,
repo_selection, student_selection],
conflict_handler='resolve')
parser_web.set_defaults(func=do_web)
parser_web.add_argument('assignments', nargs=1, metavar='HW',
Expand Down
4 changes: 3 additions & 1 deletion stograde/toolkit/subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ def do_ci(specs: Dict[str, 'Spec'],
skip_web_compile=skip_web_compile,
stogit_url=stogit_url,
workers=1,
work_dir='./students')
work_dir='.')

passing: bool = ci_analyze(results)
table = tabulate(results)
print('\n' + table + '\n')
if not passing:
logging.debug('Build failed')
sys.exit(1)
Expand Down

0 comments on commit 36cf89e

Please sign in to comment.