Bump actions/upload-artifact from 5 to 7 #1372
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: rust-bench | |
| on: | |
| push: | |
| branches: [main] | |
| # Only run benches for pull requests | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| # Ensure only one run per branch/PR at a time. If new commits are pushed, | |
| # older jobs will be automatically canceled. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| codspeed: | |
| name: bench | |
| # Only run this job for non-draft pull requests. We still want the job to run | |
| # for pushes and manual `workflow_dispatch` events. GitHub exposes | |
| # `github.event.pull_request.draft` (true for draft PRs), so require it to | |
| # be false when the event is a pull_request. | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} | |
| # runs-on: ubuntu-latest | |
| runs-on: [self-hosted, macOS, ARM64] | |
| env: | |
| # Use a persistent target directory OUTSIDE the workspace to survive | |
| # runner cleanup | |
| CARGO_TARGET_DIR: /tmp/llkv-bench-target | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup rust toolchain and cache | |
| uses: moonrepo/setup-rust@v1 | |
| with: | |
| channel: stable | |
| cache-target: release | |
| - name: Clone and build custom codspeed-runner | |
| run: | | |
| set -euo pipefail | |
| REPO_URL="https://github.com/jzombie/codspeed-runner.git" | |
| BRANCH="feature/criterion-log-ingestion" | |
| DEST_DIR="codspeed-runner-src" | |
| rm -rf "${DEST_DIR}" || true | |
| git clone --depth 1 --branch "${BRANCH}" "${REPO_URL}" "${DEST_DIR}" | |
| cargo install --path "${DEST_DIR}" --root "$HOME/.local" --force | |
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| codspeed --version || true | |
| - name: Run Criterion benchmarks | |
| run: cargo bench --workspace | |
| - name: Ingest Criterion outputs and upload to CodSpeed | |
| id: ingest | |
| run: | | |
| set -euo pipefail | |
| TIMESTAMP=$(date +%s) | |
| PROFILE_DIR="codspeed-profile-${TIMESTAMP}" | |
| mkdir -p "${PROFILE_DIR}" | |
| codspeed ingest-criterion \ | |
| --criterion-dir "${CARGO_TARGET_DIR}/criterion" \ | |
| --profile-folder "${PROFILE_DIR}" \ | |
| --upload | |
| echo "profile_dir=${PROFILE_DIR}" >> "$GITHUB_OUTPUT" | |
| - name: Upload CodSpeed profile folder as artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: codspeed-profile | |
| path: ${{ steps.ingest.outputs.profile_dir }} |