agentic_huge_data_base / wiki
页面 Argilla · 5.3 持续集成与持续交付管线·DeepWiki 中文全文译文

5.3 · 持续集成与持续交付管线(CI/CD Pipelines)

人工复核与反馈数据 · 本章是 Argilla DeepWiki 中文译文的独立章节页,保留原始链接、源码锚点、模块标签和章节层级。

项目Argilla 章节5.3 状态全文译文 模块测试、发布与运维、安装与启动、界面与交互、接口与服务契约
源码线索
  • .dockerignore
  • .github/workflows/argilla-frontend.build-push-dev-frontend-docker.yml
  • .github/workflows/argilla-frontend.deploy-environment.yml
  • .github/workflows/argilla-frontend.yml
  • .github/workflows/argilla-server.yml
  • .github/workflows/argilla-v1.yml
  • .github/workflows/argilla.docs.yml
  • .github/workflows/argilla.yml
  • .github/workflows/close-inactive-issues-bot.yml
  • docs/_source/_common/tabs/argilla_install_python.md
模块标签
  • 测试、发布与运维
  • 安装与启动
  • 界面与交互
  • 接口与服务契约
  • 工作流与编排

中文译文

持续集成与持续交付管线(中文译文)

原始 DeepWiki 页面:https://deepwiki.com/argilla-io/argilla/5.3-ci-cd-pipelines
翻译时间:2026-05-27T08:44:39.515Z
翻译模型:deepseek-chat
原文字符数:19469
项目:Argilla (argilla)

---

持续集成与持续交付管线

相关源文件

以下文件被用作生成此 Wiki 页面的上下文:

  • .dockerignore
  • .github/workflows/argilla-frontend.build-push-dev-frontend-docker.yml
  • .github/workflows/argilla-frontend.deploy-environment.yml
  • .github/workflows/argilla-frontend.yml
  • .github/workflows/argilla-server.yml
  • .github/workflows/argilla-v1.yml
  • .github/workflows/argilla.docs.yml
  • .github/workflows/argilla.yml
  • .github/workflows/close-inactive-issues-bot.yml
  • docs/_source/_common/tabs/argilla_install_python.md
  • docs/_source/community/contributing.md
  • docs/_source/community/developer_docs.md
  • docs/_source/community/migration-rubrix.md
  • docs/_source/getting_started/installation/deployments/docker.md
  • docs/_source/getting_started/installation/deployments/docker_compose.md
  • docs/_source/getting_started/installation/deployments/python.md
  • docs/_source/reference/cli.md
  • docs/_source/reference/notebooks.rst
  • docs/migration-rubrix.md
  • docs/template.ipynb

本文档记录了 Argilla 项目中使用的持续集成和持续部署(CI/CD)管线。它解释了自动化工作流如何构建、测试和部署 Argilla 的各个组件。有关设置开发环境的信息,请参阅开发环境搭建;有关贡献代码的详细信息,请参阅贡献工作流

概述

Argilla 使用 GitHub Actions 实现其 CI/CD 管线。这些管线自动化了各个组件的构建、测试和部署过程,确保代码质量并简化发布流程。Argilla 的每个组件(SDK、服务器、前端和文档)都有自己专用的管线,具有特定的触发条件、步骤和部署目标。

flowchart TD
    subgraph "代码变更"
        PR["拉取请求"]
        Push["推送到 main/develop/\nreleases 分支"]
        Manual["手动工作流\n调度"]
    end

    subgraph "CI 触发条件"
        PR --> |"argilla/**\n变更"| SDK_CI["SDK CI 管线"]
        PR --> |"argilla-server/**\n变更"| Server_CI["服务器 CI 管线"]
        PR --> |"argilla-frontend/**\n变更"| Frontend_CI["前端 CI 管线"]
        PR --> |"argilla-v1/**\n变更"| V1_CI["v1 API CI 管线"]
        PR --> |"docs/**\n变更"| Docs_CI["文档 CI 管线"]

        Push --> SDK_CI
        Push --> Server_CI
        Push --> V1_CI
        Push --> Docs_CI

        Manual --> SDK_CI
        Manual --> Server_CI
        Manual --> V1_CI
        Manual --> Docs_CI
    end

    subgraph "CI 步骤"
        SDK_CI --> SDK_Tests["运行测试"]
        SDK_Tests --> SDK_Build["构建包"]

        Server_CI --> Server_Tests["运行测试"]
        Server_Tests --> Server_Build["构建包"]
        Server_Build --> Docker_Build["构建 Docker 镜像"]

        Frontend_CI --> Frontend_Lint["运行 Lint"]
        Frontend_Lint --> Frontend_Tests["运行测试"]
        Frontend_Tests --> Frontend_Build["构建包"]
        Frontend_Build --> Frontend_Docker["构建开发 Docker 镜像"]
        Frontend_Docker --> Frontend_Deploy["部署 PR 环境"]

        V1_CI --> V1_Tests["运行测试"]
        V1_Tests --> V1_Build["构建包"]

        Docs_CI --> Docs_Build["构建文档"]
    end

    subgraph "CD 目标"
        SDK_Build --> |"仅 main 分支"| PyPI_SDK["PyPI - argilla"]
        Server_Build --> |"仅 main 分支"| PyPI_Server["PyPI - argilla-server"]
        Server_Build --> |"main/develop/releases"| DockerHub["Docker Hub"]
        V1_Build --> |"仅 main 分支"| PyPI_V1["PyPI - argilla-v1"]
        Docs_Build --> GH_Pages["GitHub Pages"]
    end

来源:.github/workflows/argilla.yml, .github/workflows/argilla-server.yml, .github/workflows/argilla-frontend.yml, .github/workflows/argilla-v1.yml, .github/workflows/argilla.docs.yml

管线组件

Argilla 的 CI/CD 系统由几个关键管线组成,每个管线处理代码库中的一个特定组件。

组件矩阵

下表显示了 Argilla 的主要组件及其对应的 CI/CD 管线:

组件工作流文件路径包名触发条件
Python SDKargilla.ymlargilla/argillaPR (argilla/**), Push (main/develop/releases)
服务器argilla-server.ymlargilla-server/argilla-serverPR (argilla-server/**), Push (main/develop/releases)
前端argilla-frontend.ymlargilla-frontend/不适用(内置于服务器)PR (argilla-frontend/**)
旧版 v1 APIargilla-v1.ymlargilla-v1/argilla-v1PR (argilla-v1/**), Push (main/develop/releases)
文档argilla.docs.ymldocs/不适用Push (main/develop/docs/**), 标签

来源:.github/workflows/argilla.yml, .github/workflows/argilla-server.yml, .github/workflows/argilla-frontend.yml, .github/workflows/argilla-v1.yml, .github/workflows/argilla.docs.yml

测试策略

Argilla 在各个组件中实施了全面的测试:

flowchart LR
    subgraph "测试策略"
        direction TB
        UnitTests["单元测试"]
        IntegrationTests["集成测试"]
        Linting["Lint 检查"]
        MatrixTesting["矩阵测试\n(多个 Python 版本)"]
    end

    subgraph "组件"
        SDK["Python SDK"]
        Server["Argilla 服务器"]
        Frontend["Vue.js 前端"]
        V1["旧版 v1 API"]
    end

    SDK --> UnitTests
    SDK --> IntegrationTests
    SDK --> MatrixTesting

    Server --> UnitTests

    Frontend --> UnitTests
    Frontend --> Linting

    V1 --> UnitTests

来源:.github/workflows/argilla.yml:63-68, .github/workflows/argilla-server.yml:84-91, .github/workflows/argilla-frontend.yml:40-46, .github/workflows/argilla-v1.yml:69-82

Python SDK 管线

Python SDK 管线(argilla.yml)处理核心的 Argilla 客户端库。

构建流程
flowchart TD
    Checkout["actions/checkout@v4"] --> Setup["设置 PDM 和 Python\n矩阵:3.9-3.13"]
    Setup --> InstallDeps["安装依赖"]
    InstallDeps --> WaitServer["等待 Argilla 服务器"]
    WaitServer --> SetHFCreds["设置 Hugging Face 凭证"]
    SetHFCreds --> RunUnitTests["运行单元测试"]
    RunUnitTests --> RunIntegrationTests["运行集成测试"]
    RunIntegrationTests --> BuildPackage["使用 PDM 构建包"]
    BuildPackage --> UploadArtifact["上传制品"]
    UploadArtifact --> |"如果在 main 分支上"| PublishRelease["发布 Release 任务"]
    PublishRelease --> DownloadArtifact["下载制品"]
    DownloadArtifact --> PublishTestPyPI["发布到 TestPyPI"]
    PublishTestPyPI --> TestInstall["测试安装"]
    TestInstall --> |"如果是 main 分支"| PublishPyPI["发布到 PyPI"]

来源:.github/workflows/argilla.yml:23-137

关键特性
  1. 矩阵测试:在 Python 3.9、3.10、3.11、3.12 和 3.13 版本上进行测试
  2. 依赖管理:使用 PDM(Python 依赖管理器)实现一致的依赖管理
  3. 集成测试:使用正在运行的 Argilla 服务器服务进行集成测试
  4. 制品处理:构建并上传 Python 包,供发布任务使用
  5. 可信发布:使用 OIDC(OpenID Connect)实现安全的 PyPI 发布

服务器管线

Argilla 服务器管线(argilla-server.yml)构建并发布服务器组件。

构建和部署流程
flowchart TD
    CheckoutCode["检出代码"] --> SetupPDM["设置 PDM"]
    SetupPDM --> InstallDeps["安装依赖"]
    InstallDeps --> RunTests["运行测试\n(PostgreSQL + Elasticsearch)"]
    RunTests --> UploadCoverage["上传测试覆盖率"]
    UploadCoverage --> SetupNode["设置 Node.js"]
    SetupNode --> InstallFrontendDeps["安装前端依赖"]
    InstallFrontendDeps --> BuildFrontend["构建前端"]
    BuildFrontend --> CopyFrontend["将前端复制到服务器静态文件"]
    CopyFrontend --> BuildPackage["构建服务器包"]
    BuildPackage --> UploadArtifact["上传服务器制品"]

    UploadArtifact --> BuildDockerImages["构建 Docker 镜像任务"]
    UploadArtifact --> |"如果是 main 分支"| PublishRelease["发布 Release 任务"]

    BuildDockerImages --> |"镜像推送到 Docker Hub"| DockerHub["Docker Hub\nargilladev/argilla"]

    PublishRelease --> DownloadArtifact["下载制品"]
    DownloadArtifact --> PublishTestPyPI["发布到 TestPyPI"]
    PublishTestPyPI --> TestInstall["测试安装"]
    TestInstall --> |"如果是 main 分支"| PublishPyPI["发布到 PyPI"]

来源:.github/workflows/argilla-server.yml:24-202

关键特性
  1. 服务依赖:使用 Elasticsearch、PostgreSQL 和 Redis 服务进行测试
  2. 前端集成:构建前端并将其打包到服务器中
  3. Docker 镜像构建:创建并发布 Docker 镜像,便于部署
  4. 覆盖率报告:将测试覆盖率结果上传到 Codecov
  5. PyPI 发布:将服务器包发布到 PyPI,可通过 pip 安装

前端管线

前端管线(argilla-frontend.yml)处理 Vue.js/Nuxt 前端组件。

构建和部署流程
flowchart TD
    CheckoutCode["检出代码"] --> SetupNode["设置 Node.js v20"]
    SetupNode --> InstallDeps["安装 npm 依赖"]
    InstallDeps --> RunLint["运行 Lint"]
    RunLint --> RunTests["运行测试"]
    RunTests --> BuildPackage["构建前端包"]
    BuildPackage --> UploadArtifact["上传前端静态制品"]

    UploadArtifact --> |"如果 PR 不是草稿"| BuildDevDockerImage["构建开发 Docker 镜像任务"]
    BuildDevDockerImage --> |"如果成功"| DeployPR["部署 PR 环境任务"]

    DeployPR --> DeployCloudRun["部署到 Google Cloud Run"]
    DeployCloudRun --> PostCredentials["在 Slack 中发布凭证"]
    DeployCloudRun --> CommentPR["在 PR 中评论部署 URL"]

来源:.github/workflows/argilla-frontend.yml:19-86, .github/workflows/argilla-frontend.build-push-dev-frontend-docker.yml:40-117, .github/workflows/argilla-frontend.deploy-environment.yml:23-87

关键特性
  1. 质量检查:运行 Lint 和测试以确保代码质量
  2. PR 环境:为拉取请求构建和部署预览环境
  3. Docker 集成:创建开发 Docker 镜像用于测试
  4. 云部署:部署到 Google Cloud Run 用于 PR 预览
  5. PR 反馈:自动在 PR 中评论部署 URL

文档管线

文档管线(argilla.docs.yml)处理 Argilla 文档的构建和发布。

构建和部署流程
flowchart TD
    CheckoutGhPages["检出 gh-pages 分支"] --> CheckoutCode["检出代码"]
    CheckoutCode --> SetupPython["设置 Python"]
    SetupPython --> InstallDeps["安装依赖"]
    InstallDeps --> SetGitCreds["设置 git 凭证"]
    SetGitCreds --> CheckBranch{"检查分支/标签"}

    CheckBranch --> |"main 分支"| DeployLatest["部署为 'latest'"]
    CheckBranch --> |"develop 分支"| DeployDev["部署为 'dev'"]
    CheckBranch --> |"标签 v2+.x.x"| DeployVersion["部署为版本 x.y"]
    CheckBranch --> |"docs/* 分支"| DeployDocs["部署为隐藏分支文档"]

    DeployDev --> |"文档更新\n可在 docs.argilla.io 访问"| DocsWebsite["文档网站"]
    DeployLatest --> |"设置为默认"| DocsWebsite
    DeployVersion --> DocsWebsite
    DeployDocs --> |"对版本管理隐藏"| DocsWebsite

    DeployDocs --> AddPRComment["在 PR 中添加部署消息"]

来源:.github/workflows/argilla.docs.yml:26-109

关键特性
  1. 版本化文档:使用 mike 部署版本化文档
  2. 分支特定部署:根据分支或标签设置不同的部署目标
  3. 默认版本:将最新版本设置为默认版本
  4. PR 预览:为 PR 分支创建隐藏的文档版本
  5. PR 反馈:在 PR 中添加包含文档预览链接的评论

旧版 v1 API 管线

旧版 v1 API 管线(argilla-v1.yml)处理 v1 API 的兼容层。

构建流程
flowchart TD
    CheckoutCode["检出代码"] --> SetupConda["设置 Conda 环境"]
    SetupConda --> CacheConda["缓存 Conda 环境"]
    CacheConda --> UpdateEnv["更新环境"]
    UpdateEnv --> CachePip["缓存 pip"]
    CachePip --> SetHFCreds["设置 Hugging Face 凭证"]
    SetHFCreds --> RunUnitTests["运行单元测试"]
    RunUnitTests --> RunPandasV2Tests["使用 pandas v2 运行测试"]
    RunPandasV2Tests --> RunPydanticV2Tests["使用 pydantic v2 运行测试"]
    RunPydanticV2Tests --> BuildPackage["构建包"]
    BuildPackage --> UploadArtifact["上传包制品"]

    UploadArtifact --> |"如果是 main 分支"| PublishRelease["发布 Release 任务"]
    PublishRelease --> DownloadArtifact["下载制品"]
    DownloadArtifact --> ReadPackageInfo["读取包信息"]
    ReadPackageInfo --> PublishTestPyPI["发布到 TestPyPI"]
    PublishTestPyPI --> TestInstall["测试安装"]
    TestInstall --> |"如果是 main 分支"| PublishPyPI["发布到 PyPI"]

来源:.github/workflows/argilla-v1.yml:20-146

关键特性
  1. Conda 环境:使用 conda 进行环境管理
  2. 兼容性测试:使用较新版本的 pandas 和 pydantic 进行测试
  3. 缓存:对 conda 环境和 pip 依赖实现缓存
  4. PyPI 发布:将包发布到 PyPI,可通过 pip 安装

部署目标和制品

Argilla 的 CI/CD 管线发布到多个部署目标,使软件可以通过不同的分发渠道获取。

flowchart TD
    subgraph "CI/CD 管线"
        SDKBuild["SDK 构建任务"]
        ServerBuild["服务器构建任务"]
        DockerBuild["Docker 构建任务"]
        V1Build["v1 API 构建任务"]
        DocsBuild["文档构建任务"]
    end

    subgraph "制品"
        SDKPackage["argilla-*.whl"]
        ServerPackage["argilla-server-*.whl"]
        DockerImage["Docker 镜像"]
        V1Package["argilla-v1-*.whl"]
        DocsContent["文档页面"]
    end

    subgraph "部署目标"
        PyPI["PyPI 仓库\n- argilla\n- argilla-server\n- argilla-v1"]
        DockerHub["Docker Hub\nargilladev/argilla-server"]
        GHPages["GitHub Pages\ndocs.argilla.io"]
        GCR["Google Cloud Run\n(PR 环境)"]
    end

    SDKBuild --> SDKPackage
    ServerBuild --> ServerPackage
    DockerBuild --> DockerImage
    V1Build --> V1Package
    DocsBuild --> DocsContent

    SDKPackage --> PyPI
    ServerPackage --> PyPI
    V1Package --> PyPI
    DockerImage --> DockerHub
    DockerImage --> GCR
    DocsContent --> GHPages

来源:.github/workflows/argilla.yml:79-137, .github/workflows/argilla-server.yml:116-202, .github/workflows/argilla-v1.yml:84-146, .github/workflows/argilla.docs.yml:62-108

包发布策略

下表描述了不同制品的发布策略:

组件制品目标条件
Python SDKargilla-*.whlTestPyPImain 分支或工作流调度
Python SDKargilla-*.whlPyPI仅 main 分支
服务器argilla-server-*.whlTestPyPImain 分支或工作流调度
服务器argilla-server-*.whlPyPI仅 main 分支
服务器Docker 镜像Docker Hubmain、develop、releases 分支
前端开发 Docker 镜像Google Cloud RunPR 环境
v1 APIargilla-v1-*.whlTestPyPImain 分支或工作流调度
v1 APIargilla-v1-*.whlPyPI仅 main 分支
文档HTML 文件GitHub Pages基于分支/标签

来源:.github/workflows/argilla.yml:125-137, .github/workflows/argilla-server.yml:189-202, .github/workflows/argilla-v1.yml:133-146, .github/workflows/argilla.docs.yml:62-101

贡献和开发工作流

CI/CD 管线与 Argilla 的贡献工作流集成,以确保代码质量并简化发布流程。

flowchart LR
    Fork["Fork 仓库"] --> Clone["克隆 Fork"]
    Clone --> CreateBranch["创建功能/修复/文档分支"]
    CreateBranch --> Develop["进行更改"]
    Develop --> Test["运行本地测试"]
    Test --> CommitPush["提交并推送"]
    CommitPush --> CreatePR["创建拉取请求"]
    CreatePR --> CIRuns["运行 CI 管线"]
    CIRuns --> PRReview["PR 评审"]
    PRReview --> |"批准"| Merge["合并到 develop/main"]
    Merge --> |"触发 CD"| Deployment["自动部署\n到适当的目标"]

来源:docs/_source/community/contributing.md:36-212

拉取请求工作流

当你向 Argilla 提交拉取请求时:

  1. GitHub Actions 会根据修改的文件自动运行相应的 CI 管线
  2. 对于前端更改,会部署一个预览环境
  3. 测试结果和状态检查会报告回 PR
  4. 维护者评审更改,并可能要求修改
  5. 批准并合并后,CD 管线会将更改部署到适当的目标
分支策略
分支类型命名约定基础分支目的
功能feature/...develop新功能
错误修复bug/...develop修复问题
文档docs/...main更新文档
发布releases/...develop准备发布

来源:docs/_source/community/contributing.md:94-108

总结

Argilla 的 CI/CD 管线自动化了平台各个组件的构建、测试和部署过程。这些管线确保了代码质量,为贡献者提供快速反馈,并简化了发布流程。通过理解这些管线,开发者可以更有效地为 Argilla 项目做出贡献,并了解他们的更改是如何被测试和部署的。

有关贡献 Argilla 的更多信息,请参阅贡献工作流;有关设置开发环境的信息,请参阅开发环境搭建