feat: support stage.env
All checks were successful
build / build (push) Successful in 1m20s

This commit is contained in:
张泊明518370910136 2025-06-02 06:41:03 -04:00
parent f556801884
commit 8c1c3fa881
GPG Key ID: D47306D7062CDA9D
5 changed files with 9 additions and 2 deletions

View File

@ -8,6 +8,7 @@ DEFAULT_FILE_LIMIT = Memory("32m")
DEFAULT_CASE_SCORE = 5 DEFAULT_CASE_SCORE = 5
DEFAULT_CLOCK_LIMIT_MULTIPLIER = 2 DEFAULT_CLOCK_LIMIT_MULTIPLIER = 2
DEFAULT_PROC_LIMIT = 50 DEFAULT_PROC_LIMIT = 50
DEFAULT_PATH_ENV = "PATH=/usr/bin:/bin:/usr/local/bin"
JOJ3_CONFIG_ROOT = PurePosixPath("/home/tt/.config/joj") JOJ3_CONFIG_ROOT = PurePosixPath("/home/tt/.config/joj")
TEAPOT_CONFIG_ROOT = PurePosixPath("/home/tt/.config/teapot") TEAPOT_CONFIG_ROOT = PurePosixPath("/home/tt/.config/teapot")

View File

@ -7,6 +7,7 @@ from joj3_config_generator.models.const import (
DEFAULT_CPU_LIMIT, DEFAULT_CPU_LIMIT,
DEFAULT_FILE_LIMIT, DEFAULT_FILE_LIMIT,
DEFAULT_MEMORY_LIMIT, DEFAULT_MEMORY_LIMIT,
DEFAULT_PATH_ENV,
DEFAULT_PROC_LIMIT, DEFAULT_PROC_LIMIT,
) )
@ -46,7 +47,7 @@ InputFile = Union[LocalFile, MemoryFile, PreparedFile, Symlink]
class Cmd(BaseModel): class Cmd(BaseModel):
args: List[str] = [] args: List[str] = []
env: List[str] = ["PATH=/usr/bin:/bin:/usr/local/bin"] env: List[str] = [DEFAULT_PATH_ENV]
stdin: Union[InputFile, StreamIn] = MemoryFile(content="") stdin: Union[InputFile, StreamIn] = MemoryFile(content="")
stdout: Union[Collector, StreamOut] = Collector(name="stdout") stdout: Union[Collector, StreamOut] = Collector(name="stdout")
stderr: Union[Collector, StreamOut] = Collector(name="stderr") stderr: Union[Collector, StreamOut] = Collector(name="stderr")

View File

@ -8,6 +8,7 @@ from joj3_config_generator.models import result, task
from joj3_config_generator.models.common import Memory, Time from joj3_config_generator.models.common import Memory, Time
from joj3_config_generator.models.const import ( from joj3_config_generator.models.const import (
DEFAULT_CLOCK_LIMIT_MULTIPLIER, DEFAULT_CLOCK_LIMIT_MULTIPLIER,
DEFAULT_PATH_ENV,
JOJ3_CONFIG_ROOT, JOJ3_CONFIG_ROOT,
) )
from joj3_config_generator.models.task import Parser as ParserEnum from joj3_config_generator.models.task import Parser as ParserEnum
@ -86,6 +87,7 @@ def get_executor_with(
executor_with_config = result.ExecutorWith( executor_with_config = result.ExecutorWith(
default=result.Cmd( default=result.Cmd(
args=shlex.split(task_stage.command), args=shlex.split(task_stage.command),
env=[DEFAULT_PATH_ENV, *task_stage.env],
copy_in={ copy_in={
file: result.LocalFile(src=str(JOJ3_CONFIG_ROOT / file)) file: result.LocalFile(src=str(JOJ3_CONFIG_ROOT / file))
# all copyin files store in this tools folder # all copyin files store in this tools folder

View File

@ -111,7 +111,9 @@
"./tools/compile" "./tools/compile"
], ],
"env": [ "env": [
"PATH=/usr/bin:/bin:/usr/local/bin" "PATH=/usr/bin:/bin:/usr/local/bin",
"CC=clang",
"CXX=clang++"
], ],
"stdin": { "stdin": {
"content": "" "content": ""

View File

@ -6,6 +6,7 @@ release.begin_time = 2024-12-29 23:59:59+08:00
[[stages]] [[stages]]
name = "Compilation" name = "Compilation"
env = [ "CC=clang", "CXX=clang++" ]
command = "./tools/compile" # eg. script running cmake commands command = "./tools/compile" # eg. script running cmake commands
files.import = [ "tools/compile" ] files.import = [ "tools/compile" ]
files.export = [ "h7/build/ex2", "h7/build/ex2-asan", "h7/build/ex2-ubsan", "h7/build/ex2-msan", "h7/build/compile_commands.json" ] files.export = [ "h7/build/ex2", "h7/build/ex2-asan", "h7/build/ex2-ubsan", "h7/build/ex2-msan", "h7/build/compile_commands.json" ]