You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by GitBox <gi...@apache.org> on 2022/11/01 12:50:12 UTC

[GitHub] [incubator-hugegraph-toolchain] javeme commented on a diff in pull request #336: add third-party dependencies check

javeme commented on code in PR #336:
URL: https://github.com/apache/incubator-hugegraph-toolchain/pull/336#discussion_r1010388540


##########
.github/workflows/check-dependencies.yml:
##########
@@ -0,0 +1,38 @@
+name: third-party dependencies check
+
+on: [push, pull_request]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    env:
+      STATIC_DIR: hugegraph-loader/assembly/static
+    steps:
+      - name: Checkout source
+        uses: actions/checkout@v2
+      - name: Set up JDK 8
+        uses: actions/setup-java@v2
+        with:
+          java-version: '8'
+          distribution: 'adopt'
+      - name: mvn install
+        run:
+          mvn install:install-file -Dfile=$STATIC_DIR/lib/ojdbc8-12.2.0.1.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar
+          mvn install -pl hugegraph-client -am -DskipTests=true
+      - name: mvn dependency:copy-dependencies
+        run:
+          mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=${{ github.workspace }}/current_dependencies
+      - name: generate current_dependencies.txt
+        run: |
+          ls ${{ github.workspace }}/current_dependencies  |egrep -v "^hugegraph" |sort > ~/current_dependencies.txt
+          cat ~/current_dependencies.txt
+      - name: check third dependencies
+        run: |
+          #by using commond join ,to check whether there are new third-party dependencies,compared with file(tool/dependencies/known-dependencies.txt) 
+          sort ${{ github.workspace }}/tool/dependencies/known-dependencies.txt > ~/known-dependencies.txt 
+          join -t : -o 1.1 2.1 -a2 ~/known-dependencies.txt ~/current_dependencies.txt > ~/result.txt
+          #print new third-party dependencies name if it exists 
+          awk -F ":" '{if($1=="")print $2" is not in file known-dependencies.txt!"}' ~/result.txt
+          result=`awk -F ":" '{if($1=="")print $2}'  ~/result.txt |wc -l`
+          #if has new third-party,the Action will fail
+          if [[ $result == 0 ]];then echo "All third dependencies is known!" ;else exit 1;fi

Review Comment:
   can we move to a script shell?



##########
.github/workflows/check-dependencies.yml:
##########
@@ -0,0 +1,38 @@
+name: third-party dependencies check
+
+on: [push, pull_request]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    env:
+      STATIC_DIR: hugegraph-loader/assembly/static
+    steps:
+      - name: Checkout source
+        uses: actions/checkout@v2
+      - name: Set up JDK 8
+        uses: actions/setup-java@v2
+        with:
+          java-version: '8'
+          distribution: 'adopt'
+      - name: mvn install
+        run:
+          mvn install:install-file -Dfile=$STATIC_DIR/lib/ojdbc8-12.2.0.1.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar
+          mvn install -pl hugegraph-client -am -DskipTests=true
+      - name: mvn dependency:copy-dependencies

Review Comment:
   rename to "generate current dependencies"



##########
tool/dependencies/regenerate_known_dependencies.sh:
##########
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+#
+# 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.
+#
+
+basepath=$(cd `dirname $0`; pwd)
+dependencies_path=$basepath/all_dependencies
+if [[ -d $dependencies_path ]];then
+  echo "rm -r -f dependencies_path"
+  rm -r -f $dependencies_path
+fi
+cd ../../
+
+mvn install:install-file -Dfile=./hugegraph-loader/assembly/static/lib/ojdbc8-12.2.0.1.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar
+mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=$dependencies_path
+ls $dependencies_path | egrep -v "^hugegraph" | sort -n > $basepath/known-dependencies.txt
+rm -r -f $dependencies_path

Review Comment:
   expect a blank line



##########
.github/workflows/check-dependencies.yml:
##########
@@ -0,0 +1,38 @@
+name: third-party dependencies check
+
+on: [push, pull_request]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    env:
+      STATIC_DIR: hugegraph-loader/assembly/static
+    steps:
+      - name: Checkout source
+        uses: actions/checkout@v2
+      - name: Set up JDK 8
+        uses: actions/setup-java@v2
+        with:
+          java-version: '8'
+          distribution: 'adopt'
+      - name: mvn install
+        run:
+          mvn install:install-file -Dfile=$STATIC_DIR/lib/ojdbc8-12.2.0.1.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar
+          mvn install -pl hugegraph-client -am -DskipTests=true
+      - name: mvn dependency:copy-dependencies
+        run:
+          mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=${{ github.workspace }}/current_dependencies
+      - name: generate current_dependencies.txt
+        run: |
+          ls ${{ github.workspace }}/current_dependencies  |egrep -v "^hugegraph" |sort > ~/current_dependencies.txt
+          cat ~/current_dependencies.txt
+      - name: check third dependencies
+        run: |
+          #by using commond join ,to check whether there are new third-party dependencies,compared with file(tool/dependencies/known-dependencies.txt) 

Review Comment:
   can we improve style and content of the comment:
   ```
   # check whether there are new third-party dependencies by join command,
   # diff generated 'current-dependencies.txt' file with 'known_dependencies.txt' file.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org