diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml deleted file mode 100644 index e8a3bab..0000000 --- a/.github/workflows/changelog.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: changelog - -on: - push: - branches: [main] - -permissions: {} - -concurrency: - group: changelog - cancel-in-progress: true - -jobs: - regenerate: - if: ${{ !endsWith(github.actor, '[bot]') }} - runs-on: ubuntu-latest - permissions: {} # all repo access comes from the minted App token below - steps: - - name: Mint a changelog-bot token - id: app-token - uses: actions/create-github-app-token@v3 - with: - client-id: ${{ vars.CHANGELOG_APP_CLIENT_ID }} - private-key: ${{ secrets.CHANGELOG_APP_PRIVATE_KEY }} - permission-contents: write - permission-pull-requests: write - - name: Get changelog-bot user id - id: app-user - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - APP_SLUG: ${{ steps.app-token.outputs.app-slug }} - run: echo "id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" - - uses: actions/checkout@v5 - with: - fetch-depth: 0 # surface diff worktree + previous-tag lookup need history - token: ${{ steps.app-token.outputs.token }} - - uses: dtolnay/rust-toolchain@stable - # rustdoc JSON for the API surface diff is nightly-only - - run: rustup toolchain install nightly --profile minimal - - uses: Swatinem/rust-cache@v2 - # callgrind fallback for PMU-less runners - - run: sudo apt-get update -qq && sudo apt-get install -y -qq valgrind - - run: cargo install cargo-soothfast --locked - - run: cargo soothfast measure -p scry-core --save-baseline base - - name: Regenerate CHANGELOG.md - run: | - PREV=$(git describe --tags --abbrev=0 2>/dev/null || true) - AGAINST="" - [ -n "$PREV" ] && AGAINST="--against-ref $PREV" - # shellcheck disable=SC2086 # deliberate flag list - cargo soothfast report changelog -p scry-core -p scry-server --baseline base $AGAINST - - uses: peter-evans/create-pull-request@v8 - id: cpr - with: - token: ${{ steps.app-token.outputs.token }} - add-paths: CHANGELOG.md - commit-message: "docs: regenerate CHANGELOG.md" - title: "docs: regenerate CHANGELOG.md" - body: Automated CHANGELOG regeneration. - branch: bot/changelog-update - delete-branch: true - author: >- - ${{ steps.app-token.outputs.app-slug }}[bot] - <${{ steps.app-user.outputs.id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com> - - name: Merge pull request - if: steps.cpr.outputs.pull-request-number - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }} - run: gh pr merge --auto --squash --delete-branch "$PR_NUMBER" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e1e7cd..9d944af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,3 +18,23 @@ jobs: - run: cargo fmt --all -- --check - run: cargo clippy --workspace --all-targets -- -D warnings - run: cargo test --workspace + + soothfast: + # the bot's own merge must not regenerate again + if: github.event_name == 'pull_request' || !endsWith(github.actor, '[bot]') + runs-on: ubuntu-latest + environment: soothfast-bot + permissions: + contents: read + pull-requests: write + id-token: write + concurrency: + group: soothfast-${{ github.ref }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - uses: Verdenroz/soothfast@80b18d8831521646b65fec79c6df14d6f763c602 # v0.3.1 + with: + changelog-packages: scry-core scry-server diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e9c7605..f503807 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,11 @@ jobs: - uses: Swatinem/rust-cache@v2 # callgrind fallback for PMU-less runners - run: sudo apt-get update -qq && sudo apt-get install -y -qq valgrind - - run: cargo install cargo-soothfast --locked + # install only, pinned to Cargo.lock + - uses: Verdenroz/soothfast@80b18d8831521646b65fec79c6df14d6f763c602 # v0.3.1 + with: + gate: "false" + changelog: "false" - run: cargo soothfast measure -p scry-core --save-baseline base - run: cargo soothfast docs check - run: cargo soothfast docs build --baseline base diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml deleted file mode 100644 index bc3b6b9..0000000 --- a/.github/workflows/gate.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: gate - -on: - pull_request: - -permissions: - contents: read - -jobs: - gate: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - # callgrind fallback for PMU-less runners - - run: sudo apt-get update -qq && sudo apt-get install -y -qq valgrind - - run: cargo install cargo-soothfast --locked - - run: cargo soothfast gate -p scry-core --against-ref "origin/${{ github.base_ref }}" - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: soothfast-triage - path: .soothfast/triage/ diff --git a/CLAUDE.md b/CLAUDE.md index 3cc8dac..d243e3a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,7 +12,7 @@ cargo clippy --workspace --all-targets -- -D warnings # CI treats warnings as cargo fmt --all cargo soothfast measure -p scry-core --save-baseline base # refresh perf baseline -cargo soothfast gate -p scry-core --against-ref origin/main # what gate.yml runs on PRs +cargo soothfast gate -p scry-core --against-ref origin/main # what CI runs on PRs cargo soothfast docs check # doc claims vs the "base" baseline cargo soothfast docs build --baseline base # site to ./site (published by docs.yml) @@ -94,8 +94,12 @@ installed copies until the version is bumped in BOTH `crates/scry-core/benches/soothfast.rs`; `docs/search.md` carries claims checked against the `base` baseline (alloc claims are exact - changing a measured function usually means re-measuring and updating the claim); -`gate.yml` measures PRs against their merge-base, so perf regressions in -measured functions fail CI by design, not by flake. +the `soothfast` job in `ci.yml` (the `Verdenroz/soothfast` action) gates PRs +against their merge-base and posts the result as a soothfast-bot comment, so +perf regressions in measured functions fail CI by design, not by flake. On +pushes to `main` the same job refreshes the baseline and lands CHANGELOG.md +as a `bot/soothfast-update` PR. Bump the action ref together with the +`soothfast` dependency; the action installs the CLI matching `Cargo.lock`. ## Config diff --git a/Cargo.lock b/Cargo.lock index e4af64b..b2a02b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1681,9 +1681,9 @@ dependencies = [ [[package]] name = "soothfast" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf1b429cb7a92e37e3411d81016aa93c38d22785436e35c458969689857cb60a" +checksum = "eee2e9f08dd4a550a756da93a951bb3f75b45bf436178a49390c59dbbf2ff036" dependencies = [ "soothfast-macros", "soothfast-measure", @@ -1692,9 +1692,9 @@ dependencies = [ [[package]] name = "soothfast-macros" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba7f3aa53f43a53960700c23be45728d5682bd0a5fed236593138f72ee72195" +checksum = "6b4c2fad7e45ee0990ddda01ef33a9228262dcfe7661f048ba78af4440fdd181" dependencies = [ "proc-macro2", "quote", @@ -1703,9 +1703,9 @@ dependencies = [ [[package]] name = "soothfast-measure" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b17343b461f44a8dede52bc7127d000c12453c6c373a9da1a08b702baccb7a5" +checksum = "e5f5c4e43a480174069758e81d2e3c6de3804a2aeb41d97407d2534bc84b3c75" dependencies = [ "libc", "soothfast-registry", @@ -1713,9 +1713,9 @@ dependencies = [ [[package]] name = "soothfast-registry" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0364b471a7d03430c7a4d98df87deba1839be9f100d36fb3d8720eafb6dafd5" +checksum = "dec9776c4fa747bf57d02455aa8a8258a490b4a22f481694f69008800d67161a" dependencies = [ "linkme", ] diff --git a/crates/scry-core/Cargo.toml b/crates/scry-core/Cargo.toml index bf3c251..91c5519 100644 --- a/crates/scry-core/Cargo.toml +++ b/crates/scry-core/Cargo.toml @@ -40,5 +40,5 @@ tree-sitter-typescript = "0.23.2" xxhash-rust = { version = "0.8.18", features = ["xxh64"] } [dev-dependencies] -soothfast = { version = "0.2.0", features = ["runner"] } +soothfast = { version = "0.3.1", features = ["runner"] } tempfile = "3.27.0" diff --git a/crates/scry-core/benches/soothfast.rs b/crates/scry-core/benches/soothfast.rs index a7c1d75..20466c5 100644 --- a/crates/scry-core/benches/soothfast.rs +++ b/crates/scry-core/benches/soothfast.rs @@ -76,10 +76,13 @@ fn bench_chunk_rust(source: &str) { keep(scry_core::chunker::chunk_file("bench.rs", keep(source))); } +// Small enough that harness/codegen noise straddles the default threshold +// run-to-run. #[bench( group = "search", setup = symbol_table, - covers = "scry_core::search::expand_symbols" + covers = "scry_core::search::expand_symbols", + tolerance = "8%" )] fn bench_expand_symbols(symbols: &[String]) { keep(scry_core::search::expand_symbols(