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):
name: str
group: str = ""
groups: List[str] = []
executor: Executor
parsers: List[Parser]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
"stages": [
{
"name": "Health Check",
"group": "",
"groups": [],
"executor": {
"name": "local",
"with": {
@ -107,7 +107,10 @@
},
{
"name": "Generate yes.txt [no]",
"group": "no",
"groups": [
"run",
"no"
],
"executor": {
"name": "sandbox",
"with": {
@ -425,7 +428,7 @@
"postStages": [
{
"name": "teapot",
"group": "",
"groups": [],
"executor": {
"name": "local",
"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
# commit msg "test(hw7): run yes [no]" will run this stage
name = "Generate yes.txt [no]"
# you can also use this fields to override the above groups
groups = ["run", "no"]
# ===================================================
# ========== executor related config start ==========

View File

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

View File

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

View File

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