Skip to content

Commit

Permalink
chore: update contribution guide && modify mybatis-plus module structure
Browse files Browse the repository at this point in the history
  • Loading branch information
whhe committed May 11, 2024
1 parent 4b60b87 commit 4d61e00
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: 'mysql-connector-python'
language: 'python'
with_oceanbase_container: true
- name: 'mybatisplus-java'
- name: 'mybatis-plus'
language: 'java'
with_oceanbase_container: false
uses: ./.github/workflows/basic-ci.yml
Expand Down
16 changes: 13 additions & 3 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,31 @@

我们在 GitHub 上创建了一些任务,这些任务难度不高,对于首次贡献者来说比较友好,欢迎感兴趣的开发者认领:https://github.com/oceanbase/ob-samples/issues/16

在一个示例中,请确保包含以下内容
### 增加一个示例

在本仓库中,一个示例将作为一个独立的模块存在,模块的目录名称应当与示例所用的工具保持一致,如 `mysql-connector-java` 的示例目录就命名为 `mysql-connector-java`

在本仓库的根目录内有许多分类目录。对于能够通过简单的命令可以直接运行的示例,我们建议按照工具所需要的编程语言环境来分类,如 `mysql-connector-java` 需要添加到 `java` 目录下。 对于需要比较复杂的配置才能运行的示例,我们建议将示例项目放到 `applications` 目录。

#### 简单示例

对于编程语言分类下的简单示例,其目录内应当包含以下内容

- 代码文件
- `run.sh` 运行代码的脚本
- `README.md` 组件用法的介绍文档

如果您不能提供英文的文档,您可以在文档中使用您的母语,我们会在之后对其进行改进。

为了确保示例正常工作,请将您的模块添加到 GitHub CI 工作流程。
为了确保示例能够在 GitHub Action 中运行,您的模块添加到 GitHub CI 工作流程。本项目对简单示例提供了一套标准化的运行流程,详情请参阅 [basic-ci.yml](./.github/workflows/basic-ci.yml)。您只需要添加以下内容,将您贡献的模块增加到 [ci.yml](./.github/workflows/ci.yml) 中的 basic job 中即可:

- `module.name`:新模块的名称,应与模块目录名称相同。
- `module.language`:编程语言,应与项目根目录下的目录名称相同。
- `module.with_oceanbase_container`:是否使用预先部署的 OceanBase 容器,可选,默认设置为 true。如果它是 true,您可以在 localhost 上使用用户名 `root@sys``root@test` 以及空密码连接到它。

有关 CI 工作流程的更多详细信息,请参阅 [ci.yml](./.github/workflows/ci.yml)
#### 复杂示例

对于需要放到 applications 目录下的复杂示例,其目录内同样需要包含 `README.md` 文档,除此之外,其项目文件、ci 流程等由贡献者自行判断添加。

## 参考信息

Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,31 @@ We welcome contributions from anyone, thanks to all [contributors](https://githu

We have created some issues on GitHub for some samples which are simple and good for first time contributors: https://github.com/oceanbase/ob-samples/issues/16.

In the module, make sure to include the following files:
### Add a sample

In this repository, every sample project will be as an independent module. The directory name of the module should be same with the tool used in the sample. For example, the sample of `mysql-connector-java` is named `mysql-connector-java`.

There are many category directories in the root directory of this repository. For samples that can be run directly through simple commands, we recommend add them to the directory which corresponding to the programming language environment required by the sample. For example, `mysql-connector-java` needs to be added to the `java` directory. For samples that require more complex configuration to run, we recommend placing the sample project in the `applications` directory.

#### Simple samples

For a simple sample under the programming language category, the directory should contain the following content

- code files
- `run.sh` script to run code
- `README.md` documentation for component usage.

If it's hard to use English for you, you can use your native language in the documentation, and we can improve it later.

To ensure the sample works, please add your module to the GitHub CI workflow.
To ensure that the sample works, please add your module to the GitHub CI workflow. This project provides a standardized workflow for simple samples. For details, please refer to [basic-ci.yml](./.github/workflows/basic-ci.yml). You only need to add the following options to add your module to the `basic` job in [ci.yml](./.github/workflows/ci.yml):

- `module.name`: the name of new module, should be same with the module directory name.
- `module.language`: the programming language, should be same with the directory name under project root.
- `module.with_oceanbase_container`: whether to use a pre-deployed OceanBase container, optional, set 'true' by default. If it's 'true', you can connect to it using username 'root@sys' or 'root@test' with empty password at localhost.

See [ci.yml](./.github/workflows/ci.yml) for more details about CI workflow.
#### Complex samples

For complex samples that need to be placed in the applications directory, the directory also needs to contain the `README.md` document. In addition, its project files, ci workflow, etc. will be added by yourself.

## References

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</dependencies>
```

[MybatisPlusJavaApplicationTests.java](src/test/java/com/oceanbase/samples/mybatisplusjava/MybatisPlusJavaApplicationTests.java)
[MybatisPlusJavaApplicationTests.java](src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplicationTests.java)
代码为例。

以下代码不仅实现了`OceanBaseCEContainer`的生命周期管理。 它将在执行任何测试用例之前启动容器实例,并在执行所有测试用例后停止容器,而且还在期间使用
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Add the OceanBase driver, TestContainers OceanBase, MybatisPlusStarter, and Spri
```

Take the code
in [MybatisPlusJavaApplicationTests.java](src/test/java/com/oceanbase/samples/mybatisplusjava/MybatisPlusJavaApplicationTests.java)
in [MybatisPlusJavaApplicationTests.java](src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplicationTests.java)
as an example.

The following code not only implements lifecycle management for the `OceanBaseCEContainer`. It will start the container
Expand Down
6 changes: 3 additions & 3 deletions java/mybatisplus-java/pom.xml → java/mybatis-plus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<relativePath/>
</parent>
<groupId>com.oceanbase.samples</groupId>
<artifactId>mybatisplus-java</artifactId>
<artifactId>mybatis-plus</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mybatisplus-java</name>
<description>mybatisplus-java</description>
<name>mybatis-plus</name>
<description>mybatis-plus</description>
<dependencies>
<dependency>
<groupId>com.oceanbase</groupId>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.oceanbase.samples.mybatisplusjava;
package com.oceanbase.samples.mybatisplus;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.oceanbase.samples.mybatisplusjava;
package com.oceanbase.samples.mybatisplus;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.oceanbase.samples.mybatisplusjava;
package com.oceanbase.samples.mybatisplus;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.oceanbase.samples.mybatisplusjava;
package com.oceanbase.samples.mybatisplus;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
Expand Down

0 comments on commit 4d61e00

Please sign in to comment.