Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/actions/get-hugegraph-commit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Get HugeGraph stable commit id'
description: 'Fetch the latest HugeGraph release commit SHA and expose it as output and env variable'

outputs:
commit_id:
description: 'The commit SHA of the latest HugeGraph release'
value: ${{ steps.get-commit.outputs.commit_id }}

runs:
using: composite
steps:
- name: Get HugeGraph stable commit id
id: get-commit
uses: actions/github-script@v7
with:
script: |
const owner = 'apache';
const repo = 'hugegraph';
try {
const { data: release } = await github.rest.repos.getLatestRelease({ owner, repo });
const tagName = release.tag_name;
const { data: ref } = await github.rest.git.getRef({
owner, repo, ref: `tags/${tagName}`
});
let sha = ref.object.sha;
if (ref.object.type === 'tag') {
const { data: tag } = await github.rest.git.getTag({ owner, repo, tag_sha: sha });
sha = tag.object.sha;
} else if (ref.object.type !== 'commit') {
throw new Error(`Unexpected ref type: ${ref.object.type}`);
}
core.exportVariable('COMMIT_ID', sha);
core.setOutput('commit_id', sha);
console.log(`Using HugeGraph release ${tagName} (${sha})`);
} catch (error) {
core.setFailed(`Failed to get HugeGraph commit: ${error.message}`);
}
18 changes: 18 additions & 0 deletions .github/actions/setup-hugegraph-server/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Setup HugeGraph Server'
description: 'Prepare environment and install HugeGraph server from source'

inputs:
travis-dir:
description: 'Path to the Travis assembly directory containing install scripts'
required: true
commit-id:
description: 'HugeGraph commit SHA to install'
required: true

runs:
using: composite
steps:
- name: Prepare env and service
shell: bash
run: |
${{ inputs.travis-dir }}/install-hugegraph-from-source.sh ${{ inputs.commit-id }}
33 changes: 33 additions & 0 deletions .github/actions/setup-java-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Setup Java and Maven Environment'
description: 'Install JDK, cache Maven packages, and optionally apply staged Maven repository settings'

inputs:
java-version:
description: 'Java version to install'
required: false
default: '11'
distribution:
description: 'JDK distribution'
required: false
default: 'zulu'
use-stage:
description: 'Whether to apply staged Maven repository settings'
required: false
default: 'true'

runs:
using: composite
steps:
- name: Install JDK ${{ inputs.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.java-version }}
distribution: ${{ inputs.distribution }}
cache: 'maven'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ Redundant double Maven cache

actions/setup-java@v4 with cache: 'maven' already saves/restores ~/.m2/repository internally using a setup-java-namespaced key. The explicit Cache Maven packages step below (lines 28-33) targets the same directory with a different key, so every job saves two separate cache entries for identical content.

For workflows that previously had only one cache mechanism (tools-ci, spark-connector-ci, client-go-ci, loader-ci), this PR silently doubles the cache storage and upload time.

Remove either:

  • the cache: 'maven' line here, keeping the explicit step below, OR
  • the entire - name: Cache Maven packages block (lines 28-33), relying solely on setup-java's built-in caching.

Both approaches work; the latter is less YAML and the recommended pattern for setup-java@v4.


- name: Use staged maven repo settings
if: ${{ inputs.use-stage == 'true' }}
shell: bash
run: |
cp $HOME/.m2/settings.xml /tmp/settings.xml
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
20 changes: 20 additions & 0 deletions .github/actions/upload-coverage/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Upload Coverage to Codecov'
description: 'Upload test coverage report to Codecov'

inputs:
token:
description: 'Codecov upload token'
required: true
file:
description: 'Path to the coverage report file'
required: false
default: 'target/jacoco.xml'

runs:
using: composite
steps:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ inputs.token }}
file: ${{ inputs.file }}
44 changes: 12 additions & 32 deletions .github/workflows/client-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
env:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-client/assembly/travis
# TODO: replace it with the (latest - n) commit id (n >= 15)
# hugegraph commit date: 2025-11-4
COMMIT_ID: b7998c1
strategy:
fail-fast: false
matrix:
Expand All @@ -39,39 +36,22 @@ jobs:
with:
fetch-depth: 2

