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
28 changes: 28 additions & 0 deletions .github/workflows/check-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: third-party dependencies check

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
env:
STATIC_DIR: hugegraph-loader/assembly/static
SCRIPT_DEPENDENCY: hugegraph-dist/scripts/dependency
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: |
bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt
- name: check third dependencies
run: |
bash $SCRIPT_DEPENDENCY/check_dependencies.sh
32 changes: 32 additions & 0 deletions hugegraph-dist/scripts/dependency/check_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/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.
#

BASE_PATH=$(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 < ${BASE_PATH}/known-dependencies.txt) \
<(sort < ${BASE_PATH}/current-dependencies.txt) > ${BASE_PATH}/result.txt

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