This commit is contained in:
@@ -1,19 +1,44 @@
|
|||||||
|
# 工作流名称
|
||||||
name: Gitea Actions Demo
|
name: Gitea Actions Demo
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
||||||
|
# 运行名称:在Gitea界面中显示的具体运行名称,支持动态变量
|
||||||
|
run-name: ${{ gitea.actor }} 正在测试 Gitea Actions 🚀
|
||||||
|
|
||||||
|
# 触发条件:当发生push事件时触发
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
|
# 作业定义
|
||||||
jobs:
|
jobs:
|
||||||
|
# 作业名称:探索Gitea Actions
|
||||||
Explore-Gitea-Actions:
|
Explore-Gitea-Actions:
|
||||||
|
# 运行环境:在ubuntu-latest标签的runner上运行
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# 步骤序列
|
||||||
steps:
|
steps:
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
# 步骤1:输出事件信息
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
- run: echo "🎉 该作业由 ${{ gitea.event_name }} 事件自动触发。"
|
||||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
||||||
- name: Check out repository code
|
# 步骤2:输出运行环境信息
|
||||||
|
- run: echo "🐧 该作业现在正在Gitea托管的 ${{ runner.os }} 服务器上运行!"
|
||||||
|
|
||||||
|
# 步骤3:输出分支和仓库信息
|
||||||
|
- run: echo "🔎 您的分支名称是 ${{ gitea.ref }},您的仓库是 ${{ gitea.repository }}。"
|
||||||
|
|
||||||
|
# 步骤4:检出仓库代码(具有名称的步骤)
|
||||||
|
- name: 检出仓库代码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
# 步骤5:输出克隆完成信息
|
||||||
- name: List files in the repository
|
- run: echo "💡 ${{ gitea.repository }} 仓库已克隆到runner。"
|
||||||
|
|
||||||
|
# 步骤6:准备测试提示
|
||||||
|
- run: echo "🖥️ 工作流现已准备好在runner上测试您的代码。"
|
||||||
|
|
||||||
|
# 步骤7:列出仓库文件(多行命令)
|
||||||
|
- name: 列出仓库中的文件
|
||||||
run: |
|
run: |
|
||||||
ls ${{ gitea.workspace }}
|
ls ${{ gitea.workspace }}
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
|
||||||
|
# 步骤8:输出作业状态
|
||||||
|
- run: echo "🍏 此作业的状态是 ${{ job.status }}。"
|
||||||
118
config.yaml
118
config.yaml
@@ -4,107 +4,109 @@
|
|||||||
# just run `./act_runner generate-config > config.yaml` to generate a config file.
|
# just run `./act_runner generate-config > config.yaml` to generate a config file.
|
||||||
|
|
||||||
log:
|
log:
|
||||||
# The level of logging, can be trace, debug, info, warn, error, fatal
|
# 日志级别,可选值:trace, debug, info, warn, error, fatal
|
||||||
level: info
|
level: info
|
||||||
|
|
||||||
runner:
|
runner:
|
||||||
# Where to store the registration result.
|
# 注册结果存储位置
|
||||||
file: .runner
|
file: .runner
|
||||||
# Execute how many tasks concurrently at the same time.
|
# 同时执行的任务并发数
|
||||||
capacity: 1
|
capacity: 1
|
||||||
# Extra environment variables to run jobs.
|
# 运行作业的额外环境变量
|
||||||
envs:
|
envs:
|
||||||
A_TEST_ENV_NAME_1: a_test_env_value_1
|
A_TEST_ENV_NAME_1: a_test_env_value_1
|
||||||
A_TEST_ENV_NAME_2: a_test_env_value_2
|
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
|
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.
|
# 注意:Gitea 实例也有作业超时设置(默认3小时)
|
||||||
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
|
# 如果 Gitea 的超时时间更短,作业可能会被 Gitea 停止
|
||||||
timeout: 3h
|
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
|
shutdown_timeout: 0s
|
||||||
# Whether skip verifying the TLS certificate of the Gitea instance.
|
# 是否跳过验证 Gitea 实例的 TLS 证书
|
||||||
insecure: false
|
insecure: false
|
||||||
# The timeout for fetching the job from the Gitea instance.
|
# 从 Gitea 实例获取作业的超时时间
|
||||||
fetch_timeout: 5s
|
fetch_timeout: 5s
|
||||||
# The interval for fetching the job from the Gitea instance.
|
# 从 Gitea 实例获取作业的间隔时间
|
||||||
fetch_interval: 2s
|
fetch_interval: 2s
|
||||||
# The github_mirror of a runner is used to specify the mirror address of the github that pulls the action repository.
|
# 用于指定拉取 action 仓库的 GitHub 镜像地址
|
||||||
# It works when something like `uses: actions/checkout@v4` is used and DEFAULT_ACTIONS_URL is set to github,
|
# 当使用类似 `uses: actions/checkout@v4` 且 DEFAULT_ACTIONS_URL 设置为 github 时生效
|
||||||
# and github_mirror is not empty. In this case,
|
# 如果 github_mirror 不为空,会将 https://github.com 替换为此处的值
|
||||||
# it replaces https://github.com with the value here, which is useful for some special network environments.
|
# 这对某些特殊网络环境很有用
|
||||||
github_mirror: ''
|
github_mirror: ''
|
||||||
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
|
# runner 的标签用于确定可以运行哪些作业以及如何运行它们
|
||||||
# Like: "macos-arm64:host" or "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
# 例如:"macos-arm64:host" 或 "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 .
|
# 在 https://gitea.com/docker.gitea.com/runner-images 查找 Gitea 提供的更多镜像
|
||||||
# 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.
|
# 执行 `daemon` 时如果为空,将使用 `.runner` 文件中的标签
|
||||||
labels:
|
labels:
|
||||||
- "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
- "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
||||||
- "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
|
- "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
|
||||||
- "ubuntu-20.04:docker://docker.gitea.com/runner-images:ubuntu-20.04"
|
- "ubuntu-20.04:docker://docker.gitea.com/runner-images:ubuntu-20.04"
|
||||||
|
|
||||||
|
|
||||||
|
# 作用:配置 Actions 缓存功能,加速依赖下载和构建过程
|
||||||
cache:
|
cache:
|
||||||
# Enable cache server to use actions/cache.
|
# 启用缓存服务器以使用 actions/cache
|
||||||
enabled: true
|
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: ""
|
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: ""
|
host: ""
|
||||||
# The port of the cache server.
|
# 缓存服务器的端口
|
||||||
# 0 means to use a random available port.
|
# 0 表示使用随机可用端口
|
||||||
port: 0
|
port: 0
|
||||||
# The external cache server URL. Valid only when enable is true.
|
# 外部缓存服务器 URL。仅在 enable 为 true 时有效
|
||||||
# If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
|
# 如果指定,act_runner 将使用此 URL 作为 ACTIONS_CACHE_URL 而不是自行启动服务器
|
||||||
# The URL should generally end with "/".
|
# URL 通常应以 "/" 结尾
|
||||||
external_server: ""
|
external_server: ""
|
||||||
|
|
||||||
container:
|
container:
|
||||||
# Specifies the network to which the container will connect.
|
# 指定容器将连接到的网络
|
||||||
# Could be host, bridge or the name of a custom network.
|
# 可以是 host、bridge 或自定义网络名称
|
||||||
# If it's empty, act_runner will create a network automatically.
|
# 如果为空,act_runner 将自动创建网络
|
||||||
network: ""
|
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
|
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:
|
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.
|
# 注意:不需要在路径开头添加 '/',act_runner 会自动添加
|
||||||
# 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
|
# 例如,如果父目录是 /path/to/my/dir,workdir_parent 应该是 path/to/my/dir
|
||||||
# If it's empty, /workspace will be used.
|
# 如果为空,将使用 /workspace
|
||||||
workdir_parent:
|
workdir_parent:
|
||||||
# Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob
|
# 可以挂载到容器的卷(包括绑定挂载)。支持 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:
|
# 例如,如果只允许容器挂载 `data` 卷和 /src 中的所有 json 文件,配置应为:
|
||||||
# valid_volumes:
|
# valid_volumes:
|
||||||
# - data
|
# - data
|
||||||
# - /src/*.json
|
# - /src/*.json
|
||||||
# If you want to allow any volume, please use the following configuration:
|
# 如果要允许任何卷,请使用以下配置:
|
||||||
# valid_volumes:
|
# valid_volumes:
|
||||||
# - '**'
|
# - '**'
|
||||||
valid_volumes: []
|
valid_volumes: []
|
||||||
# overrides the docker client host with the specified one.
|
# 使用指定的 docker 客户端主机覆盖默认值
|
||||||
# If it's empty, act_runner will find an available docker host automatically.
|
# 如果为空,act_runner 将自动查找可用的 docker 主机
|
||||||
# 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.
|
# 如果是 "-",act_runner 将自动查找可用的 docker 主机,但 docker 主机不会挂载到作业容器和服务容器
|
||||||
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
|
# 如果不为空也不是 "-",将使用指定的 docker 主机。如果不起作用将返回错误
|
||||||
docker_host: ""
|
docker_host: ""
|
||||||
# Pull docker image(s) even if already present
|
# 即使已存在也拉取 docker 镜像
|
||||||
force_pull: true
|
force_pull: true
|
||||||
# Rebuild docker image(s) even if already present
|
# 即使已存在也重新构建 docker 镜像
|
||||||
force_rebuild: false
|
force_rebuild: false
|
||||||
# Always require a reachable docker daemon, even if not required by act_runner
|
# 始终要求可访问的 docker 守护进程,即使 act_runner 不需要
|
||||||
require_docker: false
|
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
|
docker_timeout: 0s
|
||||||
|
|
||||||
host:
|
host:
|
||||||
# The parent directory of a job's working directory.
|
# 作业工作目录的父目录
|
||||||
# If it's empty, $HOME/.cache/act/ will be used.
|
# 如果为空,将使用 $HOME/.cache/act/
|
||||||
workdir_parent:
|
workdir_parent:
|
||||||
Reference in New Issue
Block a user