mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-03-29 21:47:00 +02:00
Save benchmark cache even the job is failed (#5694)
Part of https://github.com/open-telemetry/opentelemetry-go/issues/4537, replace #5671 I tried to use `save-always` to simplify it, but this flag never worked. https://github.com/actions/cache/issues/1315. So, I split the cache action into two, one for restore and one for save. The save step would always run even if a step failed. Some actions I run to prove it could work: - On success: https://github.com/XSAM/opentelemetry-go/actions/runs/10292883964/job/28488154161 - On failure: https://github.com/XSAM/opentelemetry-go/actions/runs/10292907887/job/28488227777
This commit is contained in:
parent
6c099c2e60
commit
b5a9cfb832
18
.github/workflows/benchmark.yml
vendored
18
.github/workflows/benchmark.yml
vendored
@ -21,18 +21,12 @@ jobs:
|
||||
- name: Run benchmarks
|
||||
run: make benchmark | tee output.txt
|
||||
- name: Download previous benchmark data
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ./benchmarks
|
||||
# Use the current commit SHA as the cache key.
|
||||
# This key won't exist on the first run, so the cache match falls back to restore-keys.
|
||||
# Though, it won't be matched, the cache created will use this key as the cache key.
|
||||
# So the next commit will be able to restore this cache (from the restore-keys).
|
||||
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
|
||||
key: ${{ runner.os }}-benchmark-${{ github.sha }}
|
||||
# `github.event.before` means the commit before the push (i.e. the previous commit).
|
||||
# So we can fetch the exact benchmark data from the previous commit.
|
||||
restore-keys: ${{ runner.os }}-benchmark-${{ github.event.before }}
|
||||
key: ${{ runner.os }}-benchmark-${{ github.event.before }}
|
||||
- name: Store benchmarks result
|
||||
uses: benchmark-action/github-action-benchmark@v1.20.3
|
||||
with:
|
||||
@ -46,3 +40,11 @@ jobs:
|
||||
alert-threshold: "400%"
|
||||
# Add benchmark summary to GitHub workflow run report
|
||||
summary-always: true
|
||||
- name: Save benchmark data
|
||||
uses: actions/cache/save@v4
|
||||
# The cache will be saved even if a step fails.
|
||||
if: always()
|
||||
with:
|
||||
path: ./benchmarks
|
||||
# Use the current commit SHA as the cache key.
|
||||
key: ${{ runner.os }}-benchmark-${{ github.sha }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user