Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add third-party dependencies check #336

Merged
merged 23 commits into from
Nov 4, 2022
Merged
29 changes: 29 additions & 0 deletions .github/workflows/check-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
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 -DskipTests=true
- name: generate current dependencies
run: |
mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=${{ github.workspace }}/current_dependencies
simon824 marked this conversation as resolved.
Show resolved Hide resolved
ls ${{ github.workspace }}/current_dependencies |egrep -v "^hugegraph|hubble" |sort > ${{ github.workspace }}/tool/dependencies/current-dependencies.txt
simon824 marked this conversation as resolved.
Show resolved Hide resolved
cat ${{ github.workspace }}/tool/dependencies/current-dependencies.txt
- name: check third dependencies
run: |
bash ${{ github.workspace }}/tool/dependencies/check_dependencies.sh
32 changes: 32 additions & 0 deletions tool/dependencies/check_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
simon824 marked this conversation as resolved.
Show resolved Hide resolved
#
# 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)

# check whether there are new third-party dependencies by diff command,
# diff generated 'current-dependencies.txt' file with 'known-dependencies.txt' file.
diff -w -B -U0 <(sort < ${basepath}/known-dependencies.txt) \
<(sort < ${basepath}/current-dependencies.txt) > ${basepath}/result.txt

# if has new third-party,the Action will fail and print diff
if [ -s ${basepath}/result.txt ]; then
cat ${basepath}/result.txt
exit 1
else
echo 'All third dependencies is known!'
fi
Loading