r/devops • u/BlackberryOk182 • 9d ago
Discussion Solo dev, 4 self-hosted Windows runners on one laptop, merge trains take ~2 hours. How would you speed this up?
edit / update (nov 18):
got a lot of good advice here so i tried some of it, and a few things didn't go how i expected.
i thought tagging tests by area would be enough to pick what to run, but when i checked it on one change the tags missed 47 of the 91 test files that a list based on what imports what caught, including one that actually mattered. so i dropped the tags for now and i'll try them again after the cleanup. right now it's just the change's own tests while i'm writing, then everything that depends on the changed files when i push, and the full suite still runs before anything lands.
i figured the quick set of tests would take about a minute. turns out it was more like 7 and a half and didn't catch anything extra, so that's gone too.
i also tried skipping the local check before a train, thinking it'd speed things up. it didn't really, 133 min vs the usual 112-141, so i put it back.
and i was off on runner time, it's more like 5-7 hours depending on the train, the last one was about 5.4.
the bigger change is i'm reorganizing the code into clearer layers so a change doesn't touch as many places. i'm doing that before this release now instead of after, so the release will be later than i said. hoping to have it in before it ships if it passes everything, no results yet though. making the timing tests wait for a quiet laptop on their own, a cpu time check on one of them, and maybe trying testmon are all on my list for after that. not changing the timing limits.
questions for people who've done this on a big python desktop app:
- how did you split yours into layers so each part only depends on the ones below it, and how many layers or folders ended up being enough?
- how do you keep it from tangling back up over time?
- i'm thinking layers on the outside with feature folders inside the parts that change most. has anyone done it that way, and did it hold up?
solo dev building a windows desktop app, most of the coding is done by claude code sessions (earlier post about that). the bottleneck now is testing. the sessions spend more time waiting on CI than writing code, so i'm looking for ideas
The setup:
- the app drives blender, unity 2022.3 and the vrchat sdk, so the real tests need windows
- 4 self-hosted github actions runners, all on my one laptop (ryzen 9 7945hx 16 cores, rtx 4090 laptop 16gb, 64gb ram, 8tb nvme), one job per runner. the real blender/unity jobs can only use 3 of them, and up to 2 local test runs share the same laptop too
- self-hosted because github's hosted windows minutes cost double and i'm on a tight budget, so the laptop is the free option
- changes get batched into merge trains, 1-8 changes each, about 3 on average
What a train looks like:
- pipeline first: 16 real tool jobs (mostly blender, plus unity and a vrm validator) and fake-tool pytest in 4 shards, about 45-80 min
- then the full windows UI suite, ~25,600 tests in 3 shards, about 65 min. these run back to back on purpose because the timing tests flake when they share the machine with blender jobs, so that's about an hour of every train just waiting
- a train takes about 2 hours start to finish (83-145 min over the last 8)
- 7 of the last 8 landed, 4 clean first try. fix and retest loops took anywhere from 30 min to 2 hours
- laptop averages 55-60% cpu while all this runs and peaks at 100%, ram peaks around 80%
How much testing:
- every fix starts with a failing test, a review session checks it, the author runs the affected tests locally, then the train runs everything again in CI plus a local gate
- so the plain python tests end up running about 3 times. the real blender/unity tests did catch the only real failure in those 8 trains though
What i've tried:
- dev drive, only ~4% faster on my test so i didn't keep it
- sharding by recorded test duration, and splitting local runs by run time so they stop timing out
- allowing one re-run of only the failed jobs for flaky infra stuff
- tags so only affected tests run, built but not measured yet
Why one train at a time: changes often touch the same files, and the timing tests got flaky when all 4 runners were busy. so i'm not sure more runners even helps or if the real answer is a second machine
What i'm asking:
- am i over testing? how do you cut duplicate runs without losing coverage
- how do you pick tests by changed area without missing stuff that imports across areas
- is there a safe way to run 2 trains when changes overlap files, or is one at a time just right
- is a second machine or a cloud windows runner worth it for a ~2 hour cycle, or is there a better service for this
- how do you keep timing sensitive tests reliable when CI jobs share one pc
- could the plain python and fake-tool tests run on linux, or does that risk missing windows-only bugs
at the current pace my next release is about 3 weeks out and the one after that is a couple months, so anything that shortens the 2 hour loop helps a lot. thanks!
5
u/Zotlann 8d ago
Think about what the point of testing frequently is. This is super important if your tests are expensive to run and unreliable.
Does having the agents waiting for a green test pass actually buy them anything? Could you just run them on a schedule, say twice daily and have separate agents identify debug and fix the failures or do they need context from the implementing agent? Is that context better stored somewhere else like a ticketing or feature documentation system so that a new agent can get necessary context to fix the failures without introducing new regression or deviating from the product vision?
3
u/hashkent DevOps 8d ago
Can you get another windows machine?
1
u/NUTTA_BUSTAH 8d ago edited 8d ago
You are over testing for sure. It is a common trap with agentic workflows. I imagine you can give your agents a goal of deleting 75% of tests while preserving functionality, correctness and user journeys through integration and e2e tests. They will probably meet it after a few hours on that scale (well, more like days since every change seems to take hours instead of seconds or minutes).
Do not test everything all the time for every change. Test the immediately important stuff often, run the bigger suite only before releasing a new version. Aim for the important tests to finish in 1 minute. Trains can implement this idea which I assume you already do from the explanation.
Some apps are just a pain to test and require a lot of time. Chances are you did not design the software and thus you have to over-test by your own / your agents design. Good software is well compartmentalized and cohesive thus fast and easy to test.
You can also attempt self improvement. Set benchmarks the agents must maintain. But be careful you set guard rails so the maintenance is not deleting important stuff just to please a metric.
1
u/Ok-Form1598 8d ago
for 5 i'd change the timing tests so they stop caring how busy the machine is. a 1.5 sec wall clock limit on a box that's also running blender mostly measures blender. if what the test really guards is "this didn't get accidentally slow", assert on process cpu time, or count the work (calls, redraws, file reads) instead. then the ui suite doesn't need the laptop to itself, and that hour of back to back waiting can overlap with the blender jobs. keep a few true wall clock checks for the hosted windows run at release.
1
u/meowrawr 8d ago
There is a whole science/art to setting up efficient build chains.
For our CI/CD, we don’t build everything and instead determine what actually needs to be built and which tests belong to affected code changes. Although we have a more typical microservice architecture, in theory it’s the same approach as your own software should have a variety of libraries/modules/packages.
1
u/1saltypistachio 8d ago
Testing comes in tiers. Small changes needs to test only what you touched, larger changes needs to test what you touched and what touches that and majour changes tests more. If you are doing things in a rolling release way, then do a full regression every N number of new code you added. If it's a minor release, run the entire test suit. If it's a major release, run full suite plus non functional tests.
1
u/iGamingTools 8d ago
on moving the plain python tests to linux, what bites is mostly filesystem stuff. windows won't let you delete or rename a file another process has open, paths are case-insensitive, and long paths can still hit MAX_PATH. if the fake-tool tests touch files a lot, i'd keep one windows shard of them in the train
1
u/Kookoombar 8d ago
I'd move the plain python and fake-tool pytest to a linux runner (WSL or a cheap linux box). Only the windows-only stuff really needs the real machine, and that takes a chunk of load off the laptop. For picking tests by changed area, coverage-based selection like pytest-testmon handles cross-module imports better than hand tags since it tracks what each test actually touches. I'd keep a full run nightly to catch whatever it misses. For the timing flakes, I'd either widen those hard 1.5s limits a lot or put them in their own job that runs alone.
1
u/Hostman_com 8d ago
If those two hours are mostly full-suite reruns after small edits, run a quick Windows smoke test on each push and keep the full suite as a required check before merging.
Before adding runners, time the same job with one runner active and then with all four busy. If the job itself slows down, check CPU, memory and disk activity on the host.
1
u/MongooseWonderful198 7d ago
For keeping it from tangling again, Import Linter’s layers contract checks the dependency direction, including indirect imports. It can also forbid imports between sibling feature modules in the same layer. I’d add the check to CI around one boundary you’ve cleaned up, then expand it; moving files into new folders alone won’t stop the next change adding the old dependency back.
1
u/addy3006 7d ago
do you know which module pulls in the most tests transitively? if the Blender/Unity adapters sit near the bottom of the graph, splitting them out might be a cheap first boundary. you could compare affected-test count and runner time before and after that one move, before committing to the full layering.
1
u/deployfan64 7d ago
7 hours of runner time on a laptop that only hits 60% cpu means yyour shards are sitting idle waiting on each other somewhere
1
u/Low-Opening25 8d ago
Windows? That’s your problem
1
u/argo_devbuild 1d ago
the biggest win is prob getting the UI suite off the laptop, since an hour of every train is it waiting for the blender jobs to finish. options are a second windows box as another self-hosted runner, github's larger windows runners, or a per-minute windows runner service like warpbuild for the UI shards, with blender/unity staying on the laptop where the gpu is.
Once the UI tests run on their own machines they can run alongside the tool jobs instead of after them, and the timing flakes from sharing a cpu should go away too. worth checking first that the UI suite runs fine without the gpu and without an interactive desktop session.