# TODO: do we need it? (need test)
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: Install JDK 11 for graph server
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'
cache: 'maven'
- name: Get HugeGraph stable commit id
id: get-commit
uses: ./.github/actions/get-hugegraph-commit

- name: Prepare env and service
run: |
# TODO(@Thespica): test both servers of supporting gs and not supporting gs
# when the server supports gs
$TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID

- name: Install Java ${{ matrix.JAVA_VERSION }} for client
uses: actions/setup-java@v4
- name: Setup Java environment
uses: ./.github/actions/setup-java-env
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'zulu'
cache: 'maven'
use-stage: ${{ env.USE_STAGE }}

- name: Use staged maven repo
if: ${{ env.USE_STAGE == 'true' }}
run: |
cp $HOME/.m2/settings.xml /tmp/settings.xml
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
- name: Setup HugeGraph server
uses: ./.github/actions/setup-hugegraph-server
with:
travis-dir: ${{ env.TRAVIS_DIR }}
commit-id: ${{ steps.get-commit.outputs.commit_id }}

- name: Compile
run: |
Expand All @@ -85,7 +65,7 @@ jobs:
mvn test -Dtest=FuncTestSuite

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: ./.github/actions/upload-coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/jacoco.xml
38 changes: 15 additions & 23 deletions .github/workflows/client-go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
env:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-client/assembly/travis
# TODO: replace it with the (latest - n) commit id (n >= 15)
# FIXME: hugegraph commit date: 2025-10-30
COMMIT_ID: 8c1ee71 # 5b3d295
strategy:
fail-fast: false
matrix:
Expand All @@ -37,36 +34,31 @@ jobs:
with:
fetch-depth: 2

- name: Install JDK 11
uses: actions/setup-java@v3
- name: Get HugeGraph stable commit id
id: get-commit
uses: ./.github/actions/get-hugegraph-commit

- name: Setup Java environment
uses: ./.github/actions/setup-java-env
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'zulu'
use-stage: ${{ env.USE_STAGE }}

- name: Cache Maven packages
uses: actions/cache@v3
- name: Setup HugeGraph server
uses: ./.github/actions/setup-hugegraph-server
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Use staged maven repo
if: ${{ env.USE_STAGE == 'true' }}
run: |
cp $HOME/.m2/settings.xml /tmp/settings.xml
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml

- name: Prepare env and service
run: |
$TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID
travis-dir: ${{ env.TRAVIS_DIR }}
commit-id: ${{ steps.get-commit.outputs.commit_id }}

- name: Init Go env
uses: actions/setup-go@v2.1.3
with: {go-version: '1.x'}
uses: actions/setup-go@v5
with:
go-version: '1.x'

- name: Go test
run: |
go version
go version
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
Expand Down
32 changes: 10 additions & 22 deletions .github/workflows/hubble-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ on:

env:
TRAVIS_DIR: hugegraph-hubble/hubble-dist/assembly/travis
# TODO: replace it with the (latest - n) commit id (n >= 15)
# FIXME: hugegraph commit date: 2025-10-30
COMMIT_ID: 8c1ee71 # 5b3d295

jobs:
hubble-ci:
Expand All @@ -44,42 +41,33 @@ jobs:
with:
fetch-depth: 2

- name: Install JDK 11
uses: actions/setup-java@v3
- name: Get HugeGraph stable commit id
id: get-commit
uses: ./.github/actions/get-hugegraph-commit
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ Same implicit $COMMIT_ID issue as loader-ci

The Prepare env and service step later in this file calls:

$TRAVIS_DIR/install-hugegraph.sh $COMMIT_ID

steps.get-commit.outputs.commit_id is never referenced by name anywhere in this file — it only works via the core.exportVariable side-effect. Make the dependency explicit:

- name: Prepare env and service
  env:
    COMMIT_ID: ${{ steps.get-commit.outputs.commit_id }}
  run: |
    ...
    $TRAVIS_DIR/install-hugegraph.sh $COMMIT_ID


- name: Setup Java environment
uses: ./.github/actions/setup-java-env
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'adopt'
use-stage: ${{ env.USE_STAGE }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

# we also should cache python & yarn & downloads to avoid useless work
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: use staged maven repo settings
if: ${{ env.USE_STAGE == 'true' }}
run: |
cp $HOME/.m2/settings.xml /tmp/settings.xml
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml

- name: Compile
run: |
mvn install -pl hugegraph-client,hugegraph-loader -am -Dmaven.javadoc.skip=true -DskipTests -ntp
cd hugegraph-hubble && ls *
mvn -e compile -Dmaven.javadoc.skip=true -ntp

- name: Prepare env and service
env:
COMMIT_ID: ${{ steps.get-commit.outputs.commit_id }}
run: |

python -m pip install -r ${TRAVIS_DIR}/requirements.txt
cd hugegraph-hubble
mvn package -Dmaven.test.skip=true
Expand All @@ -102,7 +90,7 @@ jobs:
hubble-dist/assembly/travis/run-api-test.sh

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: ./.github/actions/upload-coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/site/jacoco/*.xml
33 changes: 12 additions & 21 deletions .github/workflows/loader-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ jobs:
USE_STAGE: 'true' # Whether to include the stage repository.
TRAVIS_DIR: hugegraph-loader/assembly/travis
STATIC_DIR: hugegraph-loader/assembly/static
# TODO: replace it with the (latest - n) commit id (n >= 15)
# hugegraph commit date: 2025-10-30
COMMIT_ID: 5b3d295
DB_USER: root
DB_PASS: root
DB_DATABASE: load_test
Expand All @@ -50,18 +47,16 @@ jobs:
with:
fetch-depth: 2

- name: Install JDK 11
uses: actions/setup-java@v4
- name: Get HugeGraph stable commit id
id: get-commit
uses: ./.github/actions/get-hugegraph-commit
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ Implicit $COMMIT_ID — invisible to readers of this file

The Prepare env and service step (later in the workflow, not in the diff) still runs:

$TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID

COMMIT_ID is no longer in the job env block. It works only because this composite action calls core.exportVariable('COMMIT_ID', sha) which writes to $GITHUB_ENV. A reader scanning the workflow file will see no COMMIT_ID definition and have no idea where it comes from.

All other workflows in this PR pass the SHA explicitly via steps.get-commit.outputs.commit_id. Align loader-ci to the same pattern — either convert the install step to use the setup-hugegraph-server composite action, or add an explicit env binding to that step:

- name: Prepare env and service
  env:
    COMMIT_ID: ${{ steps.get-commit.outputs.commit_id }}
  run: |
    $TRAVIS_DIR/install-hadoop.sh
    $TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID


- name: Setup Java environment
uses: ./.github/actions/setup-java-env
with:
java-version: ${{ matrix.JAVA_VERSION }}
distribution: 'adopt'

- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
use-stage: ${{ env.USE_STAGE }}

- name: Cache Hadoop
uses: actions/cache@v4
Expand All @@ -72,20 +67,16 @@ jobs:
- name: Cache HugeGraph Server
uses: actions/cache@v4
with:
path: ~/hugegraph-cache-${{ env.COMMIT_ID }}
key: ${{ runner.os }}-hugegraph-server-${{ env.COMMIT_ID }}

- name: use staged maven repo settings
if: ${{ env.USE_STAGE == 'true' }}
run: |
cp $HOME/.m2/settings.xml /tmp/settings.xml
mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
path: ~/hugegraph-cache-${{ steps.get-commit.outputs.commit_id }}
key: ${{ runner.os }}-hugegraph-server-${{ steps.get-commit.outputs.commit_id }}

- name: Compile
run: |
mvn install -pl hugegraph-client,hugegraph-loader -am -Dmaven.javadoc.skip=true -DskipTests -ntp

- name: Prepare env and service
env:
COMMIT_ID: ${{ steps.get-commit.outputs.commit_id }}
run: |
$TRAVIS_DIR/install-hadoop.sh
$TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID
Expand All @@ -100,7 +91,7 @@ jobs:
mvn test -P kafka

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: ./.github/actions/upload-coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/jacoco.xml
Loading
Loading