Skip to content

workflows/editorconfig: drop and move to treefmt#405684

Merged
Mic92 merged 2 commits intoNixOS:masterfrom
wolfgangwalther:ci-treefmt-editorconfig
May 10, 2025
Merged

workflows/editorconfig: drop and move to treefmt#405684
Mic92 merged 2 commits intoNixOS:masterfrom
wolfgangwalther:ci-treefmt-editorconfig

Conversation

@wolfgangwalther
Copy link
Contributor

We already have treefmt running for nixfmt, so it's easy to just add another formatter to it. This gives a much better UX, because all formatting errors are reported through the same channel.

It also saves us one CI job, which takes most of the time to just set up the machine, clone the repo and download Nix - while doing a minimum of actual work.

Total execution time for treefmt is ~10% slower:

  • 39s only nixfmt
  • 43s nixfmt + editorconfig-checker

Also, because we're not checking only changed files anymore, we're not going to have editorconfig failures sneak in over time as they did before.

Some raw numbers (AMD Ryzen 9 3950X 16-Core):

Benchmark 1: treefmt --ci
  Time (mean ± σ):     42.621 s ±  0.592 s    [User: 567.085 s, System: 30.949 s]
  Range (min … max):   41.897 s … 43.668 s    10 runs
Benchmark 2: treefmt --ci -f nixfmt
  Time (mean ± σ):     38.886 s ±  0.405 s    [User: 447.413 s, System: 12.945 s]
  Range (min … max):   38.052 s … 39.348 s    10 runs
Benchmark 3: treefmt --ci -f editorconfig-checker
  Time (mean ± σ):      6.963 s ±  0.139 s    [User: 116.637 s, System: 13.147 s]
  Range (min … max):    6.579 s …  7.035 s    10 runs

Actions Performance Metrics (avg run time):

  • editorconfig-v2.yml: 54s
  • check-nix-format.yml: 2m 24s

This will most likely have minimal effect on the runtime of the check-format workflow, but save the whole editorconfig-v2 workflow.

Things done

Tested locally.


Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: policy discussion Discuss policies to work in and around Nixpkgs backport release-24.11 labels May 9, 2025
We already have treefmt running for nixfmt, so it's easy to just add
another formatter to it. This gives a much better UX, because all
formatting errors are reported through the same channel.

It also saves us one CI job, which takes most of the time to just set up
the machine, clone the repo and download Nix - while doing a minimum of
actual work.

Total execution time for treefmt is ~10% slower:
- 38s only nixfmt
- 43s nixfmt + editorconfig-checker
@wolfgangwalther wolfgangwalther force-pushed the ci-treefmt-editorconfig branch from d2cbac7 to ba4fe10 Compare May 9, 2025 19:09
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels May 9, 2025
Same reasoning as the commit before, but keep-sorted has even less
overhead than editorconfig-checker. Benchmark has it at 1 second per
run.
@wolfgangwalther
Copy link
Contributor Author

wolfgangwalther commented May 9, 2025

I added a second commit to do the same for the keep-sorted workflow. This has a higher impact than the editor config change:

  • The runtime is only 1 sec for keep-sorted, so a separate workflow is even more wasted.
  • While editorconfig is ideally handled by the editor, keep-sorted is not. UX wasn't that good, so far - but now every keep-sorted problem will just be automatically handled by treefmt as well. Super simple.
Benchmark 4: treefmt --ci -f keep-sorted
  Time (mean ± σ):     998.1 ms ±   5.9 ms    [User: 1176.2 ms, System: 1026.1 ms]
  Range (min … max):   990.0 ms … 1008.0 ms    10 runs

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

Great find and good fix, @wolfgangwalther.

@Mic92 Mic92 merged commit 3137268 into NixOS:master May 10, 2025
27 checks passed
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented May 10, 2025

Backport failed for release-24.11, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-24.11
git worktree add -d .worktree/backport-405684-to-release-24.11 origin/release-24.11
cd .worktree/backport-405684-to-release-24.11
git switch --create backport-405684-to-release-24.11
git cherry-pick -x ba4fe10465e752d701e44bb8c5a8fc670b3845a1 1cb7a384e022733ba8c1387a9aef9ad382c86394

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: policy discussion Discuss policies to work in and around Nixpkgs 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants