Commit Graph

963 Commits

Author SHA1 Message Date
Wolfgang Walther
c18d1e4af8 actions/checkout: always checkout pinned commits
With the latest performance improvements, this only adds up to 1s, but
reduces complexity in managing pinned checkouts explicitly, especially
when we need *both* pinned checkouts in the next commit.
2025-08-22 12:54:28 +02:00
Wolfgang Walther
fb32eb0f29 actions/checkout: use single tmpfs with subfolders
This fixes problems on darwin, where the new tmpfs folder would not be
fully empty, but git only creates worktrees on fully empty directories.
2025-08-22 09:45:34 +02:00
Wolfgang Walther
4b4aa628da actions/checkout: parallelize checkout of multiple commits on tmpfs
Instead of fetching up to 3 times on each new checkout, we now fetch all
the commits we're going to need at once. Afterwards, we checkout the
different worktrees in parallel, which doesn't give us much, yet,
because it would still be IO-bound on its own. Inconsistent IO
performance on disk is also the biggest limitation for checkout right
now, where checkout times range everywhere from 20s to 40s.

By checking out the worktrees on a tmpfs, the actual checkout only takes
1s and benefits from parallelization. The overall checkout time is now
8-11s, depending on the number of commits.

That's a reduction of 10-30s and we get this speedup for almost every
job in the PR workflow, which is huge.

