Skip to content

Commit cd0e633

Browse files
committed
First pass at a GitHub Action to Validate Compstates
0 parents  commit cd0e633

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SRComp Validate Action
2+
3+
A GitHub Action to validate a compstate.

action.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: SRComp Validate Action
2+
description: A GitHub Action to validate a compstate.
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Set up Python
7+
uses: actions/checkout@v3
8+
with:
9+
python-version: '3.10'
10+
cache: pip
11+
12+
- name: Install Dependencies
13+
run: pip install -r requirements.txt
14+
15+
- name: Run Compstate Validation
16+
run: ./validate.py
17+
18+
- name: Run Scoring tests
19+
run:
20+
python3 -m unittest discover --buffer scoring/
21+
22+
if [ -d scoring/tests/ ]
23+
then
24+
python3 -m unittest discover --buffer scoring/tests/
25+
fi

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sr.comp>=1.4<2

validate.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
3+
from argparse import ArgumentParser
4+
5+
from sr.comp.comp import SRComp
6+
from sr.comp.validation import validate
7+
8+
parser = ArgumentParser(description="SR Competition State validator")
9+
parser.add_argument("compstate", help="Competition state git repository path")
10+
11+
args = parser.parse_args()
12+
13+
comp = SRComp(args.compstate)
14+
error_count = validate(comp)
15+
16+
exit(error_count)

0 commit comments

Comments
 (0)