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

jin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-doc.git


The following commit(s) were added to refs/heads/master by this push:
     new 48c5320d chore: update scripts for validating HugeGraph 1.2.0 release 
(#307)
48c5320d is described below

commit 48c5320dae716414dbc4f7afad9832277f9d0dd9
Author: V_Galaxy <[email protected]>
AuthorDate: Mon Dec 18 15:06:46 2023 +0800

    chore: update scripts for validating HugeGraph 1.2.0 release (#307)
---
 .github/configs/settings.xml           |  60 ++++++++
 .github/workflows/hugo.yml             |  15 --
 .github/workflows/validate-release.yml | 235 +++++++++++++++++------------
 dist/validate-release.sh               | 261 +++++++++++++++++++++++----------
 4 files changed, 386 insertions(+), 185 deletions(-)

diff --git a/.github/configs/settings.xml b/.github/configs/settings.xml
new file mode 100644
index 00000000..294ded1c
--- /dev/null
+++ b/.github/configs/settings.xml
@@ -0,0 +1,60 @@
+<!--
+   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.
+  -->
+
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0";
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 
https://maven.apache.org/xsd/settings-1.0.0.xsd";>
+    <servers>
+        <server>
+            <id>github</id>
+            <username>${env.GITHUB_ACTOR}</username>
+            <password>${env.GITHUB_TOKEN}</password>
+        </server>
+    </servers>
+
+    <profiles>
+        <profile>
+            <id>local-repo</id>
+            <repositories>
+                <repository>
+                    <id>central</id>
+                    <url>https://repo.maven.apache.org/maven2</url>
+                    <releases>
+                        <enabled>true</enabled>
+                    </releases>
+                    <snapshots>
+                        <enabled>false</enabled>
+                    </snapshots>
+                </repository>
+                <repository>
+                    <id>staged-releases</id>
+                    
<url>https://repository.apache.org/content/groups/staging/</url>
+                </repository>
+            </repositories>
+            <pluginRepositories>
+                <pluginRepository>
+                    <id>staged-releases</id>
+                    
<url>https://repository.apache.org/content/groups/staging/</url>
+                </pluginRepository>
+            </pluginRepositories>
+        </profile>
+    </profiles>
+
+    <activeProfiles>
+        <activeProfile>local-repo</activeProfile>
+    </activeProfiles>
+</settings>
diff --git a/.github/workflows/hugo.yml b/.github/workflows/hugo.yml
index 3be781d8..01fbd69c 100644
--- a/.github/workflows/hugo.yml
+++ b/.github/workflows/hugo.yml
@@ -1,18 +1,3 @@
-# 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.
-
 # Sample workflow for building and deploying a Hugo site to GitHub Pages
 name: "Deploy site to pages (hugo)"
 
diff --git a/.github/workflows/validate-release.yml 
b/.github/workflows/validate-release.yml
index fcff4241..3df7411d 100644
--- a/.github/workflows/validate-release.yml
+++ b/.github/workflows/validate-release.yml
@@ -5,7 +5,7 @@ on:
     inputs:
       release_version:
         required: true
-        default: '1.0.0'
+        default: '1.2.0'
       gpg_user:
         required: true
         default: 'imbajin'
@@ -27,9 +27,10 @@ jobs:
       USER: ${{ inputs.gpg_user }}
       # TODO: parse version from the running branch name & also adapt the 
input version
       RELEASE_VERSION: ''
+      USE_STAGE: 'true' # Whether to include the stage repository.
     steps:
       - name: Checkout source
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
       - name: Install JDK ${{ matrix.java_version }}
         uses: actions/setup-java@v3
         with:
@@ -53,33 +54,38 @@ jobs:
           key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
           restore-keys: |
             ${{ runner.os }}-yarn-
+      - name: Use staged maven repo settings
+        if: ${{ env.USE_STAGE == 'true' }}
+        run: |
+          cp $HOME/.m2/settings.xml /tmp/settings.xml
+          cp -vf .github/configs/settings.xml $HOME/.m2/settings.xml && cat 
$HOME/.m2/settings.xml
 
       - name: 1. Download SVN Sources
         run: |
           rm -rf dist/${{ inputs.release_version }}
           svn co ${URL_PREFIX}/${{ inputs.release_version }} dist/${{ 
inputs.release_version }}
-          cd dist/${{ inputs.release_version }} || exit
 
       - name: 2. Check Environment & Import Public Keys
         run: |
-          cd dist/${{ inputs.release_version }}
+          cd dist/${{ inputs.release_version }} || exit
+
           shasum --version 1>/dev/null || exit
           gpg --version 1>/dev/null || exit
-  
+
           wget https://downloads.apache.org/incubator/hugegraph/KEYS || exit
           echo "Import KEYS:" && gpg --import KEYS
-
+          # TODO: how to trust all public keys in gpg list, currently only 
trust the first one
           echo -e "5\ny\n" | gpg --batch --command-fd 0 --edit-key $USER trust
 
           echo "trust all pk"
-          for key in $(gpg --no-tty --list-keys --with-colons | awk -F: 
'/^pub/ {print $5}'); 
-          do
+          for key in $(gpg --no-tty --list-keys --with-colons | awk -F: 
'/^pub/ {print $5}'); do
               echo -e "5\ny\n" | gpg --batch --command-fd 0 --edit-key "$key" 
trust
           done
 
       - name: 3. Check SHA512 & GPG Signature
         run: |
-          cd dist/${{ inputs.release_version }}
+          cd dist/${{ inputs.release_version }} || exit
+
           for i in *.tar.gz; do
             echo "$i"
             shasum -a 512 --check "$i".sha512 || exit
@@ -88,17 +94,22 @@ jobs:
 
       - name: 4. Validate Source Packages
         run: |
-          cd dist/${{ inputs.release_version }} && ls -lh ./*.tar.gz
+          cd dist/${{ inputs.release_version }} || exit
+
+          ls -lh ./*.tar.gz
           for i in *src.tar.gz; do
             echo "$i"
-            # 4.0 check the directory name include "incubating"
+
+            # 4.1 check the directory name include "incubating"
             if [[ ! "$i" =~ "incubating" ]]; then
               echo "The package name $i should include incubating" && exit 1
             fi
+
             tar xzvf "$i" || exit
-            cd "$(basename "$i" .tar.gz)" || exit
+            pushd "$(basename "$i" .tar.gz)" || exit
+            echo "Start to check the package content: $(basename "$i" .tar.gz)"
 
-            # 4.1 check the directory include "NOTICE" and "LICENSE" and 
"DISCLAIMER" file
+            # 4.2 check the directory include "NOTICE" and "LICENSE" and 
"DISCLAIMER" file
             if [[ ! -f "LICENSE" ]]; then
               echo "The package should include LICENSE file" && exit 1
             fi
@@ -108,7 +119,8 @@ jobs:
             if [[ ! -f "DISCLAIMER" ]]; then
                 echo "The package should include DISCLAIMER file" && exit 1
             fi
-            # 4.2 ensure doesn't contains 
*GPL/BCL/JSR-275/RSAL/QPL/SSPL/CPOL/NPL1.*/CC-BY 
+
+            # 4.3 ensure doesn't contains 
*GPL/BCL/JSR-275/RSAL/QPL/SSPL/CPOL/NPL1.*/CC-BY 
             #     dependency in LICENSE and NOTICE file 
             COUNT=$(grep -E "GPL|BCL|JSR-275|RSAL|QPL|SSPL|CPOL|NPL1|CC-BY" 
LICENSE NOTICE | wc -l)
             if [[ $COUNT -ne 0 ]]; then
@@ -116,92 +128,124 @@ jobs:
               echo "The package shouldn't include GPL* invalid dependency, but 
get $COUNT" && exit 1
             fi
 
-            # 4.3 ensure doesn't contains empty directory or file
-            COUNT=$(find . -type d -empty | wc -l)
-            if [[ $COUNT -ne 0 ]]; then
+            # 4.4 ensure doesn't contains empty directory or file
+            find . -type d -empty | while read -r EMPTY_DIR; do
               find . -type d -empty
-              echo "The package shouldn't include empty directory, but get 
$COUNT" && exit 1
-            fi
-          
-            # 4.4 ensure any file should less than 900kb & not include binary 
file
-            COUNT=$(find . -type f -size +900k | wc -l)
-            if [[ $COUNT -ne 0 ]]; then
-              find . -type f -size +900k
-              echo "The package shouldn't include file larger than 900kb, but 
get $COUNT" && exit 1
-            fi
-            COUNT=$(find . -type f | grep -v .txt | perl -lne 'print if -B' | 
wc -l)
-            if [[ $COUNT -ne 0 ]]; then
-              find . -type f | grep -v .txt | perl -lne 'print if -B'
-              # due to the search script is not perfect, we can't exit here 
(check manually)
-              echo "The package shouldn't include binary file, but get $COUNT" 
&& exit 1
-            fi
-          
-            # 4.5 test compile the packages
+              echo "The package $i shouldn't include empty directory: 
$EMPTY_DIR is empty" && exit 1
+            done
+            find . -type f -empty | while read -r EMPTY_FILE; do
+              find . -type f -empty
+              echo "The package $i shouldn't include empty file: $EMPTY_FILE 
is empty" && exit 1
+            done
+
+            # 4.5 ensure any file should less than 800kb
+            find . -type f -size +800k | while read -r FILE; do
+              find . -type f -size +800k
+              echo "The package $i shouldn't include file larger than 800kb: 
$FILE is larger than 800kb" && exit 1
+            done
+
+            # 4.6: ensure all binary files are documented in LICENSE
+            find . -type f | perl -lne 'print if -B' | while read -r 
BINARY_FILE; do
+              FILE_NAME=$(basename "$BINARY_FILE")
+              if grep -q "$FILE_NAME" LICENSE; then
+                echo "Binary file $BINARY_FILE is documented in LICENSE, 
please check manually"
+              else
+                echo "Error: Binary file $BINARY_FILE is not documented in 
LICENSE" && exit 1
+              fi
+            done
+
+            # 4.7 test compile the packages
             if [[ ${{ matrix.java_version }} == 8 && "$i" =~ "computer" ]]; 
then
-              cd .. && echo "skip computer module in java8"
+              echo "skip computer module in java8"
+              popd || exit
               continue
             fi
-            mvn package -DskipTests -ntp -e || exit 1
+            mvn package -DskipTests -ntp -e || exit
             ls -lh
-            cd .. || exit
+
+            popd || exit
           done
 
       - name: 5. Run Compiled Packages In Server
         run: |
-          cd dist/${{ inputs.release_version }} && ls -lh
-          cd ./*hugegraph-incubating*src/*hugegraph*${{ inputs.release_version 
}} || exit
-          bin/init-store.sh && sleep 1
-          bin/start-hugegraph.sh && ls ../../
-          cd ../../ || exit
+          cd dist/${{ inputs.release_version }} || exit
+
+          ls -lh
+          pushd ./*hugegraph-incubating*src/hugegraph-server/*hugegraph*${{ 
inputs.release_version }} || exit
+          bin/init-store.sh || exit
+          sleep 3
+          bin/start-hugegraph.sh || exit
+          popd || exit
 
       - name: 6. Run Compiled Packages In ToolChain (Loader & Tool & Hubble)
         run: |
-          cd dist/${{ inputs.release_version }}
-          cd ./*toolchain*src || exit
+          cd dist/${{ inputs.release_version }} || exit
+
+          pushd ./*toolchain*src || exit
           ls -lh
-          cd ./*toolchain*${{ inputs.release_version }} || exit
+          pushd ./*toolchain*${{ inputs.release_version }} || exit
           ls -lh
 
           # 6.1 load some data first
           echo "test loader"
-          cd ./*loader*${{ inputs.release_version }} || exit
+          pushd ./*loader*${{ inputs.release_version }} || exit
           bin/hugegraph-loader.sh -f ./example/file/struct.json -s 
./example/file/schema.groovy \
             -g hugegraph || exit
-          cd .. || exit
+          popd || exit
 
           # 6.2 try some gremlin query & api in tool
           echo "test tool"
-          cd ./*tool*${{ inputs.release_version }} || exit
+          pushd ./*tool*${{ inputs.release_version }} || exit
           bin/hugegraph gremlin-execute --script 'g.V().count()' || exit
           bin/hugegraph task-list || exit
           bin/hugegraph backup -t all --directory ./backup-test || exit
-          cd .. || exit
-          
+          popd || exit
+
           # 6.3 start hubble and connect to server 
           echo "test hubble"
-          cd ./*hubble*${{ inputs.release_version }} || exit
-          cat conf/hugegraph-hubble.properties && bin/start-hubble.sh
-          # TODO: need stop the server here
-          jps | grep HugeGraphServer | awk '{print $1}' | xargs kill -9
-          cd ../../../ || exit
-          rm -rf ./*src* && ls -lh
+          pushd ./*hubble*${{ inputs.release_version }} || exit
+          # TODO: add hubble doc & test it
+          cat conf/hugegraph-hubble.properties
+          bin/start-hubble.sh || exit
+          bin/stop-hubble.sh || exit
+          popd || exit
+
+          popd || exit
+          popd || exit
+          # stop server
+          pushd ./*hugegraph-incubating*src/hugegraph-server/*hugegraph*${{ 
inputs.release_version }} || exit
+          bin/stop-hugegraph.sh || exit
+          popd || exit
+
+          # clear source packages
+          rm -rf ./*src*
+          ls -lh
 
       - name: 7. Validate Binary Packages
         run: |
-          cd dist/${{ inputs.release_version }}
+          cd dist/${{ inputs.release_version }} || exit
+
           for i in *.tar.gz; do
+            if [[ "$i" == *-src.tar.gz ]]; then
+              # skip source packages
+              continue
+            fi
+
             echo "$i"
-            # 7.0 check the directory name include "incubating"
+
+            # 7.1 check the directory name include "incubating"
             if [[ ! "$i" =~ "incubating" ]]; then
               echo "The package name $i should include incubating" && exit 1
             fi
-            tar xzvf "$i" || exit
 
-            # 7.1 check root dir include "NOTICE"/"LICENSE"/"DISCLAIMER" & 
"licenses" dir
-            cd "$(basename "$i" .tar.gz)" || exit
+            tar xzvf "$i" || exit
+            pushd "$(basename "$i" .tar.gz)" || exit
             ls -lh
+            echo "Start to check the package content: $(basename "$i" .tar.gz)"
+
+            # 7.2 check root dir include "NOTICE"/"LICENSE"/"DISCLAIMER" & 
"licenses" dir
             if [[ ! -f "LICENSE" ]]; then
-              echo "The package should include LICENSE file" && ls -lh && exit 
1
+              echo "The package should include LICENSE file" && exit 1
             fi
             if [[ ! -f "NOTICE" ]]; then
               echo "The package should include NOTICE file" && exit 1
@@ -213,62 +257,73 @@ jobs:
               echo "The package should include licenses dir" && exit 1
             fi
 
-            # 7.2 ensure doesn't contains 
*GPL/BCL/JSR-275/RSAL/QPL/SSPL/CPOL/NPL1.*/CC-BY 
+            # 7.3 ensure doesn't contains 
*GPL/BCL/JSR-275/RSAL/QPL/SSPL/CPOL/NPL1.*/CC-BY 
             #     dependency in LICENSE/NOTICE and licenses/* files 
-            COUNT=$(grep -r -E "GPL|BCL|JSR-275|RSAL|QPL|SSPL|CPOL|NPL1|CC-BY" 
LICENSE NOTICE licenses | wc -l)
+            COUNT=$(grep -rE "GPL|BCL|JSR-275|RSAL|QPL|SSPL|CPOL|NPL1|CC-BY" 
LICENSE NOTICE licenses | wc -l)
             if [[ $COUNT -ne 0 ]]; then
               grep -r -E "GPL|BCL|JSR-275|RSAL|QPL|SSPL|CPQL|NPL1|CC-BY" 
LICENSE NOTICE licenses
               echo "The package shouldn't include GPL* invalid dependency, but 
get $COUNT" && exit 1
             fi
-          
-            # 7.3 ensure doesn't contains empty directory or file
-            COUNT=$(find . -type d -empty | wc -l)
-            if [[ $COUNT -ne 0 ]]; then
+
+            # 7.4: ensure doesn't contains empty directory or file
+            find . -type d -empty | while read -r EMPTY_DIR; do
               find . -type d -empty
-              echo "The package shouldn't include empty directory, but get 
$COUNT" && exit 1
-            fi
+              echo "The package $i shouldn't include empty directory: 
$EMPTY_DIR is empty" && exit 1
+            done
+            find . -type f -empty | while read -r EMPTY_FILE; do
+              find . -type f -empty
+              echo "The package $i shouldn't include empty file: $EMPTY_FILE 
is empty" && exit 1
+            done
 
-            cd - || exit
+            popd || exit
           done
 
-      - name: 8. Validate Binary Packages(Start Server)
+      - name: 8. Run Binary Packages In Server
         run: |
-          cd dist/${{ inputs.release_version }}
-          cd ./*hugegraph-incubating*${{ inputs.release_version }} || exit
-          bin/init-store.sh && sleep 1
-          bin/start-hugegraph.sh && ls ../
-          cd - || exit
+          cd dist/${{ inputs.release_version }} || exit
+
+          pushd ./*hugegraph-incubating*${{ inputs.release_version }} || exit
+          bin/init-store.sh || exit
+          sleep 3
+          bin/start-hugegraph.sh || exit
+          popd || exit
 
-      - name: 9. Validate Binary Packages(Start ToolChain(Loader/Tool/Hubble))
+      - name: 9. Run Binary Packages In ToolChain (Loader & Tool & Hubble)
         run: |
-          cd dist/${{ inputs.release_version }}
-          cd ./*toolchain*${{ inputs.release_version }} || exit
+          cd dist/${{ inputs.release_version }} || exit
+
+          pushd ./*toolchain*${{ inputs.release_version }} || exit
           ls -lh
 
-          # 9.1 loader some data first 
+          # 9.1 loader some data first
           echo "test loader"
-          cd ./*loader*${{ inputs.release_version }} || exit
+          pushd ./*loader*${{ inputs.release_version }} || exit
           bin/hugegraph-loader.sh -f ./example/file/struct.json -s 
./example/file/schema.groovy \
             -g hugegraph || exit
-          cd - || exit
+          popd || exit
 
           # 9.2 try some gremlin query & api in tool
           echo "test tool"
-          cd ./*tool*${{ inputs.release_version }} || exit
+          pushd ./*tool*${{ inputs.release_version }} || exit
           bin/hugegraph gremlin-execute --script 'g.V().count()' || exit
           bin/hugegraph task-list || exit
           bin/hugegraph backup -t all --directory ./backup-test || exit
-          cd - || exit
+          popd || exit
 
           # 9.3 start hubble and connect to server
           echo "test hubble"
-          cd ./*hubble*${{ inputs.release_version }} || exit
+          pushd ./*hubble*${{ inputs.release_version }} || exit
           # TODO: add hubble doc & test it
           cat conf/hugegraph-hubble.properties
-          bin/stop-hubble.sh && bin/start-hubble.sh
-          cd - || exit
-          # TODO: need stop the server here 
-          jps | grep HugeGraphServer | awk '{print $1}' | xargs kill -9
+          bin/start-hubble.sh || exit
+          bin/stop-hubble.sh || exit
+          popd || exit
+
+          popd || exit
+          # stop server
+          pushd ./*hugegraph-incubating*${{ inputs.release_version }} || exit
+          bin/stop-hugegraph.sh || exit
+          popd || exit
 
     strategy:
       fail-fast: false
diff --git a/dist/validate-release.sh b/dist/validate-release.sh
index 735dc30b..57a1a8c8 100755
--- a/dist/validate-release.sh
+++ b/dist/validate-release.sh
@@ -30,17 +30,30 @@ USER=$3
 #GIT_BRANCH="release-${RELEASE_VERSION}"
 
 RELEASE_VERSION=${RELEASE_VERSION:?"Please input the release version behind 
script"}
+WORK_DIR=$(
+  cd "$(dirname "$0")" || exit
+  pwd
+)
 
-# step1: download svn files
-rm -rf dist/"$RELEASE_VERSION" && svn co ${URL_PREFIX}/"$RELEASE_VERSION" 
dist/"$RELEASE_VERSION"
-cd dist/"$RELEASE_VERSION" || exit
+cd "${WORK_DIR}" || exit
+echo "Current work dir: $(pwd)"
+
+################################
+# Step 1: Download SVN Sources #
+################################
+rm -rf "$WORK_DIR"/dist/"$RELEASE_VERSION"
+svn co ${URL_PREFIX}/"$RELEASE_VERSION" "$WORK_DIR"/dist/"$RELEASE_VERSION"
+
+##################################################
+# Step 2: Check Environment & Import Public Keys #
+##################################################
+cd "$WORK_DIR"/dist/"$RELEASE_VERSION" || exit
 
-# step2: check environment & import public keys
 shasum --version 1>/dev/null || exit
 gpg --version 1>/dev/null || exit
 
 wget https://downloads.apache.org/incubator/hugegraph/KEYS || exit
-gpg --import KEYS
+echo "Import KEYS:" && gpg --import KEYS
 # TODO: how to trust all public keys in gpg list, currently only trust the 
first one
 echo -e "5\ny\n" | gpg --batch --command-fd 0 --edit-key $USER trust
 
@@ -49,25 +62,36 @@ for key in $(gpg --no-tty --list-keys --with-colons | awk 
-F: '/^pub/ {print $5}
   echo -e "5\ny\n" | gpg --batch --command-fd 0 --edit-key "$key" trust
 done
 
-# step3: check sha512 & gpg signature
+########################################
+# Step 3: Check SHA512 & GPG Signature #
+########################################
+cd "$WORK_DIR"/dist/"$RELEASE_VERSION" || exit
+
 for i in *.tar.gz; do
   echo "$i"
   shasum -a 512 --check "$i".sha512 || exit
   eval gpg "${GPG_OPT}" --verify "$i".asc "$i" || exit
 done
 
-# step4: validate source packages
+####################################
+# Step 4: Validate Source Packages #
+####################################
+cd "$WORK_DIR"/dist/"$RELEASE_VERSION" || exit
+
 ls -lh ./*.tar.gz
 for i in *src.tar.gz; do
   echo "$i"
-  #### step4.0: check the directory name include "incubating"
+
+  # 4.1: check the directory name include "incubating"
   if [[ ! "$i" =~ "incubating" ]]; then
     echo "The package name $i should include incubating" && exit 1
   fi
+
   tar xzvf "$i" || exit
-  cd "$(basename "$i" .tar.gz)" || exit
+  pushd "$(basename "$i" .tar.gz)" || exit
+  echo "Start to check the package content: $(basename "$i" .tar.gz)"
 
-  #### step4.1: check the directory include "NOTICE" and "LICENSE" file and 
"DISCLAIMER" file
+  # 4.2: check the directory include "NOTICE" and "LICENSE" file and 
"DISCLAIMER" file
   if [[ ! -f "LICENSE" ]]; then
     echo "The package $i should include LICENSE file" && exit 1
   fi
@@ -77,83 +101,134 @@ for i in *src.tar.gz; do
   if [[ ! -f "DISCLAIMER" ]]; then
     echo "The package $i should include DISCLAIMER file" && exit 1
   fi
-  # step4.2: ensure doesn't contains 
*GPL/BCL/JSR-275/RSAL/QPL/SSPL/CPOL/NPL1.*/CC-BY
+
+  # 4.3: ensure doesn't contains 
*GPL/BCL/JSR-275/RSAL/QPL/SSPL/CPOL/NPL1.*/CC-BY
+  #      dependency in LICENSE and NOTICE file
   COUNT=$(grep -E "GPL|BCL|JSR-275|RSAL|QPL|SSPL|CPOL|NPL1|CC-BY" LICENSE 
NOTICE | wc -l)
   if [[ $COUNT -ne 0 ]]; then
      grep -E "GPL|BCL|JSR-275|RSAL|QPL|SSPL|CPOL|NPL1.0|CC-BY" LICENSE NOTICE
      echo "The package $i shouldn't include GPL* invalid dependency, but get 
$COUNT" && exit 1
   fi
-  # step4.3: ensure doesn't contains empty directory or file
-  COUNT=$(find . -type d -empty | wc -l)
-  if [[ $COUNT -ne 0 ]]; then
+
+  # 4.4: ensure doesn't contains empty directory or file
+  find . -type d -empty | while read -r EMPTY_DIR; do
     find . -type d -empty
-    echo "The package $i should not include empty directory, but get $COUNT" # 
TODO: && exit 1
-  fi
-  # step4.4: ensure any file should less than 900kb & not include binary file
-  COUNT=$(find . -type f -size +900k | wc -l)
-  if [[ $COUNT -ne 0 ]]; then
-    find . -type f -size +900k
-    echo "The package $i shouldn't include file larger than 900kb, but get 
$COUNT" && exit 1
-  fi
-  COUNT=$(find . -type f | perl -lne 'print if -B' | grep -v *.txt | wc -l)
-  if [[ $COUNT -ne 0 ]]; then
-    find . -type f | perl -lne 'print if -B'
-    echo "The package $i shouldn't include binary file, but get $COUNT"
-  fi
+    echo "The package $i shouldn't include empty directory: $EMPTY_DIR is 
empty" && exit 1
+  done
+  find . -type f -empty | while read -r EMPTY_FILE; do
+    find . -type f -empty
+    echo "The package $i shouldn't include empty file: $EMPTY_FILE is empty" 
&& exit 1
+  done
+
+  # 4.5: ensure any file should less than 800kb
+  find . -type f -size +800k | while read -r FILE; do
+    find . -type f -size +800k
+    echo "The package $i shouldn't include file larger than 800kb: $FILE is 
larger than 800kb" && exit 1
+  done
 
-  #### step4.5: test compile the packages
+  # 4.6: ensure all binary files are documented in LICENSE
+  find . -type f | perl -lne 'print if -B' | while read -r BINARY_FILE; do
+    FILE_NAME=$(basename "$BINARY_FILE")
+    if grep -q "$FILE_NAME" LICENSE; then
+      echo "Binary file $BINARY_FILE is documented in LICENSE, please check 
manually"
+    else
+      echo "Error: Binary file $BINARY_FILE is not documented in LICENSE" && 
exit 1
+    fi
+  done
+
+  # 4.7: test compile the packages
   if [[ $JAVA_VERSION == 8 && "$i" =~ "computer" ]]; then
-    cd .. && echo "skip computer module in java8"
+    echo "skip computer module in java8"
+    popd || exit
     continue
   fi
-  mvn package -DskipTests -ntp && ls -lh
-  cd .. || exit
+  mvn package -DskipTests -ntp -e || exit
+  ls -lh
+
+  popd || exit
 done
 
-#### step5: run the compiled packages in server
+###########################################
+# Step 5: Run Compiled Packages In Server #
+###########################################
+cd "$WORK_DIR"/dist/"$RELEASE_VERSION" || exit
+
 ls -lh
-cd ./*hugegraph-incubating*src/*hugegraph*"${RELEASE_VERSION}" || exit
-bin/init-store.sh && sleep 1
-bin/start-hugegraph.sh && ls ../../
-cd ../../ || exit
+pushd 
./*hugegraph-incubating*src/hugegraph-server/*hugegraph*"${RELEASE_VERSION}" || 
exit
+bin/init-store.sh || exit
+sleep 3
+bin/start-hugegraph.sh || exit
+popd || exit
+
+#######################################################################
+# Step 6: Run Compiled Packages In ToolChain (Loader & Tool & Hubble) #
+#######################################################################
+cd "$WORK_DIR"/dist/"$RELEASE_VERSION" || exit
 
-#### step6: run the compiled packages in toolchain (include loader/tool/hubble)
-cd ./*toolchain*src || exit
+pushd ./*toolchain*src || exit
 ls -lh
-cd ./*toolchain*"${RELEASE_VERSION}" || exit
+pushd ./*toolchain*"${RELEASE_VERSION}" || exit
 ls -lh
 
-##### step6.1: test loader
-cd ./*loader*"${RELEASE_VERSION}" || exit
+# 6.1: load some data first
+echo "test loader"
+pushd ./*loader*"${RELEASE_VERSION}" || exit
 bin/hugegraph-loader.sh -f ./example/file/struct.json -s 
./example/file/schema.groovy \
   -g hugegraph || exit
-cd .. || exit
+popd || exit
 
-##### step6.2: test tool
-cd ./*tool*"${RELEASE_VERSION}" || exit
+# 6.2: try some gremlin query & api in tool
+echo "test tool"
+pushd ./*tool*"${RELEASE_VERSION}" || exit
 bin/hugegraph gremlin-execute --script 'g.V().count()' || exit
 bin/hugegraph task-list || exit
 bin/hugegraph backup -t all --directory ./backup-test || exit
-cd .. || exit
+popd || exit
 
-##### step6.3: test hubble
-cd ./*hubble*"${RELEASE_VERSION}" || exit
+# 6.3: start hubble and connect to server
+echo "test hubble"
+pushd ./*hubble*"${RELEASE_VERSION}" || exit
 # TODO: add hubble doc & test it
-cat conf/hugegraph-hubble.properties && bin/start-hubble.sh
-cd ../../../ || exit
+cat conf/hugegraph-hubble.properties
+bin/start-hubble.sh || exit
+bin/stop-hubble.sh || exit
+popd || exit
+
+popd || exit
+popd || exit
+# stop server
+pushd 
./*hugegraph-incubating*src/hugegraph-server/*hugegraph*"${RELEASE_VERSION}" || 
exit
+bin/stop-hugegraph.sh || exit
+popd || exit
+
+# clear source packages
+rm -rf ./*src*
+ls -lh
+
+####################################
+# Step 7: Validate Binary Packages #
+####################################
+cd "$WORK_DIR"/dist/"$RELEASE_VERSION" || exit
 
-# step7: validate the binary packages
-rm -rf ./*src* && ls -lh
 for i in *.tar.gz; do
+  if [[ "$i" == *-src.tar.gz ]]; then
+    # skip source packages
+    continue
+  fi
+
   echo "$i"
-  #### step7.1: check the directory name include "incubating"
+
+  # 7.1: check the directory name include "incubating"
   if [[ ! "$i" =~ "incubating" ]]; then
     echo "The package name $i should include incubating" && exit 1
   fi
+
   tar xzvf "$i" || exit
+  pushd "$(basename "$i" .tar.gz)" || exit
+  ls -lh
+  echo "Start to check the package content: $(basename "$i" .tar.gz)"
 
-  #### step7.2: check root dir include "NOTICE"/"LICENSE"/"DISCLAIMER" files & 
"licenses" dir
-  cd "$(basename "$i" .tar.gz)" && ls -lh || exit
+  # 7.2: check root dir include "NOTICE"/"LICENSE"/"DISCLAIMER" files & 
"licenses" dir
   if [[ ! -f "LICENSE" ]]; then
     echo "The package $i should include LICENSE file" && exit 1
   fi
@@ -166,50 +241,76 @@ for i in *.tar.gz; do
   if [[ ! -d "licenses" ]]; then
     echo "The package $i should include licenses dir" && exit 1
   fi
-  #### step7.3: ensure doesn't contains 
*GPL/BCL/JSR-275/RSAL/QPL/SSPL/CPOL/NPL1.*/CC-BY
+
+  # 7.3: ensure doesn't contains 
*GPL/BCL/JSR-275/RSAL/QPL/SSPL/CPOL/NPL1.*/CC-BY
+  #      dependency in LICENSE/NOTICE and licenses/* files
   COUNT=$(grep -r -E "GPL|BCL|JSR-275|RSAL|QPL|SSPL|CPOL|NPL1|CC-BY" LICENSE 
NOTICE licenses | wc -l)
   if [[ $COUNT -ne 0 ]]; then
     grep -r -E "GPL|BCL|JSR-275|RSAL|QPL|SSPL|CPQL|NPL1|CC-BY" LICENSE NOTICE 
licenses
     echo "The package $i shouldn't include GPL* invalid dependency, but get 
$COUNT" && exit 1
   fi
-  #### step7.4: ensure doesn't contains empty directory or file
-  COUNT=$(find . -type d -empty | wc -l)
-  if [[ $COUNT -ne 0 ]]; then
+
+  # 7.4: ensure doesn't contains empty directory or file
+  find . -type d -empty | while read -r EMPTY_DIR; do
     find . -type d -empty
-    echo "The package $i should not include empty directory, but get $COUNT" # 
TODO: && exit 1
-  fi
-  cd - || exit
+    echo "The package $i shouldn't include empty directory: $EMPTY_DIR is 
empty" && exit 1
+  done
+  find . -type f -empty | while read -r EMPTY_FILE; do
+    find . -type f -empty
+    echo "The package $i shouldn't include empty file: $EMPTY_FILE is empty" 
&& exit 1
+  done
+
+  popd || exit
 done
 
-#### step8: start the server
-cd ./*hugegraph-incubating*"${RELEASE_VERSION}" || exit
-bin/init-store.sh && sleep 1
-# kill the HugeGraphServer process by jps
-jps | grep HugeGraphServer | awk '{print $1}' | xargs kill -9
-bin/start-hugegraph.sh && ls ../
-cd - || exit
+# TODO: skip the following steps by comparing the artifacts built from source 
packages with binary packages
+#########################################
+# Step 8: Run Binary Packages In Server #
+#########################################
+cd "$WORK_DIR"/dist/"$RELEASE_VERSION" || exit
 
-#### step9: running toolchain
-cd ./*toolchain*"${RELEASE_VERSION}" || exit
+pushd ./*hugegraph-incubating*"${RELEASE_VERSION}" || exit
+bin/init-store.sh || exit
+sleep 3
+bin/start-hugegraph.sh || exit
+popd || exit
+
+#####################################################################
+# Step 9: Run Binary Packages In ToolChain (Loader & Tool & Hubble) #
+#####################################################################
+cd "$WORK_DIR"/dist/"$RELEASE_VERSION" || exit
+
+pushd ./*toolchain*"${RELEASE_VERSION}" || exit
 ls -lh
-##### step9.1: test loader
-cd ./*loader*"${RELEASE_VERSION}" || exit
+
+# 9.1: load some data first
+echo "test loader"
+pushd ./*loader*"${RELEASE_VERSION}" || exit
 bin/hugegraph-loader.sh -f ./example/file/struct.json -s 
./example/file/schema.groovy \
   -g hugegraph || exit
-cd - || exit
+popd || exit
 
-##### step9.2: test tool
-cd ./*tool*"${RELEASE_VERSION}" || exit
+# 9.2: try some gremlin query & api in tool
+echo "test tool"
+pushd ./*tool*"${RELEASE_VERSION}" || exit
 bin/hugegraph gremlin-execute --script 'g.V().count()' || exit
 bin/hugegraph task-list || exit
 bin/hugegraph backup -t all --directory ./backup-test || exit
-cd - || exit
+popd || exit
 
-##### step9.3: test hubble
-cd ./*hubble*"${RELEASE_VERSION}" || exit
+# 9.3: start hubble and connect to server
+echo "test hubble"
+pushd ./*hubble*"${RELEASE_VERSION}" || exit
 # TODO: add hubble doc & test it
 cat conf/hugegraph-hubble.properties
-bin/stop-hubble.sh && bin/start-hubble.sh
-cd - || exit
+bin/start-hubble.sh || exit
+bin/stop-hubble.sh || exit
+popd || exit
+
+popd || exit
+# stop server
+pushd ./*hugegraph-incubating*"${RELEASE_VERSION}" || exit
+bin/stop-hugegraph.sh || exit
+popd || exit
 
 echo "Finish validate, please check all steps manually again!"

Reply via email to