33344
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s

This commit is contained in:
编码猿
2025-10-05 02:16:12 +08:00
parent e37cb7ba2c
commit 7acf000234
2 changed files with 95 additions and 68 deletions

View File

@@ -4,107 +4,109 @@
# just run `./act_runner generate-config > config.yaml` to generate a config file.
log:
# The level of logging, can be trace, debug, info, warn, error, fatal
# 日志级别,可选值:trace, debug, info, warn, error, fatal
level: info
runner:
# Where to store the registration result.
# 注册结果存储位置
file: .runner
# Execute how many tasks concurrently at the same time.
# 同时执行的任务并发数
capacity: 1
# Extra environment variables to run jobs.
# 运行作业的额外环境变量
envs:
A_TEST_ENV_NAME_1: a_test_env_value_1
A_TEST_ENV_NAME_2: a_test_env_value_2
# Extra environment variables to run jobs from a file.
# It will be ignored if it's empty or the file doesn't exist.
# 从文件加载额外环境变量
# 如果为空或文件不存在则忽略
env_file: .env
# The timeout for a job to be finished.
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
# 作业完成的超时时间
# 注意Gitea 实例也有作业超时设置默认3小时
# 如果 Gitea 的超时时间更短,作业可能会被 Gitea 停止
timeout: 3h
# The timeout for the runner to wait for running jobs to finish when shutting down.
# Any running jobs that haven't finished after this timeout will be cancelled.
# 关闭时等待运行中作业完成的超时时间
# 在此超时后仍未完成的运行中作业将被取消
shutdown_timeout: 0s
# Whether skip verifying the TLS certificate of the Gitea instance.
# 是否跳过验证 Gitea 实例的 TLS 证书
insecure: false
# The timeout for fetching the job from the Gitea instance.
# 从 Gitea 实例获取作业的超时时间
fetch_timeout: 5s
# The interval for fetching the job from the Gitea instance.
# 从 Gitea 实例获取作业的间隔时间
fetch_interval: 2s
# The github_mirror of a runner is used to specify the mirror address of the github that pulls the action repository.
# It works when something like `uses: actions/checkout@v4` is used and DEFAULT_ACTIONS_URL is set to github,
# and github_mirror is not empty. In this case,
# it replaces https://github.com with the value here, which is useful for some special network environments.
# 用于指定拉取 action 仓库的 GitHub 镜像地址
# 当使用类似 `uses: actions/checkout@v4` DEFAULT_ACTIONS_URL 设置为 github 时生效
# 如果 github_mirror 不为空,会将 https://github.com 替换为此处的值
# 这对某些特殊网络环境很有用
github_mirror: ''
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
# Like: "macos-arm64:host" or "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
# Find more images provided by Gitea at https://gitea.com/docker.gitea.com/runner-images .
# If it's empty when registering, it will ask for inputting labels.
# If it's empty when execute `daemon`, will use labels in `.runner` file.
# runner 的标签用于确定可以运行哪些作业以及如何运行它们
# 例如:"macos-arm64:host" "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
# https://gitea.com/docker.gitea.com/runner-images 查找 Gitea 提供的更多镜像
# 注册时如果为空,会要求输入标签
# 执行 `daemon` 时如果为空,将使用 `.runner` 文件中的标签
labels:
- "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
- "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
- "ubuntu-20.04:docker://docker.gitea.com/runner-images:ubuntu-20.04"
# 作用:配置 Actions 缓存功能,加速依赖下载和构建过程
cache:
# Enable cache server to use actions/cache.
# 启用缓存服务器以使用 actions/cache
enabled: true
# The directory to store the cache data.
# If it's empty, the cache data will be stored in $HOME/.cache/actcache.
# 存储缓存数据的目录
# 如果为空,缓存数据将存储在 $HOME/.cache/actcache
dir: ""
# The host of the cache server.
# It's not for the address to listen, but the address to connect from job containers.
# So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
# 缓存服务器的主机地址
# 这不是监听地址,而是作业容器连接的地址
# 因此 0.0.0.0 是个不好的选择,留空以自动检测
host: ""
# The port of the cache server.
# 0 means to use a random available port.
# 缓存服务器的端口
# 0 表示使用随机可用端口
port: 0
# The external cache server URL. Valid only when enable is true.
# If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
# The URL should generally end with "/".
# 外部缓存服务器 URL。仅在 enable true 时有效
# 如果指定act_runner 将使用此 URL 作为 ACTIONS_CACHE_URL 而不是自行启动服务器
# URL 通常应以 "/" 结尾
external_server: ""
container:
# Specifies the network to which the container will connect.
# Could be host, bridge or the name of a custom network.
# If it's empty, act_runner will create a network automatically.
# 指定容器将连接到的网络
# 可以是 hostbridge 或自定义网络名称
# 如果为空act_runner 将自动创建网络
network: ""
# Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
# 启动任务容器时是否使用特权模式(Docker-in-Docker 需要特权模式)
privileged: false
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
# 启动容器时使用的其他选项(例如 --add-host=my.gitea.url:host-gateway
options:
# The parent directory of a job's working directory.
# NOTE: There is no need to add the first '/' of the path as act_runner will add it automatically.
# If the path starts with '/', the '/' will be trimmed.
# For example, if the parent directory is /path/to/my/dir, workdir_parent should be path/to/my/dir
# If it's empty, /workspace will be used.
# 作业工作目录的父目录
# 注意:不需要在路径开头添加 '/'act_runner 会自动添加
# 如果路径以 '/' 开头,'/' 将被修剪
# 例如,如果父目录是 /path/to/my/dirworkdir_parent 应该是 path/to/my/dir
# 如果为空,将使用 /workspace
workdir_parent:
# Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob
# You can specify multiple volumes. If the sequence is empty, no volumes can be mounted.
# For example, if you only allow containers to mount the `data` volume and all the json files in `/src`, you should change the config to:
# 可以挂载到容器的卷(包括绑定挂载)。支持 glob 语法
# 您可以指定多个卷。如果序列为空,则不能挂载任何卷
# 例如,如果只允许容器挂载 `data` 卷和 /src 中的所有 json 文件,配置应为:
# valid_volumes:
# - data
# - /src/*.json
# If you want to allow any volume, please use the following configuration:
# 如果要允许任何卷,请使用以下配置:
# valid_volumes:
# - '**'
valid_volumes: []
# overrides the docker client host with the specified one.
# If it's empty, act_runner will find an available docker host automatically.
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
# 使用指定的 docker 客户端主机覆盖默认值
# 如果为空act_runner 将自动查找可用的 docker 主机
# 如果是 "-"act_runner 将自动查找可用的 docker 主机,但 docker 主机不会挂载到作业容器和服务容器
# 如果不为空也不是 "-",将使用指定的 docker 主机。如果不起作用将返回错误
docker_host: ""
# Pull docker image(s) even if already present
# 即使已存在也拉取 docker 镜像
force_pull: true
# Rebuild docker image(s) even if already present
# 即使已存在也重新构建 docker 镜像
force_rebuild: false
# Always require a reachable docker daemon, even if not required by act_runner
# 始终要求可访问的 docker 守护进程,即使 act_runner 不需要
require_docker: false
# Timeout to wait for the docker daemon to be reachable, if docker is required by require_docker or act_runner
# 如果 docker 被 require_docker act_runner 需要,等待 docker 守护进程可访问的超时时间
docker_timeout: 0s
host:
# The parent directory of a job's working directory.
# If it's empty, $HOME/.cache/act/ will be used.
workdir_parent:
# 作业工作目录的父目录
# 如果为空,将使用 $HOME/.cache/act/
workdir_parent: