From 841c0cf9656cef8c82d77d5044a98e6a38eca38b Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Tue, 11 Feb 2025 21:57:10 +0800 Subject: [PATCH 01/17] BIGTOP-4361: Add Chinese check --- bigtop-manager-bom/pom.xml | 6 + bigtop-manager-common/pom.xml | 5 + .../utils/ChineseCharacterCheckTest.java | 165 ++++++++++++++++++ .../stack/core/utils/PropertiesUtils.java | 1 - 4 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 bigtop-manager-common/src/test/java/org/apache/bigtop/manager/common/utils/ChineseCharacterCheckTest.java diff --git a/bigtop-manager-bom/pom.xml b/bigtop-manager-bom/pom.xml index ce8f88b89..85efae8a2 100644 --- a/bigtop-manager-bom/pom.xml +++ b/bigtop-manager-bom/pom.xml @@ -53,6 +53,7 @@ 0.35.0 3.0.3 2.1.0 + 3.26.3 @@ -278,6 +279,11 @@ langchain4j-reactor ${langchain4j.version} + + com.github.javaparser + javaparser-core + ${javaparser.version} + diff --git a/bigtop-manager-common/pom.xml b/bigtop-manager-common/pom.xml index ad71ab9d8..f93338cdf 100644 --- a/bigtop-manager-common/pom.xml +++ b/bigtop-manager-common/pom.xml @@ -91,5 +91,10 @@ jakarta.annotation-api + + com.github.javaparser + javaparser-core + test + diff --git a/bigtop-manager-common/src/test/java/org/apache/bigtop/manager/common/utils/ChineseCharacterCheckTest.java b/bigtop-manager-common/src/test/java/org/apache/bigtop/manager/common/utils/ChineseCharacterCheckTest.java new file mode 100644 index 000000000..dc8636ed5 --- /dev/null +++ b/bigtop-manager-common/src/test/java/org/apache/bigtop/manager/common/utils/ChineseCharacterCheckTest.java @@ -0,0 +1,165 @@ +/* + * 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 + * + * https://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. + */ +package org.apache.bigtop.manager.common.utils; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.github.javaparser.JavaParser; +import com.github.javaparser.ParseResult; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.expr.StringLiteralExpr; + +import java.io.IOException; +import java.nio.file.FileVisitOption; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Pattern; +import java.util.stream.Stream; + +/** + * Test case for checking Chinese characters in Java files + */ +public class ChineseCharacterCheckTest { + + private static final Logger log = LoggerFactory.getLogger(ChineseCharacterCheckTest.class); + + private static final Pattern CHINESE_CHAR_PATTERN = Pattern.compile("[\u4e00-\u9fa5]"); + private static final Set EXCLUDED_FILES = new HashSet<>(Collections.singletonList("Metrics")); + private static final String MAIN_SOURCE_DIR = "src/main/java"; + private static final String TEST_SOURCE_DIR = "src/test/java"; + + private final JavaParser javaParser = new JavaParser(); + private final String sourceDir; + private final String testDir; + + public ChineseCharacterCheckTest() { + boolean isWindowsOs = System.getProperty("os.name").toLowerCase().startsWith("win"); + String separator = isWindowsOs ? "\\" : "/"; + this.sourceDir = MAIN_SOURCE_DIR.replace("/", separator); + this.testDir = TEST_SOURCE_DIR.replace("/", separator); + } + + @Test + void shouldNotContainChineseInComments() { + List violations = scanForChineseCharacters(ScanTarget.COMMENTS); + assertNoChineseCharacters(violations); + } + + private List scanForChineseCharacters(ScanTarget target) { + List violations = new ArrayList<>(); + try (Stream paths = Files.walk(Paths.get(".."), FileVisitOption.FOLLOW_LINKS)) { + paths.filter(this::isValidJavaFile).forEach(path -> processFile(path, target, violations)); + } catch (IOException e) { + throw new RuntimeException("Failed to scan Java files", e); + } + return violations; + } + + private boolean isValidJavaFile(Path path) { + String pathStr = path.toString(); + return pathStr.endsWith(".java") + && (pathStr.contains(sourceDir) || pathStr.contains(testDir)) + && EXCLUDED_FILES.stream().noneMatch(pathStr::contains); + } + + private void processFile(Path path, ScanTarget target, List violations) { + try { + ParseResult parseResult = javaParser.parse(Files.newInputStream(path)); + parseResult.getResult().ifPresent(cu -> { + if (target.includeComments()) { + checkComments(cu, path, violations); + } + if (target.includeCode()) { + checkCode(cu, path, violations); + } + }); + } catch (Exception e) { + log.error("Error processing file: {}", path, e); + } + } + + private void checkComments(CompilationUnit cu, Path path, List violations) { + cu.getAllContainedComments().stream() + .filter(comment -> + CHINESE_CHAR_PATTERN.matcher(comment.getContent()).find()) + .forEach(comment -> violations.add( + formatViolation(path, "comment", comment.getContent().trim()))); + } + + private void checkCode(CompilationUnit cu, Path path, List violations) { + cu.findAll(StringLiteralExpr.class).stream() + .filter(str -> CHINESE_CHAR_PATTERN.matcher(str.getValue()).find()) + .forEach(str -> violations.add(formatViolation(path, "code", str.getValue()))); + } + + private String formatViolation(Path path, String location, String content) { + return String.format("Chinese characters found in %s at %s: %s", location, path.toAbsolutePath(), content); + } + + private void assertNoChineseCharacters(List violations) { + Assertions.assertEquals( + 0, + violations.size(), + () -> String.format( + "Found Chinese characters in files:%n%s", String.join(System.lineSeparator(), violations))); + } + + /** + * Defines what content should be checked for Chinese characters + */ + private enum ScanTarget { + /** + * Check only comments + */ + COMMENTS(true, false), + /** + * Check only code (string literals) + */ + CODE(false, true), + /** + * Check both comments and code + */ + ALL(true, true); + + private final boolean checkComments; + private final boolean checkCode; + + ScanTarget(boolean checkComments, boolean checkCode) { + this.checkComments = checkComments; + this.checkCode = checkCode; + } + + public boolean includeComments() { + return checkComments; + } + + public boolean includeCode() { + return checkCode; + } + } +} diff --git a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PropertiesUtils.java b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PropertiesUtils.java index bbb860de6..872521f93 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PropertiesUtils.java +++ b/bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/PropertiesUtils.java @@ -85,7 +85,6 @@ public static void writeProperties(String fileName, Map configMa * @throws IOException */ public static void writeProperties(String fileName, List> configList) { - // 创建Properties Properties properties = new Properties(); for (Map map : configList) { From 0282af849ff16cc19083d2daa48234a208ed3213 Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Thu, 13 Feb 2025 23:41:43 +0800 Subject: [PATCH 02/17] BIGTOP-4361: Add Chinese check --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a20cc558a..5174d8080 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,29 @@ jobs: with: config: .github/typos.toml + check-chinese-character: + name: "Check Chinese Character" + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + - name: Set JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + cache: 'maven' + - name: Cache local Maven repository + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - run: ./mvnw clean test -Dskip.pnpm -Dskip.installnodepnpm -Dskip.pnpm.test -DfailIfNoTests=false -Dtest=ChineseCharacterCheckTest + unit-tests-java: name: "Run unit test(Java)" runs-on: ubuntu-latest From 774a0ea6ffccf9a4d239b33934ab18841a705389 Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Thu, 13 Feb 2025 23:48:17 +0800 Subject: [PATCH 03/17] BIGTOP-4361: Add Chinese check From 454726de8ce8007c1acde5f37070e133a9e2101a Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:04:47 +0800 Subject: [PATCH 04/17] BIGTOP-4361: Add Chinese check --- .github/check_chinese_character.py | 95 ++++++++++ .github/workflows/ci.yml | 16 +- bigtop-manager-bom/pom.xml | 6 - bigtop-manager-common/pom.xml | 5 - .../utils/ChineseCharacterCheckTest.java | 165 ------------------ 5 files changed, 99 insertions(+), 188 deletions(-) create mode 100644 .github/check_chinese_character.py delete mode 100644 bigtop-manager-common/src/test/java/org/apache/bigtop/manager/common/utils/ChineseCharacterCheckTest.java diff --git a/.github/check_chinese_character.py b/.github/check_chinese_character.py new file mode 100644 index 000000000..51dc71af8 --- /dev/null +++ b/.github/check_chinese_character.py @@ -0,0 +1,95 @@ +import os +import re +from pathlib import Path +from typing import List, Set + +class ChineseCharacterCheckTest: + CHINESE_CHAR_PATTERN = re.compile(r'[\u4e00-\u9fa5]') + # Exclude directories or files. If it is a file, just write the file name. The same is true for directories, just write the directory name. + EXCLUDED_DIRS_AND_FILES = { + "target", + "node_modules", + "dist", + } + # Supported file extensions + SUPPORTED_EXTENSIONS = {".java", ".kt", ".scala", ".js", ".ts", ".vue"} + + def should_not_contain_chinese_in_comments(self): + violations = self.scan_for_chinese_characters(ScanTarget.COMMENTS) + self.assert_no_chinese_characters(violations) + + def scan_for_chinese_characters(self, target: 'ScanTarget') -> List[str]: + violations = [] + for ext in self.SUPPORTED_EXTENSIONS: + for path in Path("..").rglob(f"*{ext}"): + if self.is_valid_file(path) and not self.is_excluded(path): + self.process_file(path, target, violations) + return violations + + def is_excluded(self, path: Path) -> bool: + path_str = str(path) + return any(excluded in path_str for excluded in self.EXCLUDED_DIRS_AND_FILES) + + def is_valid_file(self, path: Path) -> bool: + path_str = str(path) + return any(path_str.endswith(ext) for ext in self.SUPPORTED_EXTENSIONS) + + def process_file(self, path: Path, target: 'ScanTarget', violations: List[str]): + try: + with open(path, 'r', encoding='utf-8') as file: + content = file.read() + if target.include_comments(): + self.check_comments(content, path, violations) + if target.include_code(): + self.check_code(content, path, violations) + except Exception as e: + print(f"Error processing file: {path}") + print(e) + + def check_comments(self, content: str, path: Path, violations: List[str]): + # Matching multiple types of comments + comment_patterns = [ + r'//.*?$', # Single line comments + r'/\*.*?\*/', # Multi line comments + r'' # Vue/HTML,/javascript/typescript comments + ] + for pattern in comment_patterns: + for comment in re.findall(pattern, content, re.DOTALL | re.MULTILINE): + if self.CHINESE_CHAR_PATTERN.search(comment): + violations.append(self.format_violation(path, "comment", comment.strip())) + + def check_code(self, content: str, path: Path, violations: List[str]): + # Matching string literals in multiple languages + string_patterns = [ + r'"[^"]*"', # Double quoted strings + r"'[^']*'" # Single quoted strings + ] + for pattern in string_patterns: + for string_literal in re.findall(pattern, content): + if self.CHINESE_CHAR_PATTERN.search(string_literal): + violations.append(self.format_violation(path, "code", string_literal)) + + def format_violation(self, path: Path, location: str, content: str) -> str: + return f"Chinese characters found in {location} at {path.absolute()}: {content}" + + def assert_no_chinese_characters(self, violations: List[str]): + assert len(violations) == 0, f"Found Chinese characters in files:\n{os.linesep.join(violations)}" + +class ScanTarget: + def __init__(self, check_comments: bool, check_code: bool): + self.check_comments = check_comments + self.check_code = check_code + + def include_comments(self) -> bool: + return self.check_comments + + def include_code(self) -> bool: + return self.check_code + +ScanTarget.COMMENTS = ScanTarget(True, False) +ScanTarget.CODE = ScanTarget(False, True) +ScanTarget.ALL = ScanTarget(True, True) + +if __name__ == "__main__": + test = ChineseCharacterCheckTest() + test.should_not_contain_chinese_in_comments() diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5174d8080..bd91fad8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,19 +43,11 @@ jobs: with: submodules: true - name: Set JDK - uses: actions/setup-java@v4 + uses: actions/setup-python@v4 with: - distribution: 'temurin' - java-version: '17' - cache: 'maven' - - name: Cache local Maven repository - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - run: ./mvnw clean test -Dskip.pnpm -Dskip.installnodepnpm -Dskip.pnpm.test -DfailIfNoTests=false -Dtest=ChineseCharacterCheckTest + python-version: '3.13' + cache: 'pip' # caching pip dependencies + - run: python .github/check-chinese-character.py unit-tests-java: name: "Run unit test(Java)" diff --git a/bigtop-manager-bom/pom.xml b/bigtop-manager-bom/pom.xml index 85efae8a2..ce8f88b89 100644 --- a/bigtop-manager-bom/pom.xml +++ b/bigtop-manager-bom/pom.xml @@ -53,7 +53,6 @@ 0.35.0 3.0.3 2.1.0 - 3.26.3 @@ -279,11 +278,6 @@ langchain4j-reactor ${langchain4j.version} - - com.github.javaparser - javaparser-core - ${javaparser.version} - diff --git a/bigtop-manager-common/pom.xml b/bigtop-manager-common/pom.xml index f93338cdf..ad71ab9d8 100644 --- a/bigtop-manager-common/pom.xml +++ b/bigtop-manager-common/pom.xml @@ -91,10 +91,5 @@ jakarta.annotation-api - - com.github.javaparser - javaparser-core - test - diff --git a/bigtop-manager-common/src/test/java/org/apache/bigtop/manager/common/utils/ChineseCharacterCheckTest.java b/bigtop-manager-common/src/test/java/org/apache/bigtop/manager/common/utils/ChineseCharacterCheckTest.java deleted file mode 100644 index dc8636ed5..000000000 --- a/bigtop-manager-common/src/test/java/org/apache/bigtop/manager/common/utils/ChineseCharacterCheckTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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 - * - * https://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. - */ -package org.apache.bigtop.manager.common.utils; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.github.javaparser.JavaParser; -import com.github.javaparser.ParseResult; -import com.github.javaparser.ast.CompilationUnit; -import com.github.javaparser.ast.expr.StringLiteralExpr; - -import java.io.IOException; -import java.nio.file.FileVisitOption; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.regex.Pattern; -import java.util.stream.Stream; - -/** - * Test case for checking Chinese characters in Java files - */ -public class ChineseCharacterCheckTest { - - private static final Logger log = LoggerFactory.getLogger(ChineseCharacterCheckTest.class); - - private static final Pattern CHINESE_CHAR_PATTERN = Pattern.compile("[\u4e00-\u9fa5]"); - private static final Set EXCLUDED_FILES = new HashSet<>(Collections.singletonList("Metrics")); - private static final String MAIN_SOURCE_DIR = "src/main/java"; - private static final String TEST_SOURCE_DIR = "src/test/java"; - - private final JavaParser javaParser = new JavaParser(); - private final String sourceDir; - private final String testDir; - - public ChineseCharacterCheckTest() { - boolean isWindowsOs = System.getProperty("os.name").toLowerCase().startsWith("win"); - String separator = isWindowsOs ? "\\" : "/"; - this.sourceDir = MAIN_SOURCE_DIR.replace("/", separator); - this.testDir = TEST_SOURCE_DIR.replace("/", separator); - } - - @Test - void shouldNotContainChineseInComments() { - List violations = scanForChineseCharacters(ScanTarget.COMMENTS); - assertNoChineseCharacters(violations); - } - - private List scanForChineseCharacters(ScanTarget target) { - List violations = new ArrayList<>(); - try (Stream paths = Files.walk(Paths.get(".."), FileVisitOption.FOLLOW_LINKS)) { - paths.filter(this::isValidJavaFile).forEach(path -> processFile(path, target, violations)); - } catch (IOException e) { - throw new RuntimeException("Failed to scan Java files", e); - } - return violations; - } - - private boolean isValidJavaFile(Path path) { - String pathStr = path.toString(); - return pathStr.endsWith(".java") - && (pathStr.contains(sourceDir) || pathStr.contains(testDir)) - && EXCLUDED_FILES.stream().noneMatch(pathStr::contains); - } - - private void processFile(Path path, ScanTarget target, List violations) { - try { - ParseResult parseResult = javaParser.parse(Files.newInputStream(path)); - parseResult.getResult().ifPresent(cu -> { - if (target.includeComments()) { - checkComments(cu, path, violations); - } - if (target.includeCode()) { - checkCode(cu, path, violations); - } - }); - } catch (Exception e) { - log.error("Error processing file: {}", path, e); - } - } - - private void checkComments(CompilationUnit cu, Path path, List violations) { - cu.getAllContainedComments().stream() - .filter(comment -> - CHINESE_CHAR_PATTERN.matcher(comment.getContent()).find()) - .forEach(comment -> violations.add( - formatViolation(path, "comment", comment.getContent().trim()))); - } - - private void checkCode(CompilationUnit cu, Path path, List violations) { - cu.findAll(StringLiteralExpr.class).stream() - .filter(str -> CHINESE_CHAR_PATTERN.matcher(str.getValue()).find()) - .forEach(str -> violations.add(formatViolation(path, "code", str.getValue()))); - } - - private String formatViolation(Path path, String location, String content) { - return String.format("Chinese characters found in %s at %s: %s", location, path.toAbsolutePath(), content); - } - - private void assertNoChineseCharacters(List violations) { - Assertions.assertEquals( - 0, - violations.size(), - () -> String.format( - "Found Chinese characters in files:%n%s", String.join(System.lineSeparator(), violations))); - } - - /** - * Defines what content should be checked for Chinese characters - */ - private enum ScanTarget { - /** - * Check only comments - */ - COMMENTS(true, false), - /** - * Check only code (string literals) - */ - CODE(false, true), - /** - * Check both comments and code - */ - ALL(true, true); - - private final boolean checkComments; - private final boolean checkCode; - - ScanTarget(boolean checkComments, boolean checkCode) { - this.checkComments = checkComments; - this.checkCode = checkCode; - } - - public boolean includeComments() { - return checkComments; - } - - public boolean includeCode() { - return checkCode; - } - } -} From 999f232388a0e7686884636307dbecf68a0d611c Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:07:08 +0800 Subject: [PATCH 05/17] BIGTOP-4361: Add Chinese check --- .github/check_chinese_character.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/check_chinese_character.py b/.github/check_chinese_character.py index 51dc71af8..90f735109 100644 --- a/.github/check_chinese_character.py +++ b/.github/check_chinese_character.py @@ -1,3 +1,23 @@ +#!/usr/bin/env python +# +# 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 +# +# https://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. +# + import os import re from pathlib import Path From 6cabdadf700d63aa2f60ca0771d6179a962e5cc6 Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:12:52 +0800 Subject: [PATCH 06/17] BIGTOP-4361: Add Chinese check --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd91fad8f..6132acd37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,8 +42,8 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - name: Set JDK - uses: actions/setup-python@v4 + - name: Set python + uses: actions/setup-python@v5 with: python-version: '3.13' cache: 'pip' # caching pip dependencies From 2fd44ef2aecde6b79f07485e229dd104d2b35dbb Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:19:45 +0800 Subject: [PATCH 07/17] BIGTOP-4361: Add Chinese check --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6132acd37..f1048a428 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,10 @@ jobs: with: python-version: '3.13' cache: 'pip' # caching pip dependencies + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt - run: python .github/check-chinese-character.py unit-tests-java: From 773ff9b59baff0da570cb18bb19dd7b8618001f0 Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:26:02 +0800 Subject: [PATCH 08/17] BIGTOP-4361: Add Chinese check --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1048a428..3bad0289b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt + pip install GitPython - run: python .github/check-chinese-character.py unit-tests-java: From 896ef0256575314dea4ba10af357021af0505567 Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:27:18 +0800 Subject: [PATCH 09/17] BIGTOP-4361: Add Chinese check --- .github/workflows/ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bad0289b..651e4dfc8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,12 +46,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.13' - cache: 'pip' # caching pip dependencies - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install GitPython - run: python .github/check-chinese-character.py unit-tests-java: From cced03f4d36455e3889e324c690ec102ce010158 Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:29:25 +0800 Subject: [PATCH 10/17] BIGTOP-4361: Add Chinese check --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 651e4dfc8..63fcfc5a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.13' - - run: python .github/check-chinese-character.py + - name: Check Chinese Character + run: python ./.github/check-chinese-character.py unit-tests-java: name: "Run unit test(Java)" From 1592240fb2fd1e63845bea0ac44939368c98b35b Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:34:27 +0800 Subject: [PATCH 11/17] BIGTOP-4361: Add Chinese check --- .github/workflows/check_chinese_character.yml | 42 +++++++++++++++++++ .github/workflows/ci.yml | 15 ------- 2 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/check_chinese_character.yml diff --git a/.github/workflows/check_chinese_character.yml b/.github/workflows/check_chinese_character.yml new file mode 100644 index 000000000..0a3b46406 --- /dev/null +++ b/.github/workflows/check_chinese_character.yml @@ -0,0 +1,42 @@ +# +# 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 +# +# https://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. +# + +name: "Check Chinese Character" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + check-chinese-character: + name: "Check Chinese Character" + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + - name: Set python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + - name: Check Chinese Character + run: python .github/check-chinese-character.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 63fcfc5a1..a20cc558a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,21 +34,6 @@ jobs: with: config: .github/typos.toml - check-chinese-character: - name: "Check Chinese Character" - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true - - name: Set python - uses: actions/setup-python@v5 - with: - python-version: '3.13' - - name: Check Chinese Character - run: python ./.github/check-chinese-character.py - unit-tests-java: name: "Run unit test(Java)" runs-on: ubuntu-latest From 049eb8e6b39308c76bc2425dc692942ebcf1547a Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:36:59 +0800 Subject: [PATCH 12/17] BIGTOP-4361: Add Chinese check --- .github/workflows/check_chinese_character.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_chinese_character.yml b/.github/workflows/check_chinese_character.yml index 0a3b46406..2766dac04 100644 --- a/.github/workflows/check_chinese_character.yml +++ b/.github/workflows/check_chinese_character.yml @@ -17,7 +17,7 @@ # under the License. # -name: "Check Chinese Character" +name: "Check" on: push: @@ -33,10 +33,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: - submodules: true + persist-credentials: false + submodules: recursive - name: Set python uses: actions/setup-python@v5 with: python-version: '3.13' - name: Check Chinese Character - run: python .github/check-chinese-character.py + run: python ../.github/check-chinese-character.py From 3a93f0afe0cc9b1d5dc5745901044bde96af232a Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:39:57 +0800 Subject: [PATCH 13/17] BIGTOP-4361: Add Chinese check --- .github/workflows/check_chinese_character.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_chinese_character.yml b/.github/workflows/check_chinese_character.yml index 2766dac04..0b6c32759 100644 --- a/.github/workflows/check_chinese_character.yml +++ b/.github/workflows/check_chinese_character.yml @@ -40,4 +40,4 @@ jobs: with: python-version: '3.13' - name: Check Chinese Character - run: python ../.github/check-chinese-character.py + run: python .github/check_chinese_character.py From 91fc2d455d2a2f21388ffb150e46990b2305877f Mon Sep 17 00:00:00 2001 From: wuchunfu <319355703@qq.com> Date: Sat, 15 Feb 2025 19:49:23 +0800 Subject: [PATCH 14/17] BIGTOP-4361: Add Chinese check --- bigtop-manager-ui/src/pages/login/index.vue | 10 +++++----- bigtop-manager-ui/tests/__utils__/array.test.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bigtop-manager-ui/src/pages/login/index.vue b/bigtop-manager-ui/src/pages/login/index.vue index 02082c7d5..4065f9e46 100644 --- a/bigtop-manager-ui/src/pages/login/index.vue +++ b/bigtop-manager-ui/src/pages/login/index.vue @@ -68,7 +68,7 @@