diff --git a/.github/workflows/cla.yml b/.github/outdated/cla.yml similarity index 100% rename from .github/workflows/cla.yml rename to .github/outdated/cla.yml diff --git a/.github/workflows/dependabot.yml b/.github/outdated/dependabot.yml similarity index 100% rename from .github/workflows/dependabot.yml rename to .github/outdated/dependabot.yml diff --git a/.github/workflows/hugo.yml b/.github/workflows/hugo.yml index e20397936..3be781d85 100644 --- a/.github/workflows/hugo.yml +++ b/.github/workflows/hugo.yml @@ -14,7 +14,7 @@ # limitations under the License. # Sample workflow for building and deploying a Hugo site to GitHub Pages -name: Deploy site to pages (hugo) +name: "Deploy site to pages (hugo)" on: pull_request: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 1813bd3cb..8036e3b0a 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,4 +1,4 @@ -name: Mark stale issues and pull requests +name: "Mark stale issues and pull requests" on: schedule: diff --git a/.github/workflows/validate-release.yml b/.github/workflows/validate-release.yml new file mode 100644 index 000000000..3c47cd85b --- /dev/null +++ b/.github/workflows/validate-release.yml @@ -0,0 +1,252 @@ +name: "Validate Apache Release" + +on: + workflow_dispatch: + inputs: + release_version: + required: true + default: '1.0.0' + + push: + branches: + - 'release-*' + pull_request: + branches: + - 'release-*' + +jobs: + build: + runs-on: ubuntu-latest + env: + SCRIPT_PATH: hugegraph-dist/scripts/ + URL_PREFIX: https://dist.apache.org/repos/dist/dev/incubator/hugegraph/ + USER: 'imbajin' + # TODO: parse version from the running branch name & also adapt the input version + RELEASE_VERSION: '' + steps: + - name: Checkout source + uses: actions/checkout@v3 + - name: Install JDK ${{ matrix.java_version }} + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java_version }} + distribution: 'adopt' + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Get Yarn path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Cache Yarn packages + uses: actions/cache@v3 + # use id to check `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: 1. Download SVN Sources + run: | + rm -rf dist/${{ inputs.release_version }} + svn co ${URL_PREFIX}/${{ inputs.release_version }} dist/${{ inputs.release_version }} + cd dist/${{ inputs.release_version }} || exit + + - 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 + + 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 + + - 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 + eval gpg "${GPG_OPT}" --verify "$i".asc "$i" || exit + done + + - name: 4. Validate Source Packages + run: | + 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" + if [[ ! "$i" =~ "incubating" ]]; then + echo "The package name should include incubating" && exit 1 + fi + tar xzvf "$i" || exit + cd "$(basename "$i" .tar.gz)" || exit + + # 4.1 check the directory include "NOTICE" and "LICENSE" and "DISCLAIMER" file + if [[ ! -f "LICENSE" ]]; then + echo "The package should include LICENSE file" && 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 + + # 4.2 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 should not include empty directory, but get $COUNT" # TODO: && exit 1 + fi + + # 4.3 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 should not include file larger than 900kb, but get $COUNT" + fi + COUNT=$(find . -type f | perl -lne 'print if -B' | wc -l) + if [[ $COUNT -ne 0 ]]; then + find . -type f | perl -lne 'print if -B' + echo "The package should not include binary file, but get $COUNT" + fi + + # 4.4 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 + + - 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 + + - 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 + ls -lh + + # 6.1 load 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 \ + -g hugegraph || exit + cd .. || exit + + # 6.2 try some gremlin query & api in tool + echo "test tool" + cd ./*tool*${{ inputs.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 + + # 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 + cd ../../../ || exit + rm -rf ./*src* && ls -lh + + - name: 7. Validate Binary Packages + run: | + cd dist/${{ inputs.release_version }} + for i in *.tar.gz; do + echo "$i" + # 7.0 check the directory name include "incubating" + if [[ ! "$i" =~ "incubating" ]]; then + echo "The package name 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 + if [[ ! -f "LICENSE" ]]; then + echo "The package should include LICENSE file" && 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 + fi + + # 7.2 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 + fi + + cd - || exit + done + + - name: 8. Validate Binary Packages(Start Server) + run: | + 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 + bin/start-hugegraph.sh && ls ../ + cd - || exit + + - name: 9. Validate Binary Packages(Start ToolChain(Loader/Tool/Hubble)) + run: | + cd dist/${{ inputs.release_version }} + cd ./*toolchain*${{ inputs.release_version }} || exit + ls -lh + + # 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 \ + -g hugegraph || exit + cd - || exit + + # 9.2 try some gremlin query & api in tool + echo "test tool" + cd ./*tool*${{ inputs.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 + + # 9.3 start hubble and connect to server + echo "test hubble" + 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 + cd - || exit + + strategy: + fail-fast: false + matrix: + java_version: [ '8','11' ]