You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by hx...@apache.org on 2025/06/09 09:59:57 UTC

(flink-agents) branch main updated: Adds ci tests in GHA (#4)

This is an automated email from the ASF dual-hosted git repository.

hxb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git


The following commit(s) were added to refs/heads/main by this push:
     new a47452d  Adds ci tests in GHA (#4)
a47452d is described below

commit a47452df61359e57fe515790bd73e496e1c0effb
Author: HuangXingBo <hx...@apache.org>
AuthorDate: Mon Jun 9 17:59:52 2025 +0800

    Adds ci tests in GHA (#4)
---
 .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++-
 tools/ut.sh              | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f9128e7..bc4e269 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -35,7 +35,7 @@ jobs:
       - name: Set up JDK
         uses: actions/setup-java@v4
         with:
-          java-version: '8'
+          java-version: '11'
           distribution: 'adopt'
       - name: Set up Python
         uses: actions/setup-python@v2
@@ -43,3 +43,40 @@ jobs:
           python-version: 3.12
       - name: Check code style
         run: ./tools/lint.sh
+
+  java_tests:
+    name: java tests on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ 'macos-latest', 'ubuntu-latest' ]
+    steps:
+      - uses: actions/checkout@v4
+      - name: Install java
+        uses: actions/setup-java@v2
+        with:
+          java-version: '11'
+          distribution: 'adopt'
+      - name: Run Java Tests
+        run: tools/ut.sh java
+
+  python_tests:
+    name: python tests on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ 'macos-latest', 'ubuntu-latest' ]
+        python-version: [ '3.9', '3.10', '3.11', '3.12' ]
+    steps:
+      - uses: actions/checkout@v4
+      - name: Install java
+        uses: actions/setup-java@v2
+        with:
+          java-version: '11'
+          distribution: 'adopt'
+      - name: Install python
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Run Python Tests
+        run: tools/ut.sh python
diff --git a/tools/ut.sh b/tools/ut.sh
new file mode 100755
index 0000000..da3098e
--- /dev/null
+++ b/tools/ut.sh
@@ -0,0 +1,52 @@
+#!/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.
+################################################################################
+set -e
+set -x
+
+ROOT="$(git rev-parse --show-toplevel)"
+echo "Root path: $ROOT, home path: $HOME"
+cd "$ROOT"
+
+case $1 in
+  java)
+    echo "Executing java tests"
+    set +e
+    mvn -T16 --batch-mode --no-transfer-progress test
+    testcode=$?
+    if [[ $testcode -ne 0 ]]; then
+      exit $testcode
+    fi
+    echo "Executing java tests succeeds"
+    ;;
+  python)
+    echo "Executing python tests"
+    set +e
+    pip install -r python/requirements/test_requirements.txt
+    pytest python/flink_agents
+    testcode=$?
+    if [[ $testcode -ne 0 && testcode -ne 5 ]]; then
+      exit $testcode
+    fi
+    echo "Executing python tests succeeds"
+    ;;
+  *)
+    echo "Execute command $*"
+    "$@"
+    ;;
+esac