Skip to content

Commit 89a8f9b

Browse files
imbajincoderzc
andauthored
refact(core): adaptor for common 1.2 & fix a string of possible CI problem (#286)
* chore(ci): update common 1.2 & upgrade action version * replace HTTP_CODE * Update codeql-analysis.yml * Update pom.xml * use docker image for server * update webmockserver version to adapt okhttp4.x * remove useless client * Revert "remove useless client" This reverts commit 3e894d3. * chore: replace loading data with docker & fix AssertThrows * update loader image name * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * change path * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * fix name * Update load-data-into-hugegraph.sh * update ci logic * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * Update load-data-into-hugegraph.sh * Update WorkerServiceTest.java * update data path * refactor WorkerServer * update the WokerService init & close logic * Update MasterService.java * CI passed & revert the ignore * Update MessageRecvManagerTest.java * enable 3rd party check * Update license-checker.yml * Update computer-core/src/main/java/org/apache/hugegraph/computer/core/worker/WorkerService.java Co-authored-by: Cong Zhao <zhaocong@apache.org> * Update MasterService.java * tiny fix --------- Co-authored-by: Cong Zhao <zhaocong@apache.org>
1 parent e0b484a commit 89a8f9b

File tree

23 files changed

+615
-576
lines changed

23 files changed

+615
-576
lines changed

.github/configs/settings.xml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
18+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
21+
<servers>
22+
<server>
23+
<id>github</id>
24+
<username>${env.GITHUB_ACTOR}</username>
25+
<password>${env.GITHUB_TOKEN}</password>
26+
</server>
27+
</servers>
28+
29+
<profiles>
30+
<profile>
31+
<id>local-repo</id>
32+
<repositories>
33+
<repository>
34+
<id>central</id>
35+
<url>https://repo.maven.apache.org/maven2</url>
36+
<releases>
37+
<enabled>true</enabled>
38+
</releases>
39+
<snapshots>
40+
<enabled>false</enabled>
41+
</snapshots>
42+
</repository>
43+
<repository>
44+
<id>staged-releases</id>
45+
<url>https://repository.apache.org/content/groups/staging/</url>
46+
</repository>
47+
</repositories>
48+
<pluginRepositories>
49+
<pluginRepository>
50+
<id>staged-releases</id>
51+
<url>https://repository.apache.org/content/groups/staging/</url>
52+
</pluginRepository>
53+
</pluginRepositories>
54+
</profile>
55+
</profiles>
56+
57+
<activeProfiles>
58+
<activeProfile>local-repo</activeProfile>
59+
</activeProfiles>
60+
</settings>

.github/workflows/ci.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ jobs:
1111
computer-ci:
1212
runs-on: ubuntu-latest
1313
env:
14+
USE_STAGE: 'true' # Whether to include the stage repository.
1415
TRAVIS_DIR: computer-dist/src/assembly/travis
1516
KUBERNETES_VERSION: 1.20.1
16-
HUGEGRAPH_SERVER_COMMIT_ID: d01c8737d7d5909119671953521f1401dcd1a188
1717
BSP_ETCD_URL: http://localhost:2579
18+
# TODO: delete this env in the future (replaced by docker way now)
19+
HUGEGRAPH_SERVER_COMMIT_ID: d01c8737d7d5909119671953521f1401dcd1a188
1820

1921
steps:
2022
- name: Checkout
21-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2224
with:
2325
fetch-depth: 2
2426

@@ -57,33 +59,38 @@ jobs:
5759
- name: Setup Minikube-Kubernetes
5860
run: $TRAVIS_DIR/install-k8s.sh
5961

60-
- name: Check Component
61-
run: |
62-
sleep 5
63-
curl localhost:9000
64-
kubectl get nodes
65-
6662
- name: Cache Maven packages
6763
uses: actions/cache@v3
6864
with:
6965
path: ~/.m2
7066
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
7167
restore-keys: ${{ runner.os }}-m2
7268

69+
- name: Check Component
70+
run: |
71+
curl localhost:9000
72+
kubectl get nodes
73+
7374
- name: Prepare env and service
7475
run: |
7576
$TRAVIS_DIR/install-env.sh
76-
$TRAVIS_DIR/install-hugegraph-from-source.sh $HUGEGRAPH_SERVER_COMMIT_ID
7777
$TRAVIS_DIR/load-data-into-hugegraph.sh
78+
#$TRAVIS_DIR/install-hugegraph-from-source.sh $HUGEGRAPH_SERVER_COMMIT_ID
7879
7980
- name: Install JDK 11
8081
uses: actions/setup-java@v3
8182
with:
8283
java-version: '11'
8384
distribution: 'zulu'
8485

86+
- name: Use staged maven repo
87+
if: ${{ env.USE_STAGE == 'true' }}
88+
run: |
89+
cp $HOME/.m2/settings.xml /tmp/settings.xml
90+
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
91+
8592
- name: Compile
86-
run: mvn clean compile -Dmaven.javadoc.skip=true -ntp
93+
run: mvn clean compile -e -Dmaven.javadoc.skip=true -ntp
8794

8895
- name: Integrate test
8996
run: mvn test -P integrate-test -ntp
@@ -92,6 +99,7 @@ jobs:
9299
run: mvn test -P unit-test -ntp
93100

94101
- name: Upload coverage to Codecov
95-
uses: codecov/codecov-action@v3.0.0
102+
uses: codecov/codecov-action@v3
96103
with:
104+
token: ${{ secrets.CODECOV_TOKEN }}
97105
file: target/site/jacoco/jacoco.xml

.github/workflows/codeql-analysis.yml

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ name: "CodeQL"
44

55
on:
66
pull_request:
7-
# The branches below must be a subset of the branches above, now enable it in all PR
8-
# branches: [ master ]
7+
# The branches below must be a subset of the branches above, now enable it in all PR
8+
# branches: [ master ]
99
schedule:
1010
- cron: '45 7 * * 1'
1111

1212
jobs:
1313
analyze:
14+
env:
15+
USE_STAGE: 'true' # Whether to include the stage repository.
1416
name: Analyze
1517
runs-on: ubuntu-latest
1618
permissions:
@@ -24,43 +26,55 @@ jobs:
2426
language: [ 'go', 'java' ]
2527

2628
steps:
27-
- name: Checkout repository
28-
uses: actions/checkout@v3
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
2931

30-
# Initializes the CodeQL tools for scanning.
31-
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v2
33-
with:
34-
languages: ${{ matrix.language }}
35-
# If you wish to specify custom queries, you can do so here or in a config file.
36-
# By default, queries listed here will override any specified in a config file.
37-
# Prefix the list here with "+" to use these queries and those in the config file.
38-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
32+
- name: Setup Java JDK
33+
uses: actions/setup-java@v3
34+
with:
35+
distribution: 'zulu'
36+
java-version: '11'
3937

40-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
41-
# If this step fails, then you should remove it and run the build manually (see below)
42-
- name: Autobuild
43-
uses: github/codeql-action/autobuild@v2
38+
- name: use staged maven repo settings
39+
if: ${{ env.USE_STAGE == 'true' }}
40+
run: |
41+
cp $HOME/.m2/settings.xml /tmp/settings.xml
42+
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
4443
45-
# ℹ️ Command-line programs to run using the OS shell.
46-
# 📚 https://git.io/JvXDl
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v2
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
4753

48-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
49-
# and modify them (or add more) to build your code if your project
50-
# uses a compiled language
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v2
5158

52-
#- run: |
53-
# make bootstrap
54-
# make release
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
5561

56-
- name: Perform CodeQL Analysis
57-
uses: github/codeql-action/analyze@v2
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
65+
66+
#- run: |
67+
# make bootstrap
68+
# make release
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v2
5872

5973
dependency-review:
6074
runs-on: ubuntu-latest
6175
steps:
6276
- name: 'Checkout Repository'
63-
uses: actions/checkout@v3
77+
uses: actions/checkout@v4
6478
- name: 'Dependency Review'
6579
uses: actions/dependency-review-action@v3
6680

.github/workflows/license-checker.yml

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
check-license-header:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
# More info could refer to: https://github.com/apache/skywalking-eyes
2020
- name: Check License Header
2121
uses: apache/skywalking-eyes@main
@@ -36,25 +36,29 @@ jobs:
3636
find ./ -name rat.txt -print0 | xargs -0 -I file cat file > merged-rat.txt
3737
grep "Binaries" merged-rat.txt -C 3 && cat merged-rat.txt
3838
39-
# TODO: enable it later
40-
# check-dependency-license:
41-
# runs-on: ubuntu-latest
42-
# env:
43-
# SCRIPT_DEPENDENCY: computer-dist/scripts/dependency
44-
# steps:
45-
# - name: Checkout source
46-
# uses: actions/checkout@v3
47-
# - name: Set up JDK 11
48-
# uses: actions/setup-java@v3
49-
# with:
50-
# java-version: '11'
51-
# distribution: 'adopt'
52-
# - name: mvn install
53-
# run: |
54-
# mvn install -DskipTests=true -ntp
55-
# - name: generate current dependencies
56-
# run: |
57-
# bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt
58-
# - name: check third dependencies
59-
# run: |
60-
# bash $SCRIPT_DEPENDENCY/check_dependencies.sh
39+
check-dependency-license:
40+
runs-on: ubuntu-latest
41+
env:
42+
SCRIPT_DEPENDENCY: computer-dist/scripts/dependency
43+
USE_STAGE: 'true' # Whether to include the stage repository.
44+
steps:
45+
- name: Checkout source
46+
uses: actions/checkout@v4
47+
- name: Set up JDK 11
48+
uses: actions/setup-java@v3
49+
with:
50+
java-version: '11'
51+
distribution: 'adopt'
52+
- name: Use staged maven repo settings
53+
if: ${{ env.USE_STAGE == 'true' }}
54+
run: |
55+
cp $HOME/.m2/settings.xml /tmp/settings.xml
56+
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
57+
- name: Compile install
58+
run: mvn package -DskipTests=true -ntp
59+
60+
# TODO: enable it after the check scripts are ready, lack them now
61+
#- name: Generate & check current 3rd-party dependencies
62+
# run: |
63+
# bash $SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh current-dependencies.txt
64+
# bash $SCRIPT_DEPENDENCY/check_dependencies.sh

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
pull-requests: write
1414

1515
steps:
16-
- uses: actions/stale@v3
16+
- uses: actions/stale@v8
1717
with:
1818
repo-token: ${{ secrets.GITHUB_TOKEN }}
1919
stale-issue-message: 'Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label'

checkstyle.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
<module name="TreeWalker">
3636
<!--检查行长度-->
3737
<module name="LineLength">
38-
<property name="max" value="100"/>
38+
<!-- Use 101 due to some legacy code reason -->
39+
<property name="max" value="101"/>
3940
<!--可以忽略的行-->
4041
<property name="ignorePattern"
4142
value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
@@ -84,7 +85,8 @@
8485
<module name="WhitespaceAround"/>
8586
<!--左圆括号之后和右圆括号之前是否需要有一个空格,不需要-->
8687
<module name="ParenPad"/>
87-
<!--检查修饰符是否符合Java建议,顺序是:public、protected、private、abstract、default、static、final、transient、volatile、synchronized、native、strictfp-->
88+
<!--检查修饰符是否符合Java建议,顺序是:public、protected、private、abstract、default、static、
89+
final、transient、volatile、synchronized、native、strictfp-->
8890
<module name="ModifierOrder"/>
8991
<!--检查代码块的左花括号的放置位置,必须在当前行的末尾-->
9092
<module name="LeftCurly">

computer-api/src/main/java/org/apache/hugegraph/computer/core/common/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public final class Constants {
5959
public static final int FUTURE_TIMEOUT = 300;
6060

6161
/*
62-
* The timeout in millisecond for threadpool shutdown
62+
* The timeout in millisecond for thread-pool shutdown
6363
*/
6464
public static final long SHUTDOWN_TIMEOUT = 5000L;
6565

0 commit comments

Comments
 (0)