Skip to content

Commit dce5b85

Browse files
committed
try fix CI dependency rayon add
1 parent 75f40e4 commit dce5b85

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

.github/workflows/bench-test.yaml

+22-14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ concurrency:
88
jobs:
99
request_request:
1010
runs-on: ubuntu-latest
11-
name: request_request
11+
name: request_request
1212
steps:
1313
- name: clone repo
1414
run: git clone https://gitee.com/openharmony/request_request.git
@@ -23,14 +23,19 @@ jobs:
2323
- name: add rayon
2424
working-directory: ./request_request
2525
run: |
26-
cargo add rayon --package request
27-
cargo add rayon --package download_server
28-
26+
find . -type f -name "Cargo.toml" | while read -r file; do
27+
# Check if rayon is already in the dependencies
28+
if ! grep -qE "^rayon =" "$file"; then
29+
# Add rayon under the [dependencies] line
30+
sed -i '/\[dependencies\]/a rayon = "1.8.1"' "$file"
31+
fi
32+
done
33+
2934
- name: lint fix
3035
working-directory: ./request_request
3136
continue-on-error: true
32-
run: cargo dylint --all --workspace --fix -- --allow-dirty --allow-no-vcs --broken-code --lib
33-
37+
run: cargo dylint --all --workspace --fix -- --allow-dirty --allow-no-vcs --broken-code --lib
38+
3439
- name: cargo check
3540
working-directory: ./request_request
3641
run: cargo check
@@ -56,20 +61,23 @@ jobs:
5661
- name: add rayon
5762
working-directory: ./commonlibrary_rust_ylong_runtime
5863
run: |
59-
cargo add rayon --package ylong_runtime
60-
cargo add rayon --package ylong_ffrt
61-
cargo add rayon --package ylong_io
62-
cargo add rayon --package ylong_runtime_macros
63-
64+
find . -type f -name "Cargo.toml" | while read -r file; do
65+
# Check if rayon is already in the dependencies
66+
if ! grep -qE "^rayon =" "$file"; then
67+
# Add rayon under the [dependencies] line
68+
sed -i '/\[dependencies\]/a rayon = "1.8.1"' "$file"
69+
fi
70+
done
71+
6472
- name: lint fix
6573
working-directory: ./commonlibrary_rust_ylong_runtime
6674
continue-on-error: true
67-
run: cargo dylint --all --workspace --fix -- --allow-dirty --allow-no-vcs --broken-code --lib
68-
75+
run: cargo dylint --all --workspace --fix -- --allow-dirty --allow-no-vcs --broken-code --lib
76+
6977
- name: cargo check
7078
working-directory: ./commonlibrary_rust_ylong_runtime
7179
run: cargo check
7280

7381
- name: git diff
7482
working-directory: ./commonlibrary_rust_ylong_runtime
75-
run: git diff
83+
run: git diff

0 commit comments

Comments
 (0)