-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[optimize]: update github action (#2608)
Signed-off-by: yuluo-yx <[email protected]> Signed-off-by: shown <[email protected]>
- Loading branch information
Showing
10 changed files
with
122 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,16 +39,15 @@ on: | |
- 'material/**' | ||
|
||
jobs: | ||
build: | ||
backend-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17 | ||
- uses: ./script/ci/github-actions/setup-deps | ||
|
||
- name: Build with Maven | ||
run: mvn clean -B package -Prelease --file pom.xml | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,103 +28,37 @@ on: | |
- 'home/**' | ||
|
||
jobs: | ||
build: | ||
docs-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Check Markdown | ||
uses: DavidAnson/markdownlint-cli2-action@v16 | ||
with: | ||
globs: './home/**/*.md' | ||
- name: Check filename in home/blog | ||
run: | | ||
TARGET_DIR="./home/blog" | ||
invalid_files=() | ||
while IFS= read -r -d '' file; do | ||
filename=$(basename "$file") | ||
if [[ ! "$filename" =~ ^[_a-z0-9-]+(\.[_a-z0-9-]+)*$ ]]; then | ||
invalid_files+=("$file") | ||
fi | ||
done < <(find "$TARGET_DIR" -type f -print0) | ||
if [ ${#invalid_files[@]} -ne 0 ]; then | ||
echo "Error: The following files have invalid names:(File name should only contain lowercase letters, numbers, and hyphens.)" | ||
for invalid_file in "${invalid_files[@]}"; do | ||
echo "$invalid_file" | ||
done | ||
exit 1 | ||
else | ||
echo "All file names are valid." | ||
fi | ||
- name: Check filename in home/docs | ||
run: | | ||
TARGET_DIR="./home/docs" | ||
invalid_files=() | ||
while IFS= read -r -d '' file; do | ||
filename=$(basename "$file") | ||
if [[ ! "$filename" =~ ^[_a-z0-9-]+(\.[_a-z0-9-]+)*$ ]]; then | ||
invalid_files+=("$file") | ||
fi | ||
done < <(find "$TARGET_DIR" -type f -print0) | ||
if [ ${#invalid_files[@]} -ne 0 ]; then | ||
echo "Error: The following files have invalid names:(File name should only contain lowercase letters, numbers, and hyphens.)" | ||
for invalid_file in "${invalid_files[@]}"; do | ||
echo "$invalid_file" | ||
done | ||
exit 1 | ||
else | ||
echo "All file names are valid." | ||
fi | ||
- name: Check filename in /zh-cn/docusaurus-plugin-content-blog | ||
run: | | ||
TARGET_DIR="./home/i18n/zh-cn/docusaurus-plugin-content-blog" | ||
invalid_files=() | ||
while IFS= read -r -d '' file; do | ||
filename=$(basename "$file") | ||
if [[ ! "$filename" =~ ^[_a-z0-9-]+(\.[_a-z0-9-]+)*$ ]]; then | ||
invalid_files+=("$file") | ||
fi | ||
done < <(find "$TARGET_DIR" -type f -print0) | ||
if [ ${#invalid_files[@]} -ne 0 ]; then | ||
echo "Error: The following files have invalid names:(File name should only contain lowercase letters, numbers, and hyphens.)" | ||
for invalid_file in "${invalid_files[@]}"; do | ||
echo "$invalid_file" | ||
done | ||
exit 1 | ||
else | ||
echo "All file names are valid." | ||
fi | ||
- name: Check filename in /home/i18n/zh-cn/docusaurus-plugin-content-docs/current | ||
run: | | ||
TARGET_DIR="./home/i18n/zh-cn/docusaurus-plugin-content-docs/current" | ||
invalid_files=() | ||
while IFS= read -r -d '' file; do | ||
filename=$(basename "$file") | ||
if [[ ! "$filename" =~ ^[_a-z0-9-]+(\.[_a-z0-9-]+)*$ ]]; then | ||
invalid_files+=("$file") | ||
fi | ||
done < <(find "$TARGET_DIR" -type f -print0) | ||
if [ ${#invalid_files[@]} -ne 0 ]; then | ||
echo "Error: The following files have invalid names:(File name should only contain lowercase letters, numbers, and hyphens.)" | ||
for invalid_file in "${invalid_files[@]}"; do | ||
echo "$invalid_file" | ||
done | ||
exit 1 | ||
else | ||
echo "All file names are valid." | ||
fi | ||
- name: Dead Link | ||
|
||
- name: Check filenames | ||
run: python ./script/ci/docs/check_file_name.py ./script/ci/docs/check_file_name.json | ||
|
||
- name: Dead Link Check | ||
run: | | ||
sudo npm install -g [email protected] | ||
for file in $(find ./home -name "*.md"); do | ||
if ! grep -Fxq "$file" .github/exclude_files.txt; then | ||
markdown-link-check -c .github/link_check.json -q "$file" | ||
if ! grep -Fxq "$file" ./script/ci/exclude_files.txt; then | ||
markdown-link-check -c ./script/ci/link_check.json -q "$file" | ||
fi | ||
done | ||
- name: NPM INSTALL | ||
working-directory: home | ||
run: npm install | ||
|
||
- name: NPM BUILD | ||
working-directory: home | ||
run: npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"directories": [ | ||
"./home/blog", | ||
"./home/docs", | ||
"./home/i18n/zh-cn/docusaurus-plugin-content-blog", | ||
"./home/i18n/zh-cn/docusaurus-plugin-content-docs/current" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# 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. | ||
|
||
import os | ||
import re | ||
import sys | ||
import json | ||
|
||
def read_config(file_path): | ||
try: | ||
with open(file_path, 'r') as file: | ||
config = json.load(file) | ||
return config.get("directories", []) | ||
except Exception as e: | ||
print(f"Error reading configuration file: {e}") | ||
sys.exit(1) | ||
|
||
|
||
def find_invalid_files(directories): | ||
invalid_files = [] | ||
pattern = re.compile(r'^[_a-z0-9-]+(\.[_a-z0-9-]+)*$') | ||
|
||
for target_dir in directories: | ||
print(f"Checking directory: {target_dir}") | ||
for root, _, files in os.walk(target_dir): | ||
for filename in files: | ||
if not pattern.match(filename): | ||
invalid_files.append(os.path.join(root, filename)) | ||
|
||
if invalid_files: | ||
print("\nError: The following files have invalid names (file names should only contain lowercase letters, numbers, and hyphens):") | ||
for invalid_file in invalid_files: | ||
print(invalid_file) | ||
sys.exit(1) | ||
else: | ||
print("All file names are valid.") | ||
|
||
|
||
if __name__ == "__main__": | ||
# usage: python check_filenames.py config.json | ||
if len(sys.argv) != 2: | ||
print("Usage: python xxx_script.py config.json") | ||
sys.exit(1) | ||
|
||
config_file = sys.argv[1] | ||
directories = read_config(config_file) | ||
if not directories: | ||
print("\nNo directories found in configuration file.") | ||
sys.exit(1) | ||
|
||
find_invalid_files(directories) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 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. | ||
|
||
name: setup-deps | ||
description: Install host system dependencies | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "zulu" | ||
java-version: 17 |
File renamed without changes.