Skip to content

fix order of build - #117

Merged
emuell merged 16 commits into
masterfrom
fix-build-order
Sep 30, 2026
Merged

emuell merged 16 commits into
masterfrom
fix-build-order

Conversation

@unlessgames

@unlessgames unlessgames commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Sorry, I overlooked the order being wrong in the build workflow, this should fix it..

Not sure how this could work but it would be nice to add a test around the doc workflow (similar to the benchmark/build test) that would let us know in a PR if the docs fail to build with the PR to avoid such errors being merged.

@github-actions

Copy link
Copy Markdown

Benchmark for 30630c0

Click to view benchmark
Test Base PR %
Cycle/Generate 37.6±0.60µs 37.2±0.39µs -1.06%
Cycle/Parse 252.5±5.24µs 251.8±3.57µs -0.28%
Rust Phrase/Clone 366.8±8.82ns 347.8±27.02ns -5.18%
Rust Phrase/Create 53.8±1.12µs 54.0±0.81µs +0.37%
Rust Phrase/Run 511.2±9.62µs 520.2±3.36µs +1.76%
Rust Phrase/Seek 77.3±133.65µs 92.3±165.86µs +19.40%
Scripted Phrase/Clone 546.7±6.59ns 537.4±3.97ns -1.70%
Scripted Phrase/Create 739.3±11.02µs 738.9±11.47µs -0.05%
Scripted Phrase/Run 1326.4±4.18µs 1336.3±6.57µs +0.75%
Scripted Phrase/Seek 108.3±223.19µs 106.2±218.05µs -1.94%

@emuell

emuell commented Sep 28, 2026

Copy link
Copy Markdown
Member

Let's also do doc generation, mdbook builds and link check in the test.yml workflow then? Everything except the page upload step.

@github-actions

Copy link
Copy Markdown

Benchmark for 00f7132

Click to view benchmark
Test Base PR %
Cycle/Generate 34.2±1.26µs 34.9±1.60µs +2.05%
Cycle/Parse 226.9±11.00µs 216.1±1.08µs -4.76%
Rust Phrase/Clone 263.7±1.85ns 264.6±1.49ns +0.34%
Rust Phrase/Create 46.0±2.11µs 45.6±1.42µs -0.87%
Rust Phrase/Run 402.0±10.01µs 396.8±7.40µs -1.29%
Rust Phrase/Seek 48.3±84.24µs 48.8±85.27µs +1.04%
Scripted Phrase/Clone 435.1±3.23ns 443.1±16.14ns +1.84%
Scripted Phrase/Create 670.7±35.49µs 687.5±44.09µs +2.50%
Scripted Phrase/Run 1140.4±64.51µs 1109.1±29.33µs -2.74%
Scripted Phrase/Seek 72.5±143.17µs 73.1±138.80µs +0.83%

@github-actions

Copy link
Copy Markdown

Benchmark for 4d122c6

Click to view benchmark
Test Base PR %
Cycle/Generate 47.7±0.64µs 47.5±0.45µs -0.42%
Cycle/Parse 358.9±7.55µs 356.5±7.86µs -0.67%
Rust Phrase/Clone 428.2±6.34ns 406.6±5.46ns -5.04%
Rust Phrase/Create 73.7±1.16µs 73.5±2.21µs -0.27%
Rust Phrase/Run 626.0±4.18µs 628.8±4.67µs +0.45%
Rust Phrase/Seek 132.3±243.97µs 133.0±242.88µs +0.53%
Scripted Phrase/Clone 648.8±17.04ns 665.9±6.93ns +2.64%
Scripted Phrase/Create 1016.8±21.16µs 1009.5±31.73µs -0.72%
Scripted Phrase/Run 1665.2±40.13µs 1641.4±13.47µs -1.43%
Scripted Phrase/Seek 217.4±439.53µs 224.7±455.78µs +3.36%

@unlessgames

Copy link
Copy Markdown
Collaborator Author

Think I got it working now!
A few changes

  • the pages and benchmarking only runs after the build have passed successfully
  • updated versions for various actions
  • rust is cached between the build and the benchmark
  • the build uses clippy and fails if there are clippy warnings in the project (to satisfy this, I had to fix a few files, can revert if we dont want this)
  • instead of building mdbook from source we use the mdbook action with latest version, this doesn't pin mdbook (unfortunately the action can only do latest or exact version) but I think that's alright as it will run on PRs, if a later mdbook breaks the build we will know it and can either fix it or change to exact version if it's too much of a hassle

