contributing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Contributing to Apache Beam

为Apache Beam贡献代码

Getting Started

入门

Prerequisites

前置要求

  • GitHub account
  • Java JDK 11 (preferred, or 8, 17, 21)
  • Latest Go 1.x
  • Docker
  • Python (any supported version for manual testing, all versions for running test suites)
  • For large contributions: signed ICLA to Apache Software Foundation
  • GitHub账号
  • Java JDK 11(推荐,也可使用8、17、21版本)
  • 最新的Go 1.x版本
  • Docker
  • Python(手动测试可使用任意支持版本,运行测试套件需安装所有支持版本)
  • 大型贡献需要签署Apache软件基金会的ICLA

Environment Setup Options

环境设置选项

Local Setup (automated)

本地搭建(自动化)

bash
./local-env-setup.sh
bash
./local-env-setup.sh

Docker-based Setup

基于Docker搭建

bash
./start-build-env.sh
bash
./start-build-env.sh

Contribution Workflow

贡献工作流

1. Find or Create an Issue

1. 查找或创建Issue

2. Claim the Issue

2. 认领Issue

.take-issue    # Assigns issue to you
.free-issue    # Unassigns issue from you
.close-issue   # Closes the issue
.take-issue    # 将Issue分配给你
.free-issue    # 取消你对Issue的认领
.close-issue   # 关闭Issue

3. For Large Changes

3. 大型变更处理

4. Make Your Changes

4. 进行代码修改

  • Every source file needs Apache license header
  • New dependencies must have Apache-compatible open source licenses
  • Add unit tests for your changes
  • Use descriptive commit messages
  • 每个源文件都需要添加Apache许可证头
  • 新依赖必须使用与Apache兼容的开源许可证
  • 为你的修改添加单元测试
  • 使用表意清晰的提交信息

5. Create Pull Request

5. 创建Pull Request

  • Link to the issue in PR description
  • Pre-commit tests run automatically
  • If tests fail unrelated to your change, comment:
    retest this please
  • 在PR描述中关联对应的Issue
  • 预提交测试会自动运行
  • 如果测试失败与你的修改无关,可评论:
    retest this please

6. Code Review

6. 代码审查

  • Reviewers are auto-assigned within a few hours
  • Use
    R: @username
    to request specific reviewer
  • No response in 3 days? Email dev@beam.apache.org
  • 几小时内会自动分配审查者
  • 使用
    R: @username
    来指定特定审查者
  • 如果3天内没有回应,可发送邮件到dev@beam.apache.org

Code Review Best Practices

代码审查最佳实践

For Authors

作者需注意

  • Provide context in issue and PR description
  • Avoid huge mega-changes
  • Add follow-up changes as "fixup" commits (don't squash until approved)
  • Squash fixup commits after approval
  • 在Issue和PR描述中提供上下文信息
  • 避免提交巨型变更
  • 后续修改以"fixup"提交的形式添加(批准前不要压缩提交)
  • 获得批准后再压缩fixup提交

For Reviewers

审查者需注意

Testing Workflows

测试工作流

Pre-commit Tests

预提交测试

Run automatically on PRs. To run locally:
bash
./gradlew javaPreCommit      # Java
./gradlew :sdks:python:test  # Python
./gradlew :sdks:go:test      # Go
PR提交后会自动运行。本地运行命令:
bash
./gradlew javaPreCommit      # Java
./gradlew :sdks:python:test  # Python
./gradlew :sdks:go:test      # Go

Post-commit Tests

提交后测试

Run after merge. Trigger phrases in PR comments start specific test suites. See trigger phrase catalog.
代码合并后运行。在PR评论中输入触发短语可启动特定测试套件,参考触发短语目录

Formatting

代码格式化

Java

Java

bash
./gradlew spotlessApply
bash
./gradlew spotlessApply

Python

Python

bash
undefined
bash
undefined

Uses yapf, isort, pylint

使用yapf、isort、pylint

pre-commit run --all-files
undefined
pre-commit run --all-files
undefined

CHANGES.md

CHANGES.md

bash
./gradlew formatChanges
bash
./gradlew formatChanges

Release Cycle

发布周期

  • Minor releases every 6 weeks
  • Check release calendar
  • Changes must be in master before release branch is cut
  • 每6周发布一个小版本
  • 查看发布日历
  • 变更必须在发布分支切出前合入master分支

Stale PRs

陈旧PR

  • PRs become stale after 60 days of author inactivity
  • Community will close stale PRs
  • Authors can reopen closed PRs
  • 作者超过60天无活动的PR会被标记为陈旧
  • 社区会关闭陈旧PR
  • 作者可以重新打开已关闭的PR

Key Resources

核心资源

Communication

沟通渠道