From 2450e9a3134163172b155c6554f65f6f443e1a7f Mon Sep 17 00:00:00 2001 From: "jishiwen.jsw" Date: Mon, 8 Dec 2025 22:49:18 +0800 Subject: [PATCH] infra: add makefile target Signed-off-by: jishiwen.jsw --- .github/workflows/ci-jdk11.yml | 6 ++-- .github/workflows/ci.yml | 6 ++-- Makefile | 50 ++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/ci-jdk11.yml b/.github/workflows/ci-jdk11.yml index e5878aaa2..1527c2ec7 100644 --- a/.github/workflows/ci-jdk11.yml +++ b/.github/workflows/ci-jdk11.yml @@ -68,6 +68,7 @@ jobs: with: java-version: '11' distribution: 'temurin' + cache: maven - name: Setup Protoc uses: arduino/setup-protoc@v2 @@ -76,7 +77,4 @@ jobs: # Current hive connector is incompatible with jdk11, implement 4.0.0+ hive version in later. - name: Build and Test On JDK 11 - run: | - test_modules="!geaflow/geaflow-dsl/geaflow-dsl-connector/geaflow-dsl-connector-hive," - test_modules+="!geaflow/geaflow-dsl/geaflow-dsl-connector-tests" - mvn -B -e clean test -Pjdk11 -pl "${test_modules}" -Duser.timezone=Asia/Shanghai -Dlog4j.configuration="log4j.rootLogger=WARN, stdout" + run: make test-jdk11 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ef466df8..3b0d74ca3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Print available memory run: free -m @@ -66,7 +66,7 @@ jobs: run: sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - name: Set up JDK 8 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '8' distribution: 'temurin' @@ -78,4 +78,4 @@ jobs: version: "21.7" - name: Build and Test On JDK 8 - run: mvn -B -e clean test -Pjdk8 -Duser.timezone=Asia/Shanghai -Dlog4j.configuration="log4j.rootLogger=WARN, stdout" + run: make test diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..2a6e37485 --- /dev/null +++ b/Makefile @@ -0,0 +1,50 @@ +# +# 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. +# + +SHELL:=/bin/bash + +# Log the running target +LOG_TARGET = echo -e "\033[0;32m==================> Running $@ ============> ... \033[0m" + +.PHONY: all +all: build + +.PHONY: build +build: ## Build the project + @$(LOG_TARGET) + mvn -B -e clean package -DskipTests -Duser.timezone=Asia/Shanghai + +.PHONY: test +test: ## Run tests on JDK 8 + @$(LOG_TARGET) + mvn -B -e clean test -Pjdk8 -Duser.timezone=Asia/Shanghai -Dlog4j.configuration="log4j.rootLogger=WARN, stdout" + +.PHONY: test-jdk11 +test-jdk11: ## Run tests on JDK 11 (excludes Hive connector) + @$(LOG_TARGET) + mvn -B -e clean test -Pjdk11 -pl "!geaflow/geaflow-dsl/geaflow-dsl-connector/geaflow-dsl-connector-hive,!geaflow/geaflow-dsl/geaflow-dsl-connector-tests" -Duser.timezone=Asia/Shanghai -Dlog4j.configuration="log4j.rootLogger=WARN, stdout" + +.PHONY: checkstyle +checkstyle: ## Run checkstyle + @$(LOG_TARGET) + mvn checkstyle:check + +.PHONY: help +help: ## Display this help + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)