Skip to content

Commit 8a03d54

Browse files
committed
remove continue on error and use github env
1 parent cc4eb56 commit 8a03d54

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

.github/workflows/bench-test.yaml

+31-21
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,23 @@ jobs:
5656
fi
5757
done
5858
59+
- name: initialize counters
60+
working-directory: ./${{ matrix.project }}
61+
run: |
62+
echo "for_loop_count=0" >> $GITHUB_ENV
63+
echo "for_loop_count_after=0" >> $GITHUB_ENV
64+
echo "iter_count=0" >> $GITHUB_ENV
65+
echo "iter_count_after=0" >> $GITHUB_ENV
66+
echo "iter_mut_count=0" >> $GITHUB_ENV
67+
echo "iter_mut_count_after=0" >> $GITHUB_ENV
68+
echo "into_iter_count=0" >> $GITHUB_ENV
69+
echo "into_iter_count_after=0" >> $GITHUB_ENV
70+
echo "par_iter_count=0" >> $GITHUB_ENV
71+
echo "into_par_iter_count=0" >> $GITHUB_ENV
72+
echo "par_iter_mut_count=0" >> $GITHUB_ENV
73+
5974
- name: count for loops
6075
working-directory: ./${{ matrix.project }}
61-
continue-on-error: true
6276
shell: bash
6377
run: |
6478
while read -r file; do
@@ -71,7 +85,6 @@ jobs:
7185
7286
- name: count iterator methods
7387
working-directory: ./${{ matrix.project }}
74-
continue-on-error: true
7588
shell: bash
7689
run: |
7790
# Initialize counters
@@ -114,49 +127,46 @@ jobs:
114127

115128
- name: count for loops after tool
116129
working-directory: ./${{ matrix.project }}
117-
continue-on-error: true
118130
shell: bash
119131
run: |
120132
while read -r file; do
121133
echo "Checking $file"
122-
for_loop_count_in_file=$(grep -oE 'for\s+(\([^)]+\)|\w+)\s+in\s+[^{]+' "$file" | wc -l)
123-
echo "Count in file: $for_loop_count_in_file"
124-
((for_loop_count += for_loop_count_in_file))
134+
for_loop_count_after_in_file=$(grep -oE 'for\s+(\([^)]+\)|\w+)\s+in\s+[^{]+' "$file" | wc -l)
135+
echo "Count in file: $for_loop_count_after_in_file"
136+
((for_loop_count_after += for_loop_count_after_in_file))
125137
done < <(find . -type f -name '*.rs')
126-
echo "for loop occurrences: $for_loop_count"
138+
echo "for loop occurrences: $for_loop_count_after"
127139
128140
- name: count iterator methods after tool
129141
working-directory: ./${{ matrix.project }}
130-
continue-on-error: true
131142
shell: bash
132143
run: |
133144
# Initialize counters
134-
iter_count=0
135-
iter_mut_count=0
136-
into_iter_count=0
145+
iter_count_after=0
146+
iter_mut_count_after=0
147+
into_iter_count_after=0
137148
138149
# Iterate over all .rs files in the current directory and subdirectories
139150
while read -r file; do
140151
echo checking $file
141152
# Count occurrences of iterator methods in the current file
142-
iter_count_in_file=$(grep -o '\.iter()' "$file" | wc -l)
143-
iter_mut_count_in_file=$(grep -o '\.iter_mut()' "$file" | wc -l)
144-
into_iter_count_in_file=$(grep -o '\.into_iter()' "$file" | wc -l)
153+
iter_count_after_in_file=$(grep -o '\.iter()' "$file" | wc -l)
154+
iter_mut_count_after_in_file=$(grep -o '\.iter_mut()' "$file" | wc -l)
155+
into_iter_count_after_in_file=$(grep -o '\.into_iter()' "$file" | wc -l)
145156
146157
# Update total counters
147-
((iter_count += iter_count_in_file))
148-
((iter_mut_count += iter_mut_count_in_file))
149-
((into_iter_count += into_iter_count_in_file))
158+
((iter_count_after += iter_count_after_in_file))
159+
((iter_mut_count_after += iter_mut_count_after_in_file))
160+
((into_iter_count_after += into_iter_count_after_in_file))
150161
done < <(find . -type f -name '*.rs')
151162
152163
# Print results
153-
echo ".iter() occurrences: $iter_count"
154-
echo ".iter_mut() occurrences: $iter_mut_count"
155-
echo ".into_iter() occurrences: $into_iter_count"
164+
echo ".iter() occurrences: $iter_count_after"
165+
echo ".iter_mut() occurrences: $iter_mut_count_after"
166+
echo ".into_iter() occurrences: $into_iter_count_after"
156167
157168
- name: par iter count
158169
working-directory: ./${{ matrix.project }}
159-
continue-on-error: true
160170
shell: bash
161171
run: |
162172
# Initialize counters

0 commit comments

Comments
 (0)