You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/12/30 02:57:47 UTC
[iotdb] 01/02: Enable cpp client IT with github action
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch enable_cpp_client_test
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit be0a4557b31413b957c3ccc92e7a296a3189d610
Author: HTHou <hh...@outlook.com>
AuthorDate: Fri Dec 30 10:56:29 2022 +0800
Enable cpp client IT with github action
---
.github/workflows/client-cpp.yml | 9 +-
client-cpp/pom.xml | 255 +++++++++++++++++++++++++++++++++++----
2 files changed, 239 insertions(+), 25 deletions(-)
diff --git a/.github/workflows/client-cpp.yml b/.github/workflows/client-cpp.yml
index fdb510a6ce..831f1b9631 100644
--- a/.github/workflows/client-cpp.yml
+++ b/.github/workflows/client-cpp.yml
@@ -62,8 +62,10 @@ jobs:
path: ~/.m2
key: client-${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-
+ - name: Build IoTDB server
+ run: mvn clean package -pl distribution -am -DskipTests
- name: Test with Maven
- run: mvn -B clean integration-test -P compile-cpp -Dtsfile.test.skip=true -Djdbc.test.skip=true -Diotdb.test.skip=true -Dconsensus.test.skip=true -Dcommons.test.skip=true -Dtest.port.closed=true -pl server,client-cpp -am
+ run: mvn clean package -pl client-cpp -am -P cppTest -P compile-cpp
build-win:
strategy:
@@ -101,6 +103,9 @@ jobs:
- name: Add Flex and Bison Path and OpenSSL
shell: bash
run: cd /d/a/cpp && unzip win_flex_bison.zip && mv win_flex.exe flex.exe && mv win_bison.exe bison.exe && echo 'export PATH=/d/a/cpp:$PATH' >> ~/.bash_profile && source ~/.bash_profile
+ - name: Build IoTDB server
+ shell: bash
+ run: source ~/.bash_profile && mvn clean package -pl distribution -am -DskipTests
- name: Test with Maven
shell: bash
- run: source ~/.bash_profile && mvn -B clean integration-test -P compile-cpp -Dboost.include.dir=/c/local/boost_1_78_0 -Dboost.library.dir=/c/local/boost_1_78_0/stage/lib -Dtsfile.test.skip=true -Djdbc.test.skip=true -Diotdb.test.skip=true -Dconsensus.test.skip=true -Dcommons.test.skip=true -Dtest.port.closed=true -Denforcer.skip=true -pl server,client-cpp -am -Dcmake.url="https://github.com/Kitware/CMake/releases/download/v3.21.6/cmake-3.21.6-windows-x86_64.zip" -Dcmake.root.dir= [...]
+ run: source ~/.bash_profile && mvn clean package -pl client-cpp -am -P cppTest -P compile-cpp -Dboost.include.dir=/c/local/boost_1_78_0 -Dboost.library.dir=/c/local/boost_1_78_0/stage/lib -Dcmake.url="https://github.com/Kitware/CMake/releases/download/v3.21.6/cmake-3.21.6-windows-x86_64.zip" -Dcmake.root.dir=/D/a/iotdb/iotdb/compile-tools/thrift/target/cmake-3.21.6-windows-x86_64/ -Dcmake.generator="Visual Studio 17 2022"
diff --git a/client-cpp/pom.xml b/client-cpp/pom.xml
index 460f414ea7..caf120be50 100644
--- a/client-cpp/pom.xml
+++ b/client-cpp/pom.xml
@@ -41,6 +41,9 @@
<cmake.build.type>Release</cmake.build.type>
<catch2.url>https://github.com/catchorg/Catch2/releases/download/v2.13.0/catch.hpp</catch2.url>
</properties>
+ <modules>
+ <module>../example/client-cpp-example</module>
+ </modules>
<dependencies>
<dependency>
<groupId>org.apache.iotdb</groupId>
@@ -67,27 +70,29 @@
<cmake.generator>Unix Makefiles</cmake.generator>
<cmake.root.dir>${project.parent.basedir}/compile-tools/thrift/target/cmake-${cmake-version}-Linux-x86_64/</cmake.root.dir>
<thrift.exec.absolute.path>${project.parent.basedir}/compile-tools/thrift/target/build/compiler/cpp/bin/thrift</thrift.exec.absolute.path>
- <iotdb.server.script>start-server.sh</iotdb.server.script>
- </properties>
- </profile>
- <profile>
- <id>os-unix-arm</id>
- <activation>
- <os>
- <family>unix</family>
- <arch>aarch64</arch>
- </os>
- </activation>
- <properties>
- <os.suffix>linux</os.suffix>
- <os.classifier>linux-arm_32</os.classifier>
- <!-- use Makefile as default cmake generator, users may specify other generators -->
- <cmake.generator>Unix Makefiles</cmake.generator>
- <cmake.root.dir>${project.parent.basedir}/compile-tools/thrift/target/cmake-3.21.2-linux-aarch64/</cmake.root.dir>
- <thrift.exec.absolute.path>${project.parent.basedir}/compile-tools/thrift/target/build/compiler/cpp/bin/thrift</thrift.exec.absolute.path>
- <iotdb.server.script>start-server.sh</iotdb.server.script>
+ <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+ <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
</properties>
</profile>
+ <!-- <profile>-->
+ <!-- <id>os-unix-arm</id>-->
+ <!-- <activation>-->
+ <!-- <os>-->
+ <!-- <family>unix</family>-->
+ <!-- <arch>aarch64</arch>-->
+ <!-- </os>-->
+ <!-- </activation>-->
+ <!-- <properties>-->
+ <!-- <os.suffix>linux</os.suffix>-->
+ <!-- <os.classifier>linux-arm_32</os.classifier>-->
+ <!-- <!– use Makefile as default cmake generator, users may specify other generators –>-->
+ <!-- <cmake.generator>Unix Makefiles</cmake.generator>-->
+ <!-- <cmake.root.dir>${project.parent.basedir}/compile-tools/thrift/target/cmake-3.21.2-linux-aarch64/</cmake.root.dir>-->
+ <!-- <thrift.exec.absolute.path>${project.parent.basedir}/compile-tools/thrift/target/build/compiler/cpp/bin/thrift</thrift.exec.absolute.path>-->
+ <!-- <iotdb.start.script>start-standalone.sh</iotdb.start.script>-->
+ <!-- <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>-->
+ <!-- </properties>-->
+ <!-- </profile>-->
<profile>
<id>os-mac</id>
<activation>
@@ -101,7 +106,8 @@
<cmake.generator>Unix Makefiles</cmake.generator>
<cmake.root.dir>${project.parent.basedir}/compile-tools/thrift/target/cmake-${cmake-version}-Darwin-x86_64/CMake.app/Contents</cmake.root.dir>
<thrift.exec.absolute.path>${project.parent.basedir}/compile-tools/thrift/target/build/compiler/cpp/bin/thrift</thrift.exec.absolute.path>
- <iotdb.server.script>start-server.sh</iotdb.server.script>
+ <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+ <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
</properties>
</profile>
<profile>
@@ -117,11 +123,205 @@
<cmake.generator>Visual Studio 16 2019</cmake.generator>
<cmake.root.dir>${project.parent.basedir}/compile-tools/thrift/target/cmake-${cmake-version}-win64-x64/</cmake.root.dir>
<thrift.exec.absolute.path>${project.parent.basedir}/compile-tools/thrift/target/build/compiler/cpp/bin/${cmake.build.type}/thrift.exe</thrift.exec.absolute.path>
- <iotdb.server.script>start-server.bat</iotdb.server.script>
+ <iotdb.start.script>start-standalone.bat</iotdb.start.script>
+ <iotdb.stop.script>stop-standalone.bat</iotdb.stop.script>
<boost.include.dir/>
<boost.library.dir/>
</properties>
</profile>
+ <profile>
+ <id>compile-cpp</id>
+ <build>
+ <plugins>
+ <!-- Build and do session integration test -->
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-test-resources</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/build/test</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/test</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.coderplus.maven.plugins</groupId>
+ <artifactId>copy-rename-maven-plugin</artifactId>
+ <version>1.0.1</version>
+ <executions>
+ <execution>
+ <id>copy-thrift-source</id>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <fileSets>
+ <fileSet>
+ <sourceFile>../thrift/src/main/thrift/client.thrift</sourceFile>
+ <destinationFile>${project.build.directory}/thrift/client.thrift</destinationFile>
+ </fileSet>
+ <fileSet>
+ <sourceFile>../thrift-commons/src/main/thrift/common.thrift</sourceFile>
+ <destinationFile>${project.build.directory}/thrift/common.thrift</destinationFile>
+ </fileSet>
+ </fileSets>
+ </configuration>
+ </execution>
+ <execution>
+ <!-- Copy source file and CmakeLists.txt into target directory -->
+ <id>copy-cmakelist-file</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <fileSets>
+ <fileSet>
+ <sourceFile>${project.basedir}/src/main/CMakeLists.txt</sourceFile>
+ <destinationFile>${project.build.directory}/build/main/CMakeLists.txt</destinationFile>
+ </fileSet>
+ <fileSet>
+ <sourceFile>${project.basedir}/src/main/Session.h</sourceFile>
+ <destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.h</destinationFile>
+ </fileSet>
+ <fileSet>
+ <sourceFile>${project.basedir}/src/main/Session.cpp</sourceFile>
+ <destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.cpp</destinationFile>
+ </fileSet>
+ </fileSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.thrift.tools</groupId>
+ <artifactId>maven-thrift-plugin</artifactId>
+ <version>0.1.11</version>
+ <executions>
+ <execution>
+ <id>generate-thrift-sources-cpp</id>
+ <!-- Move from generate-sources to generate-resources to avoid double executions -->
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <generator>cpp:no_skeleton</generator>
+ <thriftExecutable>${thrift.exec.absolute.path}</thriftExecutable>
+ <thriftSourceRoot>${project.build.directory}/thrift</thriftSourceRoot>
+ <outputDirectory>${project.build.directory}/build/main/generated-sources-cpp</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.googlecode.cmake-maven-project</groupId>
+ <artifactId>cmake-maven-plugin</artifactId>
+ <version>3.7.2-b1</version>
+ <executions>
+ <!-- Uses a CMake generator to generate the build using the build tool of choice -->
+ <execution>
+ <id>cmake-generate</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <classifier>${os.classifier}</classifier>
+ <!--
+ We need to use a newer version of cmake, so disable downloading. If we do not
+ set this to false, a cmake of version 3.7.2 will be downloaded.
+ -->
+ <downloadBinaries>false</downloadBinaries>
+ <sourcePath>${project.build.directory}/build/main</sourcePath>
+ <!--
+ Path to where the build configuration is generated
+ (This directory is then used in the compile step to actually perform the build)
+ -->
+ <targetPath>${project.build.directory}/build/main</targetPath>
+ <generator>${cmake.generator}</generator>
+ <options>
+ <option>-DBOOST_INCLUDEDIR=${boost.include.dir}</option>
+ <option>-DBOOST_LIBRARYDIR=${boost.library.dir}</option>
+ </options>
+ </configuration>
+ </execution>
+ <!-- Actually executes the build -->
+ <execution>
+ <id>cmake-compile</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <classifier>${os.classifier}</classifier>
+ <config>${cmake.build.type}</config>
+ <!--
+ We need to use a newer version of cmake, so disable downloading
+ and tell the plugin where to find that version.
+ -->
+ <downloadBinaries>false</downloadBinaries>
+ <!-- The directory where the "generate" step generated the build configuration -->
+ <projectDirectory>${project.build.directory}/build/main</projectDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!--Package all C++ header files and client library-->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package-client-cpp</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/client-cpp.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.googlecode.maven-download-plugin</groupId>
+ <artifactId>download-maven-plugin</artifactId>
+ <version>1.6.7</version>
+ <executions>
+ <!-- Download the Catch2 header file. -->
+ <execution>
+ <id>get-catch2</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>wget</goal>
+ </goals>
+ <configuration>
+ <url>${catch2.url}</url>
+ <unpack>false</unpack>
+ <outputDirectory>${project.build.directory}/build/test/catch2</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<profile>
<id>cppTest</id>
<build>
@@ -186,7 +386,7 @@
<!-- Start a local IoTDB server to run integration test cases -->
<execution>
<id>iotdb-process</id>
- <phase>generate-test-resources</phase>
+ <phase>integration-test</phase>
<goals>
<goal>start</goal>
</goals>
@@ -198,7 +398,7 @@
<!-- Redirect IoTDB server log to /dev/null -->
<processLogFile>${project.build.directory}/build/test/test.log</processLogFile>
<arguments>
- <argument>${project.basedir}/../server/target/iotdb-server-${project.version}/sbin/${iotdb.server.script}</argument>
+ <argument>${project.basedir}/../distribution/target/apache-iotdb-${project.version}-all-bin/apache-iotdb-${project.version}-all-bin/sbin/${iotdb.start.script}</argument>
</arguments>
</configuration>
</execution>
@@ -209,6 +409,15 @@
<goals>
<goal>stop-all</goal>
</goals>
+ <configuration>
+ <name>stop-iotdb</name>
+ <waitForInterrupt>false</waitForInterrupt>
+ <!-- Maximum time in seconds to wait after launching IoTDB -->
+ <waitAfterLaunch>5</waitAfterLaunch>
+ <arguments>
+ <argument>${project.basedir}/../distribution/target/apache-iotdb-${project.version}-all-bin/apache-iotdb-${project.version}-all-bin/sbin/${iotdb.stop.script}</argument>
+ </arguments>
+ </configuration>
</execution>
</executions>
</plugin>