Skip to content

ci: use dawidd6/action-download-artifact for benching #17

ci: use dawidd6/action-download-artifact for benching

ci: use dawidd6/action-download-artifact for benching #17

Workflow file for this run

name: Bench
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
env:
RUST_NIGHTLY_TOOLCHAIN: nightly-2024-03-24
RUSTFLAGS: -C target-cpu=native -Zexport-executable-symbols -Zshare-generics=y -Zthreads=0
jobs:
export:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install cargo-export
uses: taiki-e/install-action@v2
with:
tool: cargo-export
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- uses: Swatinem/rust-cache@v2
- name: Run cargo export
run: cargo export target/benchmarks -- bench --bench=side_by_side
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: bench_side_by_side-${{ github.sha }}
path: target/benchmarks
compare:
if: github.event_name == 'pull_request' && github.base_ref == 'main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# download artifact from previous job
- name: Download Artifact
uses: dawidd6/action-download-artifact@v3
with:
commit: ${{ github.event.pull_request.base.sha }}
name: bench_side_by_side-${{ github.event.pull_request.base.sha }}
path: /tmp/bench/side_by_side
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- uses: Swatinem/rust-cache@v2
- name: get tree of /tmp/bench
run: tree /tmp/bench
- name: Run cargo bench
run: cargo bench --bench=side_by_side -- compare /tmp/bench/side_by_side-${{ github.event.pull_request.base.sha }}
- name: remove /tmp/bench
run: rm -rf /tmp/bench