Skip to content

Commit c810c1a

Browse files
use gha push_attempts
1 parent 8bddde5 commit c810c1a

4 files changed

Lines changed: 13 additions & 42 deletions

File tree

‎bench_runner/templates/_benchmark.src.yml‎

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,11 @@ jobs:
8383
# just pulled in in that case.
8484
git pull -s recursive -X ours --autostash --rebase
8585
- name: Add data to repo
86-
id: commit
8786
uses: EndBug/add-and-commit@cc9c08ba6c8df3b93a8f2db63e89b98368ae2ae8 #v11.1.1
8887
with:
8988
add: results
90-
push: false
91-
- name: Push results with retry
92-
if: ${{ steps.commit.outputs.committed == 'true' }}
93-
shell: powershell
94-
run: |
95-
$branch = $env:GITHUB_REF_NAME
96-
for ($attempt = 1; $attempt -le 5; $attempt++) {
97-
Write-Host "Push attempt $attempt to origin/$branch"
98-
git pull --rebase origin $branch
99-
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
100-
git push origin "HEAD:$branch"
101-
if ($LASTEXITCODE -eq 0) { exit 0 }
102-
if ($attempt -lt 5) {
103-
Start-Sleep -Seconds (Get-Random -Minimum 10 -Maximum 40)
104-
}
105-
}
106-
throw "Push failed after 5 attempts"
89+
pull: --rebase --autostash origin "${{ github.ref_name }}"
90+
push_attempts: 5
10791
- name: Upload artifacts
10892
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.0
10993
with:
@@ -141,30 +125,12 @@ jobs:
141125
# just pulled in in that case.
142126
git pull -s recursive -X ours --autostash --rebase
143127
- name: Adding data to repo
144-
id: commit
145128
if: ${{ !inputs.perf }}
146129
uses: EndBug/add-and-commit@cc9c08ba6c8df3b93a8f2db63e89b98368ae2ae8 #v11.1.1
147130
with:
148131
add: results
149-
push: false
150-
- &push-results-unix
151-
name: Push results with retry
152-
if: ${{ steps.commit.outputs.committed == 'true' }}
153-
shell: bash
154-
run: |
155-
branch="$GITHUB_REF_NAME"
156-
for attempt in 1 2 3 4 5; do
157-
echo "Push attempt $attempt to origin/$branch"
158-
git pull --rebase origin "$branch"
159-
if git push origin "HEAD:$branch"; then
160-
exit 0
161-
fi
162-
if [ "$attempt" -lt 5 ]; then
163-
sleep $(( RANDOM % 30 + 10 ))
164-
fi
165-
done
166-
echo "Push failed after 5 attempts" >&2
167-
exit 1
132+
pull: --rebase --autostash origin "${{ github.ref_name }}"
133+
push_attempts: 5
168134
- name: Upload benchmark artifacts
169135
if: ${{ !inputs.perf }}
170136
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.0
@@ -202,12 +168,11 @@ jobs:
202168
# just pulled in in that case.
203169
git pull -s recursive -X ours --autostash --rebase
204170
- name: Add data to repo
205-
id: commit
206171
uses: EndBug/add-and-commit@cc9c08ba6c8df3b93a8f2db63e89b98368ae2ae8 #v11.1.1
207172
with:
208173
add: results
209-
push: false
210-
- *push-results-unix
174+
pull: --rebase --autostash origin "${{ github.ref_name }}"
175+
push_attempts: 5
211176
- name: Upload artifacts
212177
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.0
213178
with:

‎bench_runner/templates/_find_failures.src.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ jobs:
2727
uses: EndBug/add-and-commit@cc9c08ba6c8df3b93a8f2db63e89b98368ae2ae8 #v11.1.1
2828
with:
2929
add: "['failures.md']"
30-
message: Benchmarking failures
30+
message: Benchmarking failures
31+
pull: --rebase --autostash origin "${{ github.ref_name }}"
32+
push_attempts: 5

‎bench_runner/templates/_generate.src.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ jobs:
5151
with:
5252
add: "['results', 'README.md', 'RESULTS.md', 'longitudinal.svg', 'longitudinal.json', 'configs.svg', 'configs.json', 'memory_long.svg', 'memory_long.json', 'memory_configs.svg', 'memory_configs.json']"
5353
message: Benchmarking results for @${{ github.actor }}
54+
pull: --rebase --autostash origin main
55+
push_attempts: 5

‎bench_runner/templates/_pystats.src.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,5 @@ jobs:
6464
uses: EndBug/add-and-commit@cc9c08ba6c8df3b93a8f2db63e89b98368ae2ae8 #v11.1.1
6565
with:
6666
add: results
67+
pull: --rebase --autostash origin "${{ github.ref_name }}"
68+
push_attempts: 5

0 commit comments

Comments
 (0)