Skip to content

Commit

Permalink
submissions schema learns globbing
Browse files Browse the repository at this point in the history
  • Loading branch information
thorehusfeldt committed Dec 12, 2024
1 parent e6ac5f0 commit f739810
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
12 changes: 10 additions & 2 deletions support/schemas/submissions.cue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ import "list"

#verdict: "AC" | "WA" | "RTE" | "TLE"

#testnode_pattern: =~"[a-zA-Z0-9_/\\*]+" // TODO
let globbed_dirname = "[A-Za-z0-9*]([A-Za-z0-9_*-]{0,253}[A-Za-z0-9*])?"
#globbed_dirpath: =~"^(\(globbed_dirname)/)*\(globbed_dirname)$" & !~ "\\*\\*"
let globbed_filename = "([A-Za-z0-9*][A-Za-z0-9_.*-]{0,253}[A-Za-z0-9*]|\\*)"

#globbed_submissionpath: =~"^(\(globbed_dirname)/)*\(globbed_filename)$" & !~ "\\*\\*"
#Submissions: {
[#globbed_submissionpath]: #submission
}

#submission: {
language?: string
entrypoint?: string
author?: #person | [...#person]
#expectation
[=~"^(sample|secret|\\*)" & #testnode_pattern]: #expectation
[=~"^(sample|secret|\\*)" & #globbed_dirpath]: #expectation
}

#expectation: {
Expand Down
50 changes: 50 additions & 0 deletions test/yaml/submissions/valid_yaml/valid.submissions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
accepted/th.py:
permitted: ["AC"]
---
# applies to all submissions in accepted/
accepted:
permitted: ["AC"]
---
# this submissions passes all samples
accepted/a.py:
sample:
permitted: ["AC"]
---
# use globs for testnodes
accepted/a.py:
sample:
required: ["AC"]
secret/*/huge:
required: ["TLE"]
---
# specify many things for a submission
accepted/lovelace.ada:
author: Ada Lovelace <[email protected]>
score: [0, 20]
sample:
required: ["AC"]
secret/*/huge:
required: ["TLE"]
---
# More than one submission:
accepted/a.py:
score: [60, 80]
accepted/b.py:
score: [70, 74]
---
other/*.py:
required: ["TLE"]
---
other/*:
required: ["TLE"]
---
accepted:
author: "Ragnar van’t Höfnarß <foo_@bar>"
permitted: ["AC", "TLE", "WA"]
required: ["TLE"]
score: [40, 50]
sample: { required: [WA] }
sample/1 : { required: [AC] }
secret/*/huge: { required: [TLE] } # can use globbing
"*/sample/foo": { permitted: [AC, TLE] } # remember quotes bc * is weird in YAML
secret/*/*/1: { required: [TLE] } # no **

0 comments on commit f739810

Please sign in to comment.