From 7524c7b0f9fcd70dade4c0772f042dcefe3da9d7 Mon Sep 17 00:00:00 2001 From: Raul Victor Trombin Date: Mon, 6 Nov 2023 15:09:02 -0300 Subject: [PATCH] github: action: Load cache from previous benchmarks --- .github/workflows/action.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index cc5b68d78b..e87ded044c 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -69,6 +69,24 @@ jobs: with: prefix-key: "rust-cache" shared-key: "benchmark" + - name: Get previous benchmark data + run: | + echo "Fetching gh-pages branch" + git fetch origin gh-pages + + echo "Checking out gh-pages branch" + git checkout gh-pages + + if [ ! -d "cache" ]; then + echo "Cache folder does not exist, creating it" + mkdir cache + fi + + echo "Copying data file from gh-pages to cache" + cp dev/cache/benchmark-data.json cache/benchmark-data.json || { echo "Failed to copy data file" ; exit 1; } + + echo "Checking out current preivous branch" + git checkout - - name: Cargo Bench run: cargo bench --jobs 1 --bench bench -- --output-format bencher | tee output.txt - name: Compare results & store cached results