Skip to content

Commit

Permalink
Simplify the checker (#19)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
niosus authored Jan 2, 2023
1 parent 208b038 commit c602919
Show file tree
Hide file tree
Showing 14 changed files with 295 additions and 634 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
upload_progress_bar_to_wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: ${{ github.repository }}.wiki
path: wiki
Expand All @@ -23,7 +23,9 @@ jobs:
needs: upload_progress_bar_to_wiki
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -52,7 +54,7 @@ jobs:
needs: run_tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: ${{ github.repository }}.wiki
path: wiki
Expand Down Expand Up @@ -94,4 +96,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ dist/

.DS_Store
.vscode/

!homework_checker/core/tests/data/homework/homework_3/cpptests/external/googletest
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "homework_checker/core/tests/data/homework/homework_3/cpptests/external/googletest"]
path = homework_checker/core/tests/data/homework/homework_3/cpptests/external/googletest
url = https://github.com/google/googletest.git
232 changes: 105 additions & 127 deletions Pipfile.lock

Large diffs are not rendered by default.

33 changes: 4 additions & 29 deletions homework_checker/core/schema_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from schema import Schema, SchemaError, Or, Optional # type: ignore[import]

from .tools import MAX_DATE_STR
from .schema_tags import Tags, OutputTags, BuildTags, LangTags
from .schema_tags import Tags, OutputTags

log = logging.getLogger("GHC")

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

injection_schema = {
Tags.INJECT_SOURCE_TAG: str,
Tags.INJECT_DESTINATION_TAG: str,
}

test_schema = {
Tags.NAME_TAG: str,
Optional(Tags.INPUT_ARGS_TAG): str,
Optional(Tags.INJECT_FOLDER_TAG): [injection_schema],
Optional(Tags.RUN_GTESTS_TAG, default=False): bool,
Tags.CMD_TAG: str,
Optional(Tags.EXPECTED_OUTPUT_TAG): Or(str, float, int),
Optional(Tags.INPUT_PIPE_TAG, default=""): str,
Optional(Tags.OUTPUT_PIPE_TAG, default=""): str,
Optional(Tags.OUTPUT_TYPE_TAG): Or(OutputTags.STRING, OutputTags.NUMBER),
Optional(Tags.TIMEOUT_TAG, default=60): float,
}

style_check_schema = {
Tags.NAME_TAG: str,
}

task_schema = {
Tags.NAME_TAG: str,
Tags.LANGUAGE_TAG: Or(LangTags.CPP, LangTags.BASH),
Tags.FOLDER_TAG: str,
Optional(Tags.OUTPUT_TYPE_TAG, default=OutputTags.STRING): Or(
OutputTags.STRING, OutputTags.NUMBER
),
Optional(
Tags.COMPILER_FLAGS_TAG, default="-std=c++17 -Wall -Wpedantic -Wextra"
): str,
Optional(Tags.BINARY_NAME_TAG, default="main"): str,
Optional(Tags.BUILD_TYPE_TAG, default=BuildTags.CMAKE): Or(
BuildTags.CMAKE, BuildTags.SIMPLE
),
Optional(Tags.BUILD_TIMEOUT_TAG, default=60): float,
Optional(Tags.STYLE_CHECKERS_TAG): [style_check_schema],
Optional(Tags.TESTS_TAG): [test_schema],
Tags.TESTS_TAG: [test_schema],
}

homework_schema = {
Expand Down
29 changes: 1 addition & 28 deletions homework_checker/core/schema_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,14 @@
class Tags:
"""List of tags available."""

BINARY_NAME_TAG = "binary_name"
BUILD_TIMEOUT_TAG = "build_timeout"
BUILD_TYPE_TAG = "build_type"
COMPILER_FLAGS_TAG = "compiler_flags"
CMD_TAG = "cmd"
DEADLINE_TAG = "submit_by"
EXPECTED_OUTPUT_TAG = "expected_output"
FOLDER_TAG = "folder"
HOMEWORKS_TAG = "homeworks"
INJECT_DESTINATION_TAG = "destination"
INJECT_FOLDER_TAG = "inject_folders"
INJECT_SOURCE_TAG = "source"
INPUT_ARGS_TAG = "input_args"
INPUT_PIPE_TAG = "input_pipe_args"
LANGUAGE_TAG = "language"
NAME_TAG = "name"
OUTPUT_PIPE_TAG = "output_pipe_args"
OUTPUT_TYPE_TAG = "output_type"
RUN_GTESTS_TAG = "run_google_tests"
STYLE_CHECKERS_TAG = "style_checkers"
TASKS_TAG = "tasks"
TESTS_TAG = "tests"
TIMEOUT_TAG = "timeout"
Expand All @@ -37,22 +26,6 @@ class OutputTags:
ALL = [STRING, NUMBER]


class BuildTags:
"""Define tags for build types."""

CMAKE = "cmake"
SIMPLE = "simple"
ALL = [CMAKE, SIMPLE]


class LangTags:
"""Define tags for build types."""

CPP = "cpp"
BASH = "bash"
ALL = [CPP, BASH]


class OneOf:
"""Check that an item is one of the list."""

Expand Down
Loading

0 comments on commit c602919

Please sign in to comment.