This potentially has a nice side-effect for Eval, too: Because the repo
is in RAM, Eval seems to run slightly faster, up to 10 seconds less.
2025-08-21 21:53:49 +02:00
Wolfgang Walther
d20a6a3f8f ci/github-script/prepare: move more steps from workflow (#435302) 2025-08-20 16:57:23 +00:00
Wolfgang Walther
ac93865697 workflows/build: prevent pushing tarball to cachix
By definition the tarball changes on every commit, so it makes no sense
to cache it - it will just waste disk space.
2025-08-20 18:08:43 +02:00
Wolfgang Walther
795dd01e31 workflows/eval: add cachix
At this stage, this only allows faster iteration when working on CI in
forks.
2025-08-20 18:08:39 +02:00
Wolfgang Walther
6ee40e7931 workflows/lint: add cachix
For PRs targeting a fast moving branch like master, it might not
actually help because the merge commit will still be different on each
run. But on slower moving branches or when testing in a fork, it can
speed things up.

Since each of these build results is only a few hundred bytes without
any dependencies, it has essentially no cost.

Not adding this to `treefmt`, because this looks at *all* the files in
the repo, so needs to re-run even when iterating on CI only.
2025-08-20 18:08:06 +02:00
Wolfgang Walther
2400bdf0d4 workflows: never push source to cachix
Pushing the source path to cachix is pointless, because the only source
we're using is Nixpkgs - and that will always be available already via
checkout. No need to ever substitute it, so no need to push it either.
2025-08-20 18:06:30 +02:00
Wolfgang Walther
025424913f workflows: support cachix in forks
This allows setting up a custom cachix cache in a contributor's fork.
That's most valuable when working on CI itself, testing and interating
in a fork. It's required when working on cachix related features
directly.
2025-08-20 18:06:26 +02:00
Wolfgang Walther
f35d1cd2cc workflows/pr.prepare: specify cone mode explicitly
This is the default, but who's supposed to know about that? Let's make
it explicit to be clear about the availability of files in `ci/`.
2025-08-20 18:03:41 +02:00
Wolfgang Walther
46a1b0a7bc ci/github-script/prepare: determine changed files 2025-08-20 17:18:36 +02:00
Wolfgang Walther
4220a03df8 ci/github-script/prepare: classify branches 2025-08-20 17:18:25 +02:00
Wolfgang Walther
9caf455441 ci/github-script/prepare: load systems 2025-08-20 17:17:12 +02:00
Wolfgang Walther
7ab632b30f actions/checkout: rename inconsistent pinned-from input 2025-08-20 17:17:07 +02:00
Wolfgang Walther
b51e104439 actions/checkout: rename from actions/get-merge-commit
This moves the logic to "check whether the PR can be merged and
determine the relevant commits" into the PR / prepare job directly -
since that's the only place where it is supposed to be used.

Because of the if condition in get-merge-commit, this logic was run
multiple times, for example in the lint workflow, where only one of
targetSha or mergedSha was provided as input. However, this input was
thrown away directly. This might not be a big problem, because this was
not expensive, so far. But with the next commit, this will become more
so.

This also separates the logic a bit cleaner - `prepare` figures out all
the parameters for the whole PR workflow, while `checkout` handles the
consistency around these checkouts.
2025-08-20 17:17:04 +02:00
Wolfgang Walther
ddf81dead6 workflows/reviewers: integrate codeowner reviews
These two jobs mostly used the same code anyway, so they can easily run
in the same job. This uses fewer resources and avoids running (and
failing) the codeowners review job on Pull Requests from development
branches like staging-next or haskell-updates.

It also opens the door for more improvements later on, for example it
will be much easier to implement a shared reviewer limit for both owners
and maintainers now.
2025-08-20 15:38:35 +02:00
Wolfgang Walther
7f4dd7e2ff workflows/reviewers: remove pull_request trigger
Changes to this file already trigger a run of this workflow via the PR
workflow, we don't need to run this *another* time.
2025-08-20 15:38:29 +02:00
Wolfgang Walther
15be04f7a2 workflows/check: move owners check job from codeowners
This runs the "check owners" job as part of the main PR workflow, with
multiple advantages:
- The job doesn't run anymore when undrafting a PR, where it's not
required, because the OWNERS file's contents didn't change.
- A valid OWNERS file is now a requirement to merge a PR.
- The OWNERS file is always checked on the exact same test merge commit
that the remainder of the workflows are running on as well.
2025-08-20 15:38:25 +02:00
Wolfgang Walther
368a2d6254 workflows/codeowners: split comment for each job
Allows splitting the workflow file in the next step.
2025-08-20 15:33:34 +02:00
Wolfgang Walther
c962461556 workflows/codeowners: move global env into jobs
Preparation to split the whole file.
2025-08-20 15:33:31 +02:00
Wolfgang Walther
c787c66de6 ci/github-script/prepare: init from actions/get-merge-commit
This just moves the code over to ci/github-script to make it easy to
test and iterate on locally.

The name `prepare` is chosen, because the script will be extended with
the other steps from "PR / prepare" next.
2025-08-20 15:16:15 +02:00
Wolfgang Walther
f5c5bc25ea workflows/eval: run misc job with same merge commit
This was an oversight when we introduced the ability for
`get-merge-commit` to take the pre-computed sha as input.
2025-08-20 15:16:11 +02:00
Wolfgang Walther
a895a97bec workflows/merge-group: init (#431146) 2025-08-14 07:28:03 +00:00
Wolfgang Walther
0dff5ad6c5 workflows/check: use regular checkout
The filtered checkout we used before was a nice idea, but only worked
for small numbers of commits in a PR. It would fetch the whole history
initially, but only fetch objects on demand. This turns out to be much
too slow in a PR with 18 commits, regularly hitting the 10 minute
timeout, even when running it locally.

The new approach uses regular checkouts again. In contrast to the old
style, before we switched to the filtered checkout, this only fetches
exactly the commits we need - and all of them at once. This is
significantly faster than both other approaches, and scales much better.
A bigger number of commits doesn't have much of an effect, if any at
all.
2025-08-13 14:02:39 +02:00
Wolfgang Walther
01c648c54b workflows/check: allow more time for check cherry picks job (#433074) 2025-08-12 17:14:14 +00:00
Wolfgang Walther
d1bb35448a workflows/pr: fix condition for no-pr-failures job
The `cancelled()` condition seems to only apply when *the whole
workflow* was cancelled. This is not the case when a single job is
cancelled due to timeout.

We can replicate this by checking each needs.result manually.
2025-08-12 15:39:12 +02:00
Wolfgang Walther
17b1c6cb3d workflows/check: allow more time for check cherry picks job
This currently times out after 3 minutes. Give it a bit more time. 10
minutes might be excessive, but we only really want to guard against a
stuck job taking 6 hours.
2025-08-12 14:08:48 +02:00
Wolfgang Walther
06f574addf workflows/pr: block merging PRs when jobs have been cancelled
This currently happens, for still unknown reasons, for the "check cherry
picks" job. The job gets cancelled by GHA mid-way. This should be the
same as an error, because an important check didn't run: Merging should
be blocked and auto-merge should not succeed.
2025-08-12 13:06:09 +02:00
Wolfgang Walther
372d9eeeaf workflows/backport: fix token permissions (#433035) 2025-08-12 09:17:37 +00:00
Wolfgang Walther
267d5cdf64 workflows/eval: fix compare job not running
The conclusion of the `versions` job propagates from through `eval` to
`compare`, which meant the `compare` job was skipped. No rebuild labels,
no reviewer requests.

Also, we don't want to run eval when `versions` runs, but fails.
2025-08-12 10:58:45 +02:00
Wolfgang Walther
bb1529ef6a workflows/backport: fix token permissions
The additional `workflows` permissions are required to backport
Dependabot updates. The permissions had been added to the app a while
ago, but we forgot to actually use them.
2025-08-12 10:30:03 +02:00
Wolfgang Walther
b523f257ac workflows/eval: test all available versions
With this change, we start running Eval on all available Lix and Nix
versions. Because this requires a lot of resources, this complete test
is only run when `ci/pinned.json` is updated.

The resulting outpaths are checked for consistency with the target
branch. A difference will cause the `report` job to fail, thus blocking
the merge, ensuring Eval consistency for Nixpkgs across different
versions.

This implements a kind of "ratchet style" check: Since we originally
confirmed that the versions currently in Nixpkgs at the time of this
commit match Eval behavior of Nix 2.3, we can ensure consistency with
Nix 2.3 down the road, even without testing for it explicitly.

There had been one regression in Eval consistency for Nix between 2.18
and 2.24 - two tests in `tests.devShellTools` produce different results
between Lix 2.91+ (which was forked from Nix 2.18) and Nix 2.24+. I
assume it's unlikely that such a change would be "fixed" by now, thus I
added an exception for these.

As a bonus, we also present the total time in seconds it takes for Eval
to complete for every tested version in a summary table. This allows us
to easily see performance improvements for Eval due to version updates.
At this stage, this time only includes the "outpaths" step of Eval, but
not the generation of attrpaths beforehand.
2025-08-12 10:14:01 +02:00
Wolfgang Walther
51e6b0e40b workflows: fix actions/download-artifact hashes
The Dependabot update change the hashes to the latest main branch commit
instead of the v5.0.0 tag - also it didn't adjust the tags in the
comments accordingly. Last but not least, one of the references used a
`@v5` reference instead of the commit hash. The latter is probably what
Dependabot tripped on.
2025-08-12 10:13:55 +02:00
Wolfgang Walther
56d29bbae1 workflows/build: build shells on a single darwin runner only
Because we have Rosetta, we can use a single darwin runner to build both
shells. Most time is spent for downloading Nix and checking out Nixpkgs
anyway and this can be saved if only run once.

Also, this prepares for the deprecation of the old macos-13 runners,
which were based on x86_64 CPUs in September 2025:
https://github.blog/changelog/2025-07-11-upcoming-changes-to-macos-hosted-runners-macos-latest-migration-and-xcode-support-policy-updates/
2025-08-11 18:05:20 +02:00
Wolfgang Walther
f105ab12f6 workflows/build: avoid downloading from cachix
This avoids downloading results from cachix, when they don't need to be
rebuilt, which just wastes time and resources.
2025-08-11 18:05:18 +02:00
Wolfgang Walther
8a9f0b8a47 workflows: checkout pinned nixpkgs explicitly
This is slightly faster than downloading and extracting a tarball and
additionally allows a sparse checkout. No need to download docs or nixos
for our purpose.

The data is quite noisy, but suggests improvements from anywhere between
5-15 seconds for each job using the pinned nixpkgs.
2025-08-11 17:57:11 +02:00
Wolfgang Walther
de7aa9f213 workflows: remove extra_nix_config.sandbox
This is true by default anyway.
2025-08-11 17:54:13 +02:00
Wolfgang Walther
da4839720b build(deps): bump actions/create-github-app-token from 2.0.6 to 2.1.0 (#432840) 2025-08-11 15:43:00 +00:00
Wolfgang Walther
5e304bcc37 build(deps): bump actions/checkout from 4.2.2 to 5.0.0 (#432842) 2025-08-11 15:33:46 +00:00
Wolfgang Walther
e86d3828cf build(deps): bump actions/download-artifact from 4 to 5 (#432841) 2025-08-11 15:33:35 +00:00
dependabot[bot]
b455a0a294 build(deps): bump cachix/install-nix-action from 31.4.1 to 31.5.2
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 31.4.1 to 31.5.2.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Changelog](https://github.com/cachix/install-nix-action/blob/master/RELEASE.md)
- [Commits](f0fe604f8a...fc6e360bed)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-version: 31.5.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-11 15:07:05 +00:00
dependabot[bot]
593aee095f build(deps): bump actions/checkout from 4.2.2 to 5.0.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](11bd71901b...08c6903cd8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-11 15:06:58 +00:00
dependabot[bot]
c44f3e4699 build(deps): bump actions/download-artifact from 4 to 5
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-11 15:06:46 +00:00
dependabot[bot]
d1d2650cba build(deps): bump actions/create-github-app-token from 2.0.6 to 2.1.0
Bumps [actions/create-github-app-token](https://github.com/actions/create-github-app-token) from 2.0.6 to 2.1.0.
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Commits](df432ceedc...0f859bf9e6)

---
updated-dependencies:
- dependency-name: actions/create-github-app-token
  dependency-version: 2.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-11 15:06:38 +00:00
Wolfgang Walther
a2a9984ed9 workflows/pr: run in pull_request context to test actions/get-merge-commit
This must run in the pull_request context, otherwise changes to the
actions are not tested.
2025-08-10 16:22:46 +02:00
Wolfgang Walther
436d54174d .github/workflows: set timeouts
None of our jobs is expected to run for 6 hours, the GitHub limit. These
limits are generous and take into accounts that some jobs need to wait
for others.

If jobs exceed these times, most likely something else is wrong and
needs investigation.
2025-08-09 17:26:03 +02:00
Wolfgang Walther
9cde368b4c Revert "workflows/eval: disable swap"
This reverts commit f2648b263b.

While the idea to never use swap was fine, in practice this meant that
when nix ran OOM, some other process was killed instead. This lead to
the job not being possible to be cancelled anymore and thus needing to
timeout, before subsequent jobs could be scheduled. This can take up to
6 hours for GitHub Actions by default.

Re-enabling the swap file to catch this case more gracefully. It's still
the goal to never actually *use* the swap file during Eval and just a
safeguard.

Keeping the changed chunkSize and not reverting it - this makes it
slightly less likely to hit the swap file when running with Lix.
2025-08-09 17:25:58 +02:00
Wolfgang Walther
f2648b263b workflows/eval: disable swap
Recent performance tests show that (a) swapping heavily slows down the
Eval job, while (b) lowering the chunkSize does not have an effect on
run-time. It does on memory usage, though - thus we can get rid of
swapping entirely by reducing chunkSize respectively.
2025-08-06 14:40:30 +02:00
Wolfgang Walther
04c039f993 workflows/merge-group: init
Introduces a basic merge queue workflow to initially only run lints.
This will avoid accidentally merging changes which break nixfmt after
its recent update to 1.0.0.
2025-08-05 15:27:45 +02:00
Wolfgang Walther
bfb20b9fea workflows/build: build nixpkgs tarball
This adds a build job for the tarball, which might help uncover eval
issues on attributes not normally touched by Eval, aka those added in
`pkgs/top-level/packages-config.nix`.
2025-07-24 09:50:39 +02:00