diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33c863c..f457ae2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/README-CN.md b/README-CN.md index 59771da..fa5655a 100644 --- a/README-CN.md +++ b/README-CN.md @@ -18,7 +18,15 @@ 我们在 GitHub 上创建了一些任务,这些任务难度不高,对于首次贡献者来说比较友好,欢迎感兴趣的开发者认领:https://github.com/oceanbase/ob-samples/issues/16 。 -在一个示例中,请确保包含以下内容 +### 增加一个示例 + +在本仓库中,一个示例将作为一个独立的模块存在,模块的目录名称应当与示例所用的工具保持一致,如 `mysql-connector-java` 的示例目录就命名为 `mysql-connector-java`。 + +在本仓库的根目录内有许多分类目录。对于能够通过简单的命令可以直接运行的示例,我们建议按照工具所需要的编程语言环境来分类,如 `mysql-connector-java` 需要添加到 `java` 目录下。 对于需要比较复杂的配置才能运行的示例,我们建议将示例项目放到 `applications` 目录。 + +#### 简单示例 + +对于编程语言分类下的简单示例,其目录内应当包含以下内容 - 代码文件 - `run.sh` 运行代码的脚本 @@ -26,13 +34,15 @@ 如果您不能提供英文的文档,您可以在文档中使用您的母语,我们会在之后对其进行改进。 -为了确保示例正常工作,请将您的模块添加到 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 流程等由贡献者自行判断添加。 ## 参考信息 diff --git a/README.md b/README.md index ea2419d..48823ff 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,15 @@ 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 @@ -26,13 +34,15 @@ In the module, make sure to include the following files: 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 diff --git a/java/mybatisplus-java/README-CN.md b/java/mybatis-plus/README-CN.md similarity index 98% rename from java/mybatisplus-java/README-CN.md rename to java/mybatis-plus/README-CN.md index 9b17b54..9a49e96 100644 --- a/java/mybatisplus-java/README-CN.md +++ b/java/mybatis-plus/README-CN.md @@ -60,7 +60,7 @@ ``` -以 [MybatisPlusJavaApplicationTests.java](src/test/java/com/oceanbase/samples/mybatisplusjava/MybatisPlusJavaApplicationTests.java) +以 [MybatisPlusJavaApplicationTests.java](src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplicationTests.java) 代码为例。 以下代码不仅实现了`OceanBaseCEContainer`的生命周期管理。 它将在执行任何测试用例之前启动容器实例,并在执行所有测试用例后停止容器,而且还在期间使用 diff --git a/java/mybatisplus-java/README.md b/java/mybatis-plus/README.md similarity index 98% rename from java/mybatisplus-java/README.md rename to java/mybatis-plus/README.md index 5d4b068..66ed880 100644 --- a/java/mybatisplus-java/README.md +++ b/java/mybatis-plus/README.md @@ -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 diff --git a/java/mybatisplus-java/pom.xml b/java/mybatis-plus/pom.xml similarity index 95% rename from java/mybatisplus-java/pom.xml rename to java/mybatis-plus/pom.xml index 9e3998f..0e5494c 100644 --- a/java/mybatisplus-java/pom.xml +++ b/java/mybatis-plus/pom.xml @@ -9,10 +9,10 @@ com.oceanbase.samples - mybatisplus-java + mybatis-plus 0.0.1-SNAPSHOT - mybatisplus-java - mybatisplus-java + mybatis-plus + mybatis-plus com.oceanbase diff --git a/java/mybatisplus-java/run.sh b/java/mybatis-plus/run.sh similarity index 100% rename from java/mybatisplus-java/run.sh rename to java/mybatis-plus/run.sh diff --git a/java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/MybatisPlusJavaApplication.java b/java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplication.java similarity index 86% rename from java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/MybatisPlusJavaApplication.java rename to java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplication.java index bec5721..f556aee 100644 --- a/java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/MybatisPlusJavaApplication.java +++ b/java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplication.java @@ -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; diff --git a/java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/MybatisPlusJavaApplicationTests.java b/java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplicationTests.java similarity index 97% rename from java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/MybatisPlusJavaApplicationTests.java rename to java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplicationTests.java index ac04328..f8b3d0f 100644 --- a/java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/MybatisPlusJavaApplicationTests.java +++ b/java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/MybatisPlusJavaApplicationTests.java @@ -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; diff --git a/java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/Person.java b/java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/Person.java similarity index 72% rename from java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/Person.java rename to java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/Person.java index 0e71880..d287c09 100644 --- a/java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/Person.java +++ b/java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/Person.java @@ -1,4 +1,4 @@ -package com.oceanbase.samples.mybatisplusjava; +package com.oceanbase.samples.mybatisplus; import lombok.Data; diff --git a/java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/PersonMapper.java b/java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/PersonMapper.java similarity index 78% rename from java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/PersonMapper.java rename to java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/PersonMapper.java index 4bc3b26..96621ac 100644 --- a/java/mybatisplus-java/src/test/java/com/oceanbase/samples/mybatisplusjava/PersonMapper.java +++ b/java/mybatis-plus/src/test/java/com/oceanbase/samples/mybatisplus/PersonMapper.java @@ -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; diff --git a/java/mybatisplus-java/src/test/resources/init.sql b/java/mybatis-plus/src/test/resources/init.sql similarity index 100% rename from java/mybatisplus-java/src/test/resources/init.sql rename to java/mybatis-plus/src/test/resources/init.sql