Skip to content

add retry for failed clone from gittee #78

add retry for failed clone from gittee

add retry for failed clone from gittee #78

Workflow file for this run

name: bench-test
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
project:
[
commonlibrary_rust_ylong_http,
commonlibrary_rust_ylong_json,
commonlibrary_rust_ylong_runtime,
communication_ipc,
hiviewdfx_hilog,
hiviewdfx_hisysevent,
hiviewdfx_hitrace,
request_request,
systemabilitymgr_safwk,
systemabilitymgr_samgr,
]
steps:
- name: clone repo
uses: nick-fields/retry@v3
with:
timeout_seconds: 15
max_attempts: 3
retry_on: error
command: git clone https://gitee.com/openharmony/${{ matrix.project }}.git
- name: install dylint
run: cargo install cargo-dylint dylint-link
- name: add Cargo.toml dylint lib link
working-directory: ./${{ matrix.project }}
run: echo -e "\n[workspace.metadata.dylint]\nlibraries = [\n { git = \"https://github.com/trusted-programming/cargo-mate\"},\n]" >> Cargo.toml
- name: add rayon
working-directory: ./${{ matrix.project }}
shell: bash
run: |
find . -type f -name "Cargo.toml" | while read -r file; do
# Check if rayon is already in the dependencies
if ! grep -qE "^rayon =" "$file"; then
# Add rayon under the [dependencies] line
sed -i '/\[dependencies\]/a rayon = "1.8.1"' "$file"
fi
done
- name: lint fix
working-directory: ./${{ matrix.project }}
continue-on-error: true
run: cargo dylint --all --workspace --fix -- --allow-dirty --allow-no-vcs --broken-code --lib
- name: cargo check
working-directory: ./${{ matrix.project }}
run: cargo check
- name: git diff
working-directory: ./${{ matrix.project }}
run: git diff
- name: par iter count
working-directory: ./${{ matrix.project }}
shell: bash
run: |
# Initialize counters
par_iter_count=0
into_par_iter_count=0
par_iter_mut_count=0
# Iterate over all .rs files in the current directory and subdirectories
find . -type f -name '*.rs' | while read -r file; do
# Count occurrences in the current file
par_iter_count_in_file=$(grep -o '\.par_iter()' "$file" | wc -l)
into_par_iter_count_in_file=$(grep -o 'into_par_iter()' "$file" | wc -l)
par_iter_mut_count_in_file=$(grep -o 'par_iter_mut()' "$file" | wc -l)
# Update total counters
((par_iter_count += par_iter_count_in_file))
((into_par_iter_count += into_par_iter_count_in_file))
((par_iter_mut_count += par_iter_mut_count_in_file))
done
# Print results
echo ".par_iter() occurrences: $par_iter_count"
echo "into_par_iter() occurrences: $into_par_iter_count"
echo "par_iter_mut() occurrences: $par_iter_mut_count"