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: update scripts for validating HugeGraph 1.2.0 release #307

Merged
merged 16 commits into from
Dec 18, 2023
Merged
60 changes: 60 additions & 0 deletions .github/configs/settings.xml
Original file line number Diff line number Diff line change
@@ -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>
VGalaxies marked this conversation as resolved.
Show resolved Hide resolved
139 changes: 87 additions & 52 deletions .github/workflows/validate-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
release_version:
required: true
default: '1.0.0'
default: '1.2.0'
gpg_user:
required: true
default: 'imbajin'
Expand All @@ -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:
Expand All @@ -53,6 +54,11 @@ 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: |
Expand All @@ -63,23 +69,24 @@ jobs:
- name: 2. Check Environment & Import Public Keys
run: |
cd dist/${{ inputs.release_version }}

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 }}

for i in *.tar.gz; do
echo "$i"
shasum -a 512 --check "$i".sha512 || exit
Expand All @@ -88,17 +95,22 @@ jobs:

- name: 4. Validate Source Packages
run: |
cd dist/${{ inputs.release_version }} && ls -lh ./*.tar.gz
cd dist/${{ inputs.release_version }}

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
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
Expand All @@ -108,55 +120,60 @@ 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
grep -E "GPL|BCL|JSR-275|RSAL|QPL|SSPL|CPOL|NPL1.0|CC-BY" LICENSE NOTICE
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)
# 4.4 ensure doesn't contains empty directory or file
COUNT=$(find . -type f,d -empty | wc -l)
if [[ $COUNT -ne 0 ]]; then
find . -type d -empty
echo "The package shouldn't include empty directory, but get $COUNT" && exit 1
find . -type f,d -empty
echo "The package shouldn't include empty dir/file, 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)

# 4.5 ensure any file should less than 800kb & not include binary file
COUNT=$(find . -type f -size +800k | 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
find . -type f -size +800k
echo "The package shouldn't include file larger than 800kb, but get $COUNT" && exit 1
fi
COUNT=$(find . -type f | grep -v .txt | perl -lne 'print if -B' | wc -l)
COUNT=$(find . -type f | grep -Ev ".txt|logo.png|favicon.ico|yarn.lock" | 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)
find . -type f | perl -lne 'print if -B'
echo "The package shouldn't include binary file, but get $COUNT" && exit 1
fi
# 4.5 test compile the packages

# 4.6 test compile the packages
if [[ ${{ matrix.java_version }} == 8 && "$i" =~ "computer" ]]; then
cd .. && echo "skip computer module in java8"
continue
fi
mvn package -DskipTests -ntp -e || exit 1
ls -lh

cd .. || 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 }}

ls -lh
cd ./*hugegraph-incubating*src/hugegraph-server/*hugegraph*${{ inputs.release_version }} || exit
bin/init-store.sh || exit
sleep 1
bin/start-hugegraph.sh || exit
ls ../../../ && cd ../../../ || exit

- name: 6. Run Compiled Packages In ToolChain (Loader & Tool & Hubble)
run: |
cd dist/${{ inputs.release_version }}

cd ./*toolchain*src || exit
ls -lh
cd ./*toolchain*${{ inputs.release_version }} || exit
Expand All @@ -176,32 +193,45 @@ jobs:
bin/hugegraph task-list || exit
bin/hugegraph backup -t all --directory ./backup-test || exit
cd .. || 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
# TODO: add hubble doc & test it
cat conf/hugegraph-hubble.properties
bin/start-hubble.sh || exit
bin/stop-hubble.sh || exit
Comment on lines +209 to +210
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liuxiaocs7 @aroundabout could we add some basic curl check like curl localhost:8088/xxxAPI to ensure the hubble runs well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember that start_hubble.sh included the check:

apache/incubator-hugegraph-toolchain@773469c/hugegraph-hubble/hubble-dist/assembly/static/bin/start-hubble.sh#L83-L94

seems it only check server but not hubble itself (it's good to enhance the check in start-hubble later), currently we could check it in our script

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pengzna here can be improved in next PR~


cd ../../../ || exit
# kill the HugeGraphServer process by jps
jps | grep HugeGraphServer | awk '{print $1}' | xargs kill -9
rm -rf ./*src* && ls -lh

- name: 7. Validate Binary Packages
run: |
cd dist/${{ inputs.release_version }}

for i in *.tar.gz; do
if [[ "$i" == *-src.tar.gz ]]; then
# skip source package
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
tar xzvf "$i" || exit
cd "$(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
Expand All @@ -213,39 +243,42 @@ 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)

# 7.4 ensure doesn't contains empty directory or file
COUNT=$(find . -type f,d -empty | wc -l)
if [[ $COUNT -ne 0 ]]; then
find . -type d -empty
echo "The package shouldn't include empty directory, but get $COUNT" && exit 1
find . -type f,d -empty
echo "The package shouldn't include empty dir/file, but get $COUNT" && exit 1
fi

cd - || 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
bin/init-store.sh || exit
sleep 1
bin/start-hugegraph.sh || exit
ls ../ && cd ../ || 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
ls -lh

# 9.1 loader some data first
# 9.1 loader some data first
echo "test loader"
cd ./*loader*${{ inputs.release_version }} || exit
bin/hugegraph-loader.sh -f ./example/file/struct.json -s ./example/file/schema.groovy \
Expand All @@ -265,9 +298,11 @@ jobs:
cd ./*hubble*${{ inputs.release_version }} || exit
# TODO: add hubble doc & test it
cat conf/hugegraph-hubble.properties
bin/stop-hubble.sh && bin/start-hubble.sh
bin/start-hubble.sh || exit
bin/stop-hubble.sh || exit

cd - || exit
# TODO: need stop the server here
# kill the HugeGraphServer process by jps
jps | grep HugeGraphServer | awk '{print $1}' | xargs kill -9

strategy:
Expand Down
Loading