-
Notifications
You must be signed in to change notification settings - Fork 1
feat: publish nightly build benchmark #1145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,195 @@ | ||
| name: Build Comparison Benchmark | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'bench/blink/**' | ||
| - 'bench/fastled-examples/src/build_comparison.rs' | ||
| - 'bench/fastled-examples/Cargo.toml' | ||
| - '.github/workflows/benchmark-build-comparison.yml' | ||
| schedule: | ||
| # Off-hour UTC slot avoids the hosted-runner top-of-hour surge. | ||
| - cron: '17 9 * * *' | ||
|
|
||
| concurrency: | ||
| group: benchmark-build-comparison-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUSTFLAGS: '-D warnings' | ||
| PLATFORMIO_CORE_VERSION: '6.1.19' | ||
| ARDUINO_CLI_VERSION: '1.5.0' | ||
| ARDUINO_AVR_CORE_VERSION: '1.8.8' | ||
|
|
||
| jobs: | ||
| benchmark: | ||
| name: Measure and publish Blink builds | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 60 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: astral-sh/setup-uv@v3 | ||
|
|
||
| - name: Setup soldr | ||
| uses: zackees/setup-soldr@v0 | ||
| with: | ||
| version: 0.8.8 | ||
| cache: true | ||
| build-cache: true | ||
| target-cache: true | ||
| prebuild-deps: none | ||
| linker: platform-default | ||
| cache-payload-warn-bytes: 2GiB | ||
|
|
||
| - name: Install Arduino CLI | ||
| uses: arduino/setup-arduino-cli@v2 | ||
| with: | ||
| version: ${{ env.ARDUINO_CLI_VERSION }} | ||
|
|
||
| - name: Install benchmark toolchains | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| uv tool install "platformio==${PLATFORMIO_CORE_VERSION}" | ||
| arduino-cli core update-index | ||
| arduino-cli core install "arduino:avr@${ARDUINO_AVR_CORE_VERSION}" | ||
| pio pkg install --project-dir bench/blink --environment uno | ||
|
|
||
| - name: Build fbuild and benchmark runner | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| soldr cargo build --release \ | ||
| -p fbuild-cli --bin fbuild \ | ||
| -p fbuild-daemon --bin fbuild-daemon \ | ||
| -p fbuild-bench-fastled-examples --bin bench-build-comparison | ||
|
|
||
| - name: Prime package downloads outside timed measurements | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p benchmark-output/bootstrap-arduino | ||
| arduino-cli compile \ | ||
| --fqbn arduino:avr:uno \ | ||
| --build-path benchmark-output/bootstrap-arduino \ | ||
| bench/blink | ||
| target/release/fbuild build bench/blink -e uno --release | ||
| target/release/fbuild clean all bench/blink -e uno --release | ||
| rm -rf benchmark-output/bootstrap-arduino | ||
|
|
||
| - name: Restore rolling history | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p benchmark-stats | ||
| if git ls-remote --exit-code origin refs/heads/benchmark-stats >/dev/null; then | ||
| git fetch --depth=1 origin refs/heads/benchmark-stats | ||
| git show FETCH_HEAD:history.jsonl > benchmark-stats/history.jsonl | ||
| else | ||
| status=$? | ||
| if [[ "${status}" -eq 2 ]]; then | ||
| : > benchmark-stats/history.jsonl | ||
| else | ||
| exit "${status}" | ||
| fi | ||
| fi | ||
|
|
||
| - name: Run cold/warm comparison and render site | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| generated_at="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | ||
| target/release/bench-build-comparison \ | ||
| --project-dir bench/blink \ | ||
| --fbuild target/release/fbuild \ | ||
| --output-dir benchmark-stats \ | ||
| --trials 3 \ | ||
| --repository "${GITHUB_REPOSITORY}" \ | ||
| --git-sha "${GITHUB_SHA}" \ | ||
| --generated-at "${generated_at}" \ | ||
| --run-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \ | ||
| --pages-url https://fastled.github.io/fbuild/ \ | ||
| --raw-base-url https://github.com/ghraw/FastLED/fbuild/benchmark-stats | ||
|
|
||
| - name: Upload benchmark site snapshot | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: build-comparison-site-${{ github.sha }} | ||
| path: benchmark-stats | ||
| include-hidden-files: true | ||
| if-no-files-found: error | ||
| retention-days: 30 | ||
|
|
||
| - name: Upload benchmark log | ||
| if: always() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: build-comparison-log-${{ github.sha }} | ||
| path: benchmark-output/benchmark.log | ||
| if-no-files-found: warn | ||
| retention-days: 30 | ||
|
|
||
| publish: | ||
| name: Publish benchmark artifacts | ||
| needs: benchmark | ||
| if: ${{ needs.benchmark.result == 'success' && github.ref == 'refs/heads/main' }} | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: write | ||
| pages: write | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| steps: | ||
| - name: Download benchmark site snapshot | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: build-comparison-site-${{ github.sha }} | ||
| path: benchmark-stats | ||
|
|
||
| - name: Publish one-commit benchmark-stats branch | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -euo pipefail | ||
| publish_dir="$(mktemp -d)" | ||
| cp -a benchmark-stats/. "${publish_dir}/" | ||
| git -C "${publish_dir}" init | ||
| git -C "${publish_dir}" checkout -b benchmark-stats | ||
| git -C "${publish_dir}" config user.name 'github-actions[bot]' | ||
| git -C "${publish_dir}" config user.email '41898282+github-actions[bot]@users.noreply.github.com' | ||
| git -C "${publish_dir}" add . | ||
| git -C "${publish_dir}" commit -m "chore: publish build benchmark for ${GITHUB_SHA}" | ||
| git -C "${publish_dir}" remote add origin \ | ||
| "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | ||
| git -C "${publish_dir}" push --force origin benchmark-stats | ||
|
|
||
| - name: Configure GitHub Pages | ||
| uses: actions/configure-pages@v5 | ||
|
|
||
| - name: Upload GitHub Pages artifact | ||
| uses: actions/upload-pages-artifact@v4 | ||
| with: | ||
| path: benchmark-stats | ||
|
|
||
| deploy-pages: | ||
| name: Deploy benchmark report | ||
| needs: publish | ||
| runs-on: ubuntu-24.04 | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| permissions: | ||
| pages: write | ||
| id-token: write | ||
| steps: | ||
| - name: Deploy GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Blink build comparison | ||
|
|
||
| This directory is one shared Arduino Uno Blink sketch for the nightly | ||
| whole-build comparison. Arduino CLI, PlatformIO, and fbuild compile the exact | ||
| same `blink.ino` file for the Arduino Uno target. Each ecosystem's framework | ||
| distribution is pinned independently: `arduino:avr@1.8.8` for Arduino CLI and | ||
| `atmelavr@5.1.0` for PlatformIO/fbuild. | ||
|
|
||
| Each tool is measured for three trials by default: | ||
|
|
||
| - **Cold** removes project outputs and matching compiled framework caches before | ||
| compiling. Installed toolchains/framework packages and global | ||
| download/compiler caches remain available. | ||
| - **Warm** immediately repeats the same build without changing any input. | ||
|
|
||
| The Rust runner records every trial and publishes the median. Cold bars are | ||
| drawn behind narrower warm overlays using the same GitHub-dark gray, blue, and | ||
| red palette as the zccache and soldr benchmark graphics. | ||
|
|
||
| ## Run locally | ||
|
|
||
| Install Arduino CLI, its `arduino:avr` core, and PlatformIO first. Build fbuild | ||
| and run the harness through `soldr`: | ||
|
|
||
| ```bash | ||
| soldr cargo build --release -p fbuild-cli --bin fbuild -p fbuild-daemon --bin fbuild-daemon | ||
| soldr cargo run --release -p fbuild-bench-fastled-examples \ | ||
| --bin bench-build-comparison -- \ | ||
| --project-dir bench/blink \ | ||
| --fbuild target/release/fbuild \ | ||
| --output-dir benchmark-stats | ||
| ``` | ||
|
|
||
| The `target/release/fbuild` path above is for Linux and CI. On Windows, use | ||
| `target/x86_64-pc-windows-msvc/release/fbuild.exe`. | ||
|
|
||
| The nightly workflow installs and records pinned Arduino CLI and PlatformIO | ||
| versions, primes package downloads outside the timed region, carries forward a | ||
| 365-run `history.jsonl`, and publishes: | ||
|
|
||
| - `manifest.json` — stable discovery index for agents and other clients | ||
| - `latest.json` — full metadata, raw trials, and medians for the newest run | ||
| - `history.jsonl` — rolling compact history | ||
| - `benchmark.svg` — README graphic with cold/warm overlays | ||
| - `index.html` — human-facing GitHub Pages report | ||
|
|
||
| The `benchmark-stats` branch is force-published from a fresh repository on | ||
| every successful default-branch run, so its Git history always contains one | ||
| generated commit. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| void setup() { | ||
| pinMode(LED_BUILTIN, OUTPUT); | ||
| } | ||
|
|
||
| void loop() { | ||
| digitalWrite(LED_BUILTIN, HIGH); | ||
| delay(1000); | ||
| digitalWrite(LED_BUILTIN, LOW); | ||
| delay(1000); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [platformio] | ||
| src_dir = . | ||
|
|
||
| [env:uno] | ||
| platform = atmelavr@5.1.0 | ||
| board = uno | ||
| framework = arduino | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,10 @@ | ||
| # bench/fastled-examples/src | ||
|
|
||
| Source for the `bench-fastled-examples` binary. See the parent | ||
| [`README.md`](../README.md) for what the harness does and how to run it. | ||
| Sources for the repository's end-to-end benchmark binaries: | ||
|
|
||
| - `main.rs` implements `bench-fastled-examples`. | ||
| - `build_comparison.rs` implements the nightly Arduino CLI vs PlatformIO vs | ||
| fbuild Blink build comparison and static-site renderer. | ||
|
|
||
| See the parent [`README.md`](../README.md) for the FastLED harness and | ||
| [`../../blink/README.md`](../../blink/README.md) for the whole-build benchmark. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.