@github-actions

Copy link
Copy Markdown

Benchmark for 905c8f1

Click to view benchmark
Test Base PR %
Cycle/Generate 47.3±0.61µs 47.3±0.41µs 0.00%
Cycle/Parse 353.5±6.03µs 348.7±6.17µs -1.36%
Rust Phrase/Clone 424.1±10.98ns 406.8±8.88ns -4.08%
Rust Phrase/Create 72.3±1.76µs 72.7±3.67µs +0.55%
Rust Phrase/Run 624.0±7.67µs 626.3±4.05µs +0.37%
Rust Phrase/Seek 133.1±245.13µs 132.2±242.28µs -0.68%
Scripted Phrase/Clone 646.3±10.29ns 650.8±10.34ns +0.70%
Scripted Phrase/Create 996.3±27.28µs 1001.0±16.29µs +0.47%
Scripted Phrase/Run 1642.5±16.71µs 1627.8±12.99µs -0.89%
Scripted Phrase/Seek 215.8±436.69µs 212.5±428.54µs -1.53%

@github-actions

Copy link
Copy Markdown

Benchmark for 1b7e1bd

Click to view benchmark
Test Base PR %
Cycle/Generate 47.5±0.72µs 48.9±1.63µs +2.95%
Cycle/Parse 358.7±4.83µs 362.2±8.40µs +0.98%
Rust Phrase/Clone 423.7±3.98ns 413.0±6.55ns -2.53%
Rust Phrase/Create 73.8±0.75µs 74.5±2.80µs +0.95%
Rust Phrase/Run 619.5±6.41µs 645.5±5.33µs +4.20%
Rust Phrase/Seek 133.6±245.19µs 133.9±245.88µs +0.22%
Scripted Phrase/Clone 671.1±10.79ns 653.1±11.36ns -2.68%
Scripted Phrase/Create 1012.5±16.62µs 1022.5±35.29µs +0.99%
Scripted Phrase/Run 1668.7±22.07µs 1674.1±17.41µs +0.32%
Scripted Phrase/Seek 214.5±435.18µs 215.3±435.04µs +0.37%

@github-actions

Copy link
Copy Markdown

Benchmark for 8d536b2

Click to view benchmark
Test Base PR %
Cycle/Generate 29.2±0.84µs 30.5±0.37µs +4.45%
Cycle/Parse 216.2±7.70µs 222.1±8.44µs +2.73%
Rust Phrase/Clone 246.0±5.85ns 262.0±3.31ns +6.50%
Rust Phrase/Create 43.7±4.00µs 45.7±1.04µs +4.58%
Rust Phrase/Run 372.9±15.57µs 409.6±11.76µs +9.84%
Rust Phrase/Seek 39.6±66.86µs 44.5±79.51µs +12.37%
Scripted Phrase/Clone 417.8±5.90ns 420.0±15.18ns +0.53%
Scripted Phrase/Create 549.3±10.95µs 553.1±20.34µs +0.69%
Scripted Phrase/Run 1024.6±72.49µs 1051.7±18.97µs +2.64%
Scripted Phrase/Seek 54.8±108.80µs 59.7±113.62µs +8.94%

on:
push:
branches: [ "master" ]
# allow running the workflow from the actions tab

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This was nice to have. I think we should keep it.

run: cargo test --verbose

benchmark:
needs: build

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we need a if: github.event_name == 'pull_request' here too, so benchmark isn't run again when a PR gets merged.

Comment thread .github/workflows/benchmark.yml Outdated
@@ -1,8 +1,11 @@
name: Benchmark

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This got quite complicated now. I think we should merge benchmark.yml into build.yml, so we only have two self-contained workflows:

  • build.yml: build, clippy and tests on push and pull_request, and the benchmark only if: github.event_name == 'pull_request'`.
  • pages.yml: API docs generation, mdbook and link check on push and pull_request, and publishing only if: github.ref_name == 'master'.

Both can then have separate concurrency and cache. Actually I don't think we need to specify a cache key then as it will pick up by default the branch name.

Having workflow_dispatch in both also wouldn't hurt.

Comment thread src/bindings/note.rs Outdated
|lua, (ud, value): (LuaAnyUserData, LuaValue)| {
let mut this = ud.borrow_mut::<Self>()?;
let steps = transpose_steps_array_from_value(lua, value, this.notes.len())?;
for (note, step) in this.notes.iter_mut().zip(steps.into_iter()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let me split those from this PR and fix this in master, so we get a clean baseline...

@github-actions

Copy link
Copy Markdown

Benchmark for 147212c

Click to view benchmark
Test Base PR %
Cycle/Generate 47.9±0.20µs 48.0±0.48µs +0.21%
Cycle/Parse 323.6±6.27µs 326.4±4.39µs +0.87%
Rust Phrase/Clone 458.7±6.24ns 440.7±3.51ns -3.92%
Rust Phrase/Create 70.5±3.22µs 70.7±1.06µs +0.28%
Rust Phrase/Run 663.0±7.99µs 651.5±5.22µs -1.73%
Rust Phrase/Seek 135.4±249.21µs 139.3±257.81µs +2.88%
Scripted Phrase/Clone 698.3±16.79ns 694.4±24.60ns -0.56%
Scripted Phrase/Create 967.6±12.15µs 972.7±22.88µs +0.53%
Scripted Phrase/Run 1711.9±17.57µs 1706.7±15.55µs -0.30%
Scripted Phrase/Seek 225.7±457.51µs 222.1±449.75µs -1.60%

@emuell

emuell commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

I think we should merge benchmark.yml into build.yml

Something like that could work (untested):

name: Build & Test

on:
  push:
    branches: ["master"]
  pull_request:
    branches: ["master"]
  # allow running the workflow from the actions tab
  workflow_dispatch:

# Cancel outdated PR runs
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          submodules: recursive

      - name: Install Rust
        uses: actions-rust-lang/setup-rust-toolchain@v2
        with:
          components: clippy

      - name: Build
        run: cargo build --verbose

      - name: Clippy
        run: cargo clippy --verbose -- -D warnings

      - name: Tests
        run: cargo test --verbose

  benchmark:
    # Only benchmark PRs against their base branch
    needs: build
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          submodules: recursive

      - name: Install Rust
        uses: actions-rust-lang/setup-rust-toolchain@v2

      - name: Benchmark
        uses: boa-dev/criterion-compare-action@v3
        with:
          branchName: ${{ github.base_ref }}

pages.yml, deploy would then also run with:

on:
  push:
    branches: ["master"]
  pull_request:
    branches: ["master"]
  # allow running the workflow from the actions tab
  workflow_dispatch:
  
  [...]
  
  deploy:
    # Deploy the artifact uploaded by the docs job
    needs: build
    if: github.ref_name == 'master'

@github-actions

Copy link
Copy Markdown

Benchmark for c9bf58b

Click to view benchmark
Test Base PR %
Cycle/Generate 47.2±0.54µs 47.9±0.69µs +1.48%
Cycle/Parse 349.3±6.51µs 351.6±12.47µs +0.66%
Rust Phrase/Clone 406.1±2.91ns 406.9±2.64ns +0.20%
Rust Phrase/Create 72.6±2.49µs 71.9±0.73µs -0.96%
Rust Phrase/Run 630.0±4.19µs 630.0±4.52µs 0.00%
Rust Phrase/Seek 132.8±243.89µs 135.6±249.50µs +2.11%
Scripted Phrase/Clone 660.0±6.37ns 644.0±14.81ns -2.42%
Scripted Phrase/Create 1012.6±26.01µs 999.2±26.00µs -1.32%
Scripted Phrase/Run 1643.9±17.26µs 1649.7±11.74µs +0.35%
Scripted Phrase/Seek 214.6±433.76µs 213.9±430.38µs -0.33%

@unlessgames

Copy link
Copy Markdown
Collaborator Author

Made the changes you've requested.

How about this last commit: the benchmark will only run if any rust file had been changed inside src or benches (or Cargo.toml has been changed). This saves energy when the PR has nothing to do with the performance of pattrns.

@emuell

emuell commented Sep 30, 2026

Copy link
Copy Markdown
Member

Yes, that's nice. Added types/**/*lua as well, because some of those Lua files are included from the source. Added back the concurrency stuff as well.

@emuell
emuell merged commit 8505bfe into master Sep 30, 2026
5 checks passed
@emuell
emuell deleted the fix-build-order branch September 30, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants