-
Notifications
You must be signed in to change notification settings - Fork 99
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
validate release actions support mulit os #197
Merged
imbajin
merged 24 commits into
apache:master
from
z7658329:feat/validate_support_mulit_os
Apr 7, 2023
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
7e03336
use latest validate-release.yml
z7658329 51c5372
runs on ubuntu windows macos
z7658329 b83bfa3
runs on ubuntu windows macos
z7658329 ed1c1b6
add jdk version in name
z7658329 388c311
rm windows
z7658329 d157a30
adjust jdk version
z7658329 6a58e1a
try add centos
z7658329 8049322
add centos7
z7658329 be7b948
add todo
z7658329 f3841f2
update validate-release.yml
z7658329 28bceba
update validate-release.yml
z7658329 3b48708
Update validate-release.yml
imbajin 3bdddeb
Update validate-release.yml
imbajin 08ff276
stop server after test
z7658329 36678b6
exit if stop server fail
z7658329 ed900cf
update validate-release.yml
z7658329 0d5eb38
add test log
z7658329 df3487c
add test log
z7658329 63a0cf2
stop server after test
z7658329 220852f
fix actions exec fail
z7658329 ab015c0
update validate-release.yml
z7658329 b0e525d
fix exclude txt
z7658329 5d8b810
fix exclude txt
z7658329 12908a1
add validate-release.sh
z7658329 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ on: | |
release_version: | ||
required: true | ||
default: '1.0.0' | ||
gpg_user: | ||
required: true | ||
default: 'imbajin' | ||
|
||
push: | ||
branches: | ||
|
@@ -16,11 +19,12 @@ on: | |
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: "Build On ${{ matrix.os }} (java-${{ matrix.java_version }})" | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
SCRIPT_PATH: hugegraph-dist/scripts/ | ||
URL_PREFIX: https://dist.apache.org/repos/dist/dev/incubator/hugegraph/ | ||
USER: 'imbajin' | ||
USER: ${{ inputs.gpg_user }} | ||
# TODO: parse version from the running branch name & also adapt the input version | ||
RELEASE_VERSION: '' | ||
steps: | ||
|
@@ -89,7 +93,7 @@ jobs: | |
echo "$i" | ||
# 4.0 check the directory name include "incubating" | ||
if [[ ! "$i" =~ "incubating" ]]; then | ||
echo "The package name should include incubating" && exit 1 | ||
echo "The package name $i should include incubating" && exit 1 | ||
fi | ||
tar xzvf "$i" || exit | ||
cd "$(basename "$i" .tar.gz)" || exit | ||
|
@@ -104,32 +108,41 @@ 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 | ||
# 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.2 ensure doesn't contains empty directory or file | ||
# 4.3 ensure doesn't contains empty directory or file | ||
COUNT=$(find . -type d -empty | wc -l) | ||
if [[ $COUNT -ne 0 ]]; then | ||
find . -type d -empty | ||
echo "The package shouldn't include empty directory, but get $COUNT" # TODO: && exit 1 | ||
echo "The package shouldn't include empty directory, but get $COUNT" && exit 1 | ||
fi | ||
|
||
# 4.3 ensure any file should less than 900kb & not include binary file | ||
# 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" | ||
echo "The package 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) | ||
COUNT=$(find . -type f | grep -v .txt | perl -lne 'print if -B' | wc -l) | ||
if [[ $COUNT -ne 0 ]]; then | ||
find . -type f | perl -lne 'print if -B' | ||
echo "The package shouldn't include binary file, but get $COUNT" | ||
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.4 test compile the packages | ||
if [[ $JAVA_VERSION == 8 && "$i" =~ "computer" ]]; then | ||
# 4.5 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 && ls -lh | ||
mvn package -DskipTests -ntp -e || exit 1 | ||
ls -lh | ||
cd .. || exit | ||
done | ||
|
||
|
@@ -168,6 +181,8 @@ jobs: | |
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 | ||
|
||
|
@@ -178,30 +193,39 @@ jobs: | |
echo "$i" | ||
# 7.0 check the directory name include "incubating" | ||
if [[ ! "$i" =~ "incubating" ]]; then | ||
echo "The package name should include incubating" && exit 1 | ||
echo "The package name $i should include incubating" && exit 1 | ||
fi | ||
tar xzvf "$i" || exit | ||
|
||
# 7.1 check root dir include "NOTICE"/"LICENSE"/"DISCLAIMER" files & "release-docs" dir | ||
cd "$(basename "$i" .tar.gz)" && ls -lh || exit | ||
# 7.1 check root dir include "NOTICE"/"LICENSE"/"DISCLAIMER" & "licenses" dir | ||
cd "$(basename "$i" .tar.gz)" || exit | ||
ls -lh | ||
if [[ ! -f "LICENSE" ]]; then | ||
echo "The package should include LICENSE file" && exit 1 | ||
echo "The package should include LICENSE file" && ls -lh && exit 1 | ||
fi | ||
if [[ ! -f "NOTICE" ]]; then | ||
echo "The package should include NOTICE file" && exit 1 | ||
fi | ||
if [[ ! -f "DISCLAIMER" ]]; then | ||
echo "The package should include DISCLAIMER file" && exit 1 | ||
fi | ||
if [[ ! -d "release-docs" ]]; then | ||
echo "The package should include release-docs dir" && exit 1 | ||
if [[ ! -d "licenses" ]]; then | ||
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 | ||
# 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 shouldn't include GPL* invalid dependency, but get $COUNT" && exit 1 | ||
fi | ||
|
||
# 7.2 ensure doesn't contains empty directory or file | ||
# 7.3 ensure doesn't contains empty directory or file | ||
COUNT=$(find . -type d -empty | wc -l) | ||
if [[ $COUNT -ne 0 ]]; then | ||
find . -type d -empty | ||
echo "The package shouldn't include empty directory, but get $COUNT" # TODO: && exit 1 | ||
echo "The package shouldn't include empty directory, but get $COUNT" && exit 1 | ||
fi | ||
|
||
cd - || exit | ||
|
@@ -212,8 +236,6 @@ jobs: | |
cd dist/${{ inputs.release_version }} | ||
cd ./*hugegraph-incubating*${{ inputs.release_version }} || exit | ||
bin/init-store.sh && sleep 1 | ||
# kill the HugeGraphServer process by jps | ||
jps | grep HugeGraphServer | awk '{print $1}' | xargs kill -9 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we must stop the old one, otherwise can't start the new one |
||
bin/start-hugegraph.sh && ls ../ | ||
cd - || exit | ||
|
||
|
@@ -245,8 +267,12 @@ jobs: | |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sleep a while before the stop, like 60s? |
||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
java_version: [ '8','11' ] | ||
# TODO: support windows-latest or other OS in future | ||
os: [ubuntu-latest, macos-latest] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
#!/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. | ||
# | ||
# This script is used to validate the release package, including: | ||
# 1. Check the release package name & content | ||
# 2. Check the release package sha512 & gpg signature | ||
# 3. Compile the source package & run server & toolchain | ||
# 4. Run server & toolchain in binary package | ||
|
||
URL_PREFIX="https://dist.apache.org/repos/dist/dev/incubator/hugegraph/" | ||
# release version (input by committer) | ||
RELEASE_VERSION=$1 | ||
JAVA_VERSION=$2 | ||
USER=$3 | ||
# git release branch (check it carefully) | ||
#GIT_BRANCH="release-${RELEASE_VERSION}" | ||
|
||
RELEASE_VERSION=${RELEASE_VERSION:?"Please input the release version behind script"} | ||
|
||
# step1: download svn files | ||
rm -rf dist/"$RELEASE_VERSION" && svn co ${URL_PREFIX}/"$RELEASE_VERSION" dist/"$RELEASE_VERSION" | ||
cd 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 | ||
# 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 | ||
echo -e "5\ny\n" | gpg --batch --command-fd 0 --edit-key "$key" trust | ||
done | ||
|
||
# step3: check sha512 & gpg signature | ||
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 | ||
ls -lh ./*.tar.gz | ||
for i in *src.tar.gz; do | ||
echo "$i" | ||
#### step4.0: 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 | ||
|
||
#### step4.1: 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 | ||
if [[ ! -f "NOTICE" ]]; then | ||
echo "The package $i should include NOTICE file" && exit 1 | ||
fi | ||
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 | ||
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 | ||
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 | ||
|
||
#### step4.5: test compile the packages | ||
if [[ $JAVA_VERSION == 8 && "$i" =~ "computer" ]]; then | ||
cd .. && echo "skip computer module in java8" | ||
continue | ||
fi | ||
mvn package -DskipTests -ntp && ls -lh | ||
cd .. || exit | ||
done | ||
|
||
#### step5: run the compiled packages in server | ||
ls -lh | ||
cd ./*hugegraph-incubating*src/*hugegraph*"${RELEASE_VERSION}" || exit | ||
bin/init-store.sh && sleep 1 | ||
bin/start-hugegraph.sh && ls ../../ | ||
cd ../../ || exit | ||
|
||
#### step6: run the compiled packages in toolchain (include loader/tool/hubble) | ||
cd ./*toolchain*src || exit | ||
ls -lh | ||
cd ./*toolchain*"${RELEASE_VERSION}" || exit | ||
ls -lh | ||
|
||
##### step6.1: test loader | ||
cd ./*loader*"${RELEASE_VERSION}" || exit | ||
bin/hugegraph-loader.sh -f ./example/file/struct.json -s ./example/file/schema.groovy \ | ||
-g hugegraph || exit | ||
cd .. || exit | ||
|
||
##### step6.2: test tool | ||
cd ./*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 | ||
|
||
##### step6.3: test hubble | ||
cd ./*hubble*"${RELEASE_VERSION}" || exit | ||
# TODO: add hubble doc & test it | ||
cat conf/hugegraph-hubble.properties && bin/start-hubble.sh | ||
cd ../../../ || exit | ||
|
||
# step7: validate the binary packages | ||
rm -rf ./*src* && ls -lh | ||
for i in *.tar.gz; do | ||
echo "$i" | ||
#### step7.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 | ||
|
||
#### step7.2: check root dir include "NOTICE"/"LICENSE"/"DISCLAIMER" files & "licenses" dir | ||
cd "$(basename "$i" .tar.gz)" && ls -lh || exit | ||
if [[ ! -f "LICENSE" ]]; then | ||
echo "The package $i should include LICENSE file" && exit 1 | ||
fi | ||
if [[ ! -f "NOTICE" ]]; then | ||
echo "The package $i should include NOTICE file" && exit 1 | ||
fi | ||
if [[ ! -f "DISCLAIMER" ]]; then | ||
echo "The package $i should include DISCLAIMER file" && exit 1 | ||
fi | ||
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 | ||
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 | ||
find . -type d -empty | ||
echo "The package $i should not include empty directory, but get $COUNT" # TODO: && exit 1 | ||
fi | ||
cd - || 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 | ||
|
||
#### step9: running toolchain | ||
cd ./*toolchain*"${RELEASE_VERSION}" || exit | ||
ls -lh | ||
##### step9.1: test loader | ||
cd ./*loader*"${RELEASE_VERSION}" || exit | ||
bin/hugegraph-loader.sh -f ./example/file/struct.json -s ./example/file/schema.groovy \ | ||
-g hugegraph || exit | ||
cd - || exit | ||
|
||
##### step9.2: test tool | ||
cd ./*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 | ||
|
||
##### step9.3: test hubble | ||
cd ./*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 | ||
|
||
echo "Finish validate, please check all steps manually again!" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also add
# kill the HugeGraphServer process by jps
at line 154There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems should stop server after toolchain test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's difficult to find a time to stop, we can close the old one before starting server.