luau/.github/workflows/push-results/action.yml
Allan N Jeremy 366df96393
Feat: Added retry functionality to benchmarks (#667)
Resolves #668 

## The problem
Benchmarks jobs run concurrently for the different operating systems.
This means that when it comes time to push the benchmark results to [the
assigned benchmark results
repo](https://github.com/luau-lang/benchmark-data), there can be two
different jobs trying to push changes at the same time. In such a case,
one of the pushes will fail and we end up missing some benchmark results
data from the workflow run.

## The solution
Whenever a push fails, we need to retry the steps leading up to the push
(checking out the benchmark results repo, storing benchmark results,
pushing the results to [a specific
repo](https://github.com/luau-lang/benchmark-data)).

### Note
There are 3 push attempts before submitting to failure.

## TL;DR
This PR retries pushing benchmark results when they fail to get pushed
(often due to pushing from multiple jobs concurrently)

Co-authored-by: Jamie Kuppens <reshurum@gmail.com>
Co-authored-by: Ignacio Falk <flakolefluk@gmail.com>
2022-09-12 08:45:55 -07:00

63 lines
1.7 KiB
YAML

name: Checkout & push results
description: Checkout a given repo and push results to GitHub
inputs:
repository:
required: true
type: string
description: The benchmark results repository to check out
branch:
required: true
type: string
description: The benchmark results repository's branch to check out
token:
required: true
type: string
description: The GitHub token to use for pushing results
path:
required: true
type: string
description: The path to check out the results repository to
bench_name:
required: true
type: string
bench_tool:
required: true
type: string
bench_output_file_path:
required: true
type: string
bench_external_data_json_path:
required: true
type: string
runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.branch }}
token: ${{ inputs.token }}
path: ${{ inputs.path }}
- name: Store results
uses: Roblox/rhysd-github-action-benchmark@v-luau
with:
name: ${{ inputs.bench_name }}
tool: ${{ inputs.bench_tool }}
gh-pages-branch: ${{ inputs.branch }}
output-file-path: ${{ inputs.bench_output_file_path }}
external-data-json-path: ${{ inputs.bench_external_data_json_path }}
- name: Push benchmark results
shell: bash
run: |
echo "Pushing benchmark results..."
cd gh-pages
git config user.name github-actions
git config user.email github@users.noreply.github.com
git add *.json
git commit -m "Add benchmarks results for ${{ github.sha }}"
git push
cd ..