feat: support groups
Some checks failed
build / build (push) Failing after 2m8s
build / trigger-build-image (push) Has been skipped

This commit is contained in:
张泊明518370910136 2025-09-24 03:20:21 -07:00
parent 6f26d17656
commit a6f931a879
GPG Key ID: D47306D7062CDA9D
15 changed files with 63 additions and 28 deletions

View File

@ -146,7 +146,7 @@ class Parser(BaseModel):
class StageDetail(BaseModel): class StageDetail(BaseModel):
name: str name: str
group: str = "" groups: List[str] = []
executor: Executor executor: Executor
parsers: List[Parser] parsers: List[Parser]

View File

@ -191,6 +191,7 @@ class Case(StrictBaseModel):
class Stage(Case): class Stage(Case):
name: str = "" # stage name name: str = "" # stage name
groups: List[str] = [] # list of groups
parsers: List[Parser] = [] # list of parsers parsers: List[Parser] = [] # list of parsers
dummy: ParserDummy = ParserDummy() dummy: ParserDummy = ParserDummy()

View File

@ -14,14 +14,17 @@ def get_conf_stage(
task_stage: task.Stage, task_stage: task.Stage,
cached: Dict[str, None], cached: Dict[str, None],
) -> result.StageDetail: ) -> result.StageDetail:
if task_stage.groups:
groups = task_stage.groups
else:
# single group is determined by adding between "[]" in the name of the task
if match := re.search(r"\[([^\[\]]+)\]", task_stage.name):
groups = [match.group(1)]
else:
groups = []
conf_stage = result.StageDetail( conf_stage = result.StageDetail(
name=task_stage.name, name=task_stage.name,
# group is determined by adding between "[]" in the name of the task groups=groups,
group=(
match.group(1)
if (match := re.search(r"\[([^\[\]]+)\]", task_stage.name or ""))
else ""
),
executor=result.Executor( executor=result.Executor(
name="sandbox", name="sandbox",
with_=get_executor_with(task_stage, cached), with_=get_executor_with(task_stage, cached),

View File

@ -10,7 +10,7 @@
"stages": [ "stages": [
{ {
"name": "Health Check", "name": "Health Check",
"group": "", "groups": [],
"executor": { "executor": {
"name": "local", "name": "local",
"with": { "with": {
@ -107,7 +107,7 @@
}, },
{ {
"name": "Compilation", "name": "Compilation",
"group": "", "groups": [],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {
@ -203,7 +203,9 @@
}, },
{ {
"name": "[cq] Filelength", "name": "[cq] Filelength",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {
@ -310,7 +312,9 @@
}, },
{ {
"name": "[cq] Clang-tidy", "name": "[cq] Clang-tidy",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {
@ -445,7 +449,9 @@
}, },
{ {
"name": "[cq] Cppcheck", "name": "[cq] Cppcheck",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {
@ -603,7 +609,9 @@
}, },
{ {
"name": "[cq] Cpplint", "name": "[cq] Cpplint",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {
@ -713,7 +721,9 @@
}, },
{ {
"name": "[joj] ex2-asan", "name": "[joj] ex2-asan",
"group": "joj", "groups": [
"joj"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {
@ -869,7 +879,7 @@
"postStages": [ "postStages": [
{ {
"name": "teapot", "name": "teapot",
"group": "", "groups": [],
"executor": { "executor": {
"name": "local", "name": "local",
"with": { "with": {

View File

@ -10,7 +10,9 @@
"stages": [ "stages": [
{ {
"name": "[cq] Clang-tidy", "name": "[cq] Clang-tidy",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {

View File

@ -10,7 +10,9 @@
"stages": [ "stages": [
{ {
"name": "[cq] Cppcheck", "name": "[cq] Cppcheck",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {

View File

@ -10,7 +10,9 @@
"stages": [ "stages": [
{ {
"name": "[cq] Cpplint", "name": "[cq] Cpplint",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {

View File

@ -10,7 +10,9 @@
"stages": [ "stages": [
{ {
"name": "[joj] ex2-asan", "name": "[joj] ex2-asan",
"group": "joj", "groups": [
"joj"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {

View File

@ -10,7 +10,9 @@
"stages": [ "stages": [
{ {
"name": "[cq] elf", "name": "[cq] elf",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {

View File

@ -10,7 +10,7 @@
"stages": [ "stages": [
{ {
"name": "Health Check", "name": "Health Check",
"group": "", "groups": [],
"executor": { "executor": {
"name": "local", "name": "local",
"with": { "with": {
@ -100,7 +100,7 @@
"postStages": [ "postStages": [
{ {
"name": "teapot", "name": "teapot",
"group": "", "groups": [],
"executor": { "executor": {
"name": "local", "name": "local",
"with": { "with": {

View File

@ -10,7 +10,7 @@
"stages": [ "stages": [
{ {
"name": "Health Check", "name": "Health Check",
"group": "", "groups": [],
"executor": { "executor": {
"name": "local", "name": "local",
"with": { "with": {
@ -107,7 +107,10 @@
}, },
{ {
"name": "Generate yes.txt [no]", "name": "Generate yes.txt [no]",
"group": "no", "groups": [
"run",
"no"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {
@ -425,7 +428,7 @@
"postStages": [ "postStages": [
{ {
"name": "teapot", "name": "teapot",
"group": "", "groups": [],
"executor": { "executor": {
"name": "local", "name": "local",
"with": { "with": {

View File

@ -33,6 +33,8 @@ groups.time-period-hour = [24, 1]
# e.g. commit msg "test(hw7): run yes" will not run this stage # e.g. commit msg "test(hw7): run yes" will not run this stage
# commit msg "test(hw7): run yes [no]" will run this stage # commit msg "test(hw7): run yes [no]" will run this stage
name = "Generate yes.txt [no]" name = "Generate yes.txt [no]"
# you can also use this fields to override the above groups
groups = ["run", "no"]
# =================================================== # ===================================================
# ========== executor related config start ========== # ========== executor related config start ==========

View File

@ -10,7 +10,9 @@
"stages": [ "stages": [
{ {
"name": "[cq] Filelength", "name": "[cq] Filelength",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {

View File

@ -10,7 +10,9 @@
"stages": [ "stages": [
{ {
"name": "[cq] Filelength", "name": "[cq] Filelength",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {

View File

@ -10,7 +10,9 @@
"stages": [ "stages": [
{ {
"name": "[cq] Filelength", "name": "[cq] Filelength",
"group": "cq", "groups": [
"cq"
],
"executor": { "executor": {
"name": "sandbox", "name": "sandbox",
"with": { "with": {