Skip to content

Commit c602919

Browse files
authored
Simplify the checker (#19)
- Remove most of the settings - Introduce the cmd setting - Remove most of the code to read settings - Remove different kinds of tasks - Add googletest as a submodule - Checkout submodules in github actions - Bump package version - Fix dependabot alert
1 parent 208b038 commit c602919

File tree

14 files changed

+295
-634
lines changed

14 files changed

+295
-634
lines changed

.github/workflows/main.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
upload_progress_bar_to_wiki:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v3
1010
with:
1111
repository: ${{ github.repository }}.wiki
1212
path: wiki
@@ -23,7 +23,9 @@ jobs:
2323
needs: upload_progress_bar_to_wiki
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v3
27+
with:
28+
submodules: recursive
2729
- name: Set up Python
2830
uses: actions/setup-python@v2
2931
with:
@@ -52,7 +54,7 @@ jobs:
5254
needs: run_tests
5355
runs-on: ubuntu-latest
5456
steps:
55-
- uses: actions/checkout@v2
57+
- uses: actions/checkout@v3
5658
with:
5759
repository: ${{ github.repository }}.wiki
5860
path: wiki
@@ -94,4 +96,4 @@ jobs:
9496
uses: pypa/gh-action-pypi-publish@release/v1
9597
with:
9698
user: __token__
97-
password: ${{ secrets.PYPI_API_TOKEN }}
99+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ dist/
3030

3131
.DS_Store
3232
.vscode/
33+
34+
!homework_checker/core/tests/data/homework/homework_3/cpptests/external/googletest

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "homework_checker/core/tests/data/homework/homework_3/cpptests/external/googletest"]
2+
path = homework_checker/core/tests/data/homework/homework_3/cpptests/external/googletest
3+
url = https://github.com/google/googletest.git

Pipfile.lock

+105-127
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

homework_checker/core/schema_manager.py

+4-29
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from schema import Schema, SchemaError, Or, Optional # type: ignore[import]
1111

1212
from .tools import MAX_DATE_STR
13-
from .schema_tags import Tags, OutputTags, BuildTags, LangTags
13+
from .schema_tags import Tags, OutputTags
1414

1515
log = logging.getLogger("GHC")
1616

@@ -26,43 +26,18 @@ class SchemaManager:
2626
def __init__(self: SchemaManager, file_name: Path):
2727
"""Create a schema for my tests."""
2828

29-
injection_schema = {
30-
Tags.INJECT_SOURCE_TAG: str,
31-
Tags.INJECT_DESTINATION_TAG: str,
32-
}
33-
3429
test_schema = {
3530
Tags.NAME_TAG: str,
36-
Optional(Tags.INPUT_ARGS_TAG): str,
37-
Optional(Tags.INJECT_FOLDER_TAG): [injection_schema],
38-
Optional(Tags.RUN_GTESTS_TAG, default=False): bool,
31+
Tags.CMD_TAG: str,
3932
Optional(Tags.EXPECTED_OUTPUT_TAG): Or(str, float, int),
40-
Optional(Tags.INPUT_PIPE_TAG, default=""): str,
41-
Optional(Tags.OUTPUT_PIPE_TAG, default=""): str,
33+
Optional(Tags.OUTPUT_TYPE_TAG): Or(OutputTags.STRING, OutputTags.NUMBER),
4234
Optional(Tags.TIMEOUT_TAG, default=60): float,
4335
}
4436

45-
style_check_schema = {
46-
Tags.NAME_TAG: str,
47-
}
48-
4937
task_schema = {
5038
Tags.NAME_TAG: str,
51-
Tags.LANGUAGE_TAG: Or(LangTags.CPP, LangTags.BASH),
5239
Tags.FOLDER_TAG: str,
53-
Optional(Tags.OUTPUT_TYPE_TAG, default=OutputTags.STRING): Or(
54-
OutputTags.STRING, OutputTags.NUMBER
55-
),
56-
Optional(
57-
Tags.COMPILER_FLAGS_TAG, default="-std=c++17 -Wall -Wpedantic -Wextra"
58-
): str,
59-
Optional(Tags.BINARY_NAME_TAG, default="main"): str,
60-
Optional(Tags.BUILD_TYPE_TAG, default=BuildTags.CMAKE): Or(
61-
BuildTags.CMAKE, BuildTags.SIMPLE
62-
),
63-
Optional(Tags.BUILD_TIMEOUT_TAG, default=60): float,
64-
Optional(Tags.STYLE_CHECKERS_TAG): [style_check_schema],
65-
Optional(Tags.TESTS_TAG): [test_schema],
40+
Tags.TESTS_TAG: [test_schema],
6641
}
6742

6843
homework_schema = {

homework_checker/core/schema_tags.py

+1-28
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@
55
class Tags:
66
"""List of tags available."""
77

8-
BINARY_NAME_TAG = "binary_name"
9-
BUILD_TIMEOUT_TAG = "build_timeout"
10-
BUILD_TYPE_TAG = "build_type"
11-
COMPILER_FLAGS_TAG = "compiler_flags"
8+
CMD_TAG = "cmd"
129
DEADLINE_TAG = "submit_by"
1310
EXPECTED_OUTPUT_TAG = "expected_output"
1411
FOLDER_TAG = "folder"
1512
HOMEWORKS_TAG = "homeworks"
16-
INJECT_DESTINATION_TAG = "destination"
17-
INJECT_FOLDER_TAG = "inject_folders"
18-
INJECT_SOURCE_TAG = "source"
19-
INPUT_ARGS_TAG = "input_args"
20-
INPUT_PIPE_TAG = "input_pipe_args"
21-
LANGUAGE_TAG = "language"
2213
NAME_TAG = "name"
2314
OUTPUT_PIPE_TAG = "output_pipe_args"
2415
OUTPUT_TYPE_TAG = "output_type"
25-
RUN_GTESTS_TAG = "run_google_tests"
26-
STYLE_CHECKERS_TAG = "style_checkers"
2716
TASKS_TAG = "tasks"
2817
TESTS_TAG = "tests"
2918
TIMEOUT_TAG = "timeout"
@@ -37,22 +26,6 @@ class OutputTags:
3726
ALL = [STRING, NUMBER]
3827

3928

40-
class BuildTags:
41-
"""Define tags for build types."""
42-
43-
CMAKE = "cmake"
44-
SIMPLE = "simple"
45-
ALL = [CMAKE, SIMPLE]
46-
47-
48-
class LangTags:
49-
"""Define tags for build types."""
50-
51-
CPP = "cpp"
52-
BASH = "bash"
53-
ALL = [CPP, BASH]
54-
55-
5629
class OneOf:
5730
"""Check that an item is one of the list."""
5831

0 commit comments

Comments
 (0)