Skip to content

Commit

Permalink
github: action: Save cache data to gh-page
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulTrombin committed Nov 6, 2023
1 parent 17a7405 commit a286bd5
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,57 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./pages

bench:
needs: build
runs-on: self-hosted
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@master
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
- name: Rust | Cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "rust-cache"
shared-key: "benchmark"
- name: Cargo Bench
run: cargo bench --jobs 1 --bench bench -- --output-format bencher | tee output.txt
- name: Compare results & store cached results
uses: benchmark-action/[email protected]
with:
tool: 'cargo'
output-file-path: output.txt
summary-always: true
alert-threshold: "110%"
fail-on-alert: true
external-data-json-path: ./cache/benchmark-data.json
skip-fetch-gh-pages: "true"
- name: Update data file
if: ${{ github.ref == 'refs/heads/master' }}
run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
git fetch origin gh-pages
git checkout gh-pages
if [ ! -d "dev/cache" ]; then
echo "Cache folder does not exist, creating it"
mkdir -p dev/cache
fi
cp cache/benchmark-data.json dev/cache/benchmark-data.json
tree cache
git add dev/cache/benchmark-data.json
git commit -m "Update benchmark-data file"
git push origin gh-pages
deploy:
needs: build
runs-on: ubuntu-latest
Expand Down

0 comments on commit a286bd5

Please sign in to comment.