Skip to content

Commit

Permalink
revert origin
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxiaobin committed Mar 19, 2024
1 parent 8ab69e8 commit 9083db9
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions .github/workflows/build-and-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,10 @@ jobs:
RESULTS_REPO_BRANCH: main
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
run: |
tmp_path="/tmp"
files=$(find "$tmp_path" -maxdepth 1 -type f -name "jmh_result*.json")
if [ -n "$files" ]; then
echo "目录下存在以下jmh_result*.json文件:"
echo "$files"
else
echo "目录下不存在jmh_result*.json这样的文件"
if [[ ! -f /tmp/jmh_result.json ]]; then
echo "/tmp/jmh_result.json does not exist. Exiting..."
exit 0
fi
git clone https://github.com/${RESULTS_REPO_OWNER}/${RESULTS_REPO_NAME}.git jmh_result
cd jmh_result
git config user.email "[email protected]"
Expand All @@ -371,22 +365,7 @@ jobs:
WORK_DIR="$(pwd)"
echo "WorkDir: $WORK_DIR"
DIRECTORY_PATH="$WORK_DIR/test-results"
for file in $tmp_path/jmh_result*.json; do
if [ -f "$file" ]; then
# 获取文件名和扩展名
filename=$(basename -- "$file")
extension="${filename##*.}"
filename="${filename%.*}"
# 构建新的文件名
new_filename="${filename}_${current_date}_$RANDOM.${extension}"
# 复制文件到指定目录,并改名
cp "$file" "${DIRECTORY_PATH}${new_filename}"
echo "Copied $file to ${DIRECTORY_PATH}${new_filename}"
fi
done
cp "/tmp/jmh_result.json" "$DIRECTORY_PATH/jmh_result_$(date +%Y%m%d)_$RANDOM.json"
MAX_FILES=5
files=($(ls -t1 "$DIRECTORY_PATH" | tail -n +2))
Expand All @@ -398,17 +377,17 @@ jobs:
merged_file="merged_results.json"
rm -rf "$DIRECTORY_PATH/$merged_file"
sudo apt-get update
sudo apt-get install -y jq
json_array=()
for file in $(ls -t1 "$DIRECTORY_PATH"/*.json); do
if [ -f "$file" ]; then
json_array+=( "$(cat "$file")" )
fi
done
merged_json=$(echo "${json_array[@]}" | jq -s add)
echo "$merged_json" > "$DIRECTORY_PATH/$merged_file"
Expand Down

0 comments on commit 9083db9

Please sign in to comment.