Skip to content
Merged

180 #183

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/reusable-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,47 @@
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

benchmarks:
runs-on: ubuntu-latest
needs: ci
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v5

- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable

- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Run benchmarks
run: cargo bench --no-fail-fast --features benchmarks -- --save-baseline ci-baseline

- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: target/criterion/
retention-days: 30

- name: Download previous benchmark
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: benchmark-results
path: target/criterion-previous/

- name: Compare with baseline
continue-on-error: true
run: |
if [ -d "target/criterion-previous" ]; then
echo "Comparing with previous benchmark..."
cargo bench --features benchmarks -- --baseline ci-baseline --noplot
Comment on lines +316 to +318

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Baseline comparison ignores previous artifact

The new benchmarks job downloads the last run into target/criterion-previous, but the subsequent comparison runs cargo bench -- … --baseline ci-baseline using the default target/criterion directory produced earlier in the job. Because the previous data is never copied into target/criterion or passed via --baseline-dir, the command compares the current run against itself and will never report regressions. This defeats the purpose of the CI check while adding duplicate benchmark execution. Consider downloading old results before running benchmarks or pass --baseline-dir target/criterion-previous so the comparison uses historical data.

Useful? React with 👍 / 👎.

else
echo "No previous benchmark found, skipping comparison"
fi
Comment on lines +280 to +321

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 2 months ago

To fix the issue, explicitly declare a permissions block at the top level of the workflow or for each job. The minimal starting point is contents: read. For jobs that need to upload artifacts, coverage, or interact with pull requests, you may need to grant specific write permissions (e.g., pull-requests: write, contents: write, or actions: write), but unless otherwise required, keep permissions at the minimal necessary level. Add this block above jobs: to apply to all jobs unless overridden. In the file .github/workflows/reusable-ci.yml, insert:

permissions:
  contents: read

If certain jobs (such as coverage or benchmarks) require additional write permissions for actions like uploading artifacts, you can override on those jobs individually, but as a baseline, contents: read is safe.


Suggested changeset 1
.github/workflows/reusable-ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/reusable-ci.yml b/.github/workflows/reusable-ci.yml
--- a/.github/workflows/reusable-ci.yml
+++ b/.github/workflows/reusable-ci.yml
@@ -4,6 +4,9 @@
 
 name: Reusable CI
 
+permissions:
+  contents: read
+
 on:
   workflow_call:
     inputs:
EOF
@@ -4,6 +4,9 @@

name: Reusable CI

permissions:
contents: read

on:
workflow_call:
inputs:
Copilot is powered by AI and may make mistakes. Always verify output.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,3 @@ assert_eq!(problem.grpc.expect("grpc").name, "UNAUTHENTICATED");

MSRV: **1.90** · License: **MIT OR Apache-2.0** · No `unsafe`


Loading