This is an automated email from the ASF dual-hosted git repository.

amolina pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-cookbook.git


The following commit(s) were added to refs/heads/main by this push:
     new a2dc503  [Java] Cookbook CI (#133)
a2dc503 is described below

commit a2dc503b6fb30689745becc4379a0f7b27a8e2cc
Author: Alessandro Molina <[email protected]>
AuthorDate: Tue Jan 25 17:45:30 2022 +0100

    [Java] Cookbook CI (#133)
    
    * Add Java cookbook testing
    
    * Add Java cookbook deploy
---
 .github/workflows/deploy_cookbooks.yml   |  2 +-
 .github/workflows/test_java_cookbook.yml | 44 ++++++++++++++++++++++++++++++++
 java/ext/javadoctest.py                  |  6 ++---
 java/requirements.txt                    |  1 +
 java/source/demo/pom.xml                 | 10 ++++++++
 5 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/deploy_cookbooks.yml 
b/.github/workflows/deploy_cookbooks.yml
index 07ca317..452bb0e 100644
--- a/.github/workflows/deploy_cookbooks.yml
+++ b/.github/workflows/deploy_cookbooks.yml
@@ -16,7 +16,7 @@ jobs:
       - name: Setup pandoc
         uses: r-lib/actions/setup-pandoc@v1
       - name: Install dependencies
-        run: sudo apt install libcurl4-openssl-dev libssl-dev python3-pip
+        run: sudo apt install libcurl4-openssl-dev libssl-dev python3-pip 
openjdk-11-jdk maven
       - name: Run tests
         run: make test
       - name: Build and render books
diff --git a/.github/workflows/test_java_cookbook.yml 
b/.github/workflows/test_java_cookbook.yml
new file mode 100644
index 0000000..8f211d5
--- /dev/null
+++ b/.github/workflows/test_java_cookbook.yml
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Test Java Cookbook
+
+on:
+  pull_request:
+    branches:
+       - main
+    paths:
+     - "java/**"
+     - ".github/workflows/test_java_cookbook.yml"
+     
+concurrency:
+  group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
+  cancel-in-progress: true
+
+jobs:
+  test_py:
+    name: "Test Java Cookbook"
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v1
+      - name: Install dependencies
+        run: sudo apt install libcurl4-openssl-dev libssl-dev python3-pip 
openjdk-11-jdk maven
+      - name: Run tests
+        run: make javatest
+      - name: Build cookbook
+        run: make java
+
diff --git a/java/ext/javadoctest.py b/java/ext/javadoctest.py
index 9e8836f..4b39817 100644
--- a/java/ext/javadoctest.py
+++ b/java/ext/javadoctest.py
@@ -22,7 +22,7 @@ class JavaDocTestBuilder(DocTestBuilder):
         self, code: str, name: str, type: str, flags: Any, dont_inherit: bool
     ) -> Any:
         # go to project that contains all your arrow maven dependencies
-        path_arrow_project = os.path.join(pathlib.Path.cwd(), "source", "demo")
+        path_arrow_project = pathlib.Path(__file__).parent.parent / "source" / 
"demo"
 
         # create list of all arrow jar dependencies
         subprocess.check_call(
@@ -36,13 +36,13 @@ class JavaDocTestBuilder(DocTestBuilder):
             cwd=path_arrow_project,
             text=True,
         )
-        if not os.path.exists(path_arrow_project + "/.cp.tmp"):
+        if not (path_arrow_project / ".cp.tmp").exists():
             raise RuntimeError(
                 __("invalid process to create jshell dependencies library")
             )
 
         # get list of all arrow jar dependencies
-        with open(os.path.join(path_arrow_project, ".cp.tmp")) as f:
+        with open(path_arrow_project / ".cp.tmp") as f:
             stdout_dependency = f.read()
         if not stdout_dependency:
             raise RuntimeError(
diff --git a/java/requirements.txt b/java/requirements.txt
index 9e7f275..c94ebc1 100644
--- a/java/requirements.txt
+++ b/java/requirements.txt
@@ -1,3 +1,4 @@
+Sphinx>=4.0.2
 black==21.7b0
 flake8==3.8.3
 isort==4.3.21
\ No newline at end of file
diff --git a/java/source/demo/pom.xml b/java/source/demo/pom.xml
index 2d1c9fd..2f4305d 100644
--- a/java/source/demo/pom.xml
+++ b/java/source/demo/pom.xml
@@ -8,6 +8,16 @@
     <artifactId>demo</artifactId>
     <version>1.0-SNAPSHOT</version>
 
+    <build>
+    <extensions>
+      <extension>
+        <groupId>kr.motd.maven</groupId>
+        <artifactId>os-maven-plugin</artifactId>
+        <version>1.6.1</version>
+      </extension>
+    </extensions>
+    </build>
+
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
         <maven.compiler.target>8</maven.compiler.target>

Reply via email to