polylith

technosophist 2025-09-23T20:48:59.311499Z

I'm having trouble getting incremental testing working in github actions and wonder if someone could help me. I have the checkout action using depth 0 and fetch-tags true and it looks like it's pulling enough git history to figure out an increment. In fact, I added a poly info to my workflow and it says stable since: ..., but when I run poly test :projects project:... it looks to be running all the tests, whereas locally it runs zero tests (because I've only changed non-code files on this branch).

technosophist 2025-09-24T14:34:30.411509Z

Figured it out. I thought poly diff was the same locally and in CI, but in CI it includes the logging component change (which is setting up different logging by copying a file over top of another) since the logging component is used everywhere all the tests run! When I removed that I got an incremental test run.

👍 1
seancorfield 2025-09-24T14:40:07.840859Z

Sounds like a good candidate for profiles and multiple component implementations of a single interface...?

technosophist 2025-09-24T14:40:49.567219Z

having different logging in CI?

seancorfield 2025-09-24T14:42:24.799189Z

Sure, since you can select profiles on any poly command. Isolate the logging differences in a component. No need to copy files around.

technosophist 2025-09-24T14:42:30.012859Z

it's really just a configuration difference, but I suppose the config could become different components each with a different config and use profiles to chose the component for the right env

technosophist 2025-09-24T14:43:42.181819Z

I usually manage that stuff by modifying the classpath (or in this case copying a file which obviously wasn't ideal), but profiles are a way to modify the classpath 🙂

seancorfield 2025-09-24T14:43:52.523749Z

If it's just a config difference, you can use an env var to specify that?

seancorfield 2025-09-24T14:45:08.011719Z

Hmm, I guess you'd be running tests against projects so profiles wouldn't work for that, only for :dev.

seancorfield 2025-09-24T14:45:46.815159Z

We have multiple logging configs checked into source control and use env vars to select the appropriate one as needed.

seancorfield 2025-09-24T14:46:20.683759Z

(mind you, that's going to depend on what logging library you use I expect -- we are all-in on log4j2)

technosophist 2025-09-24T14:47:41.697829Z

we do the same but force the logging library's choice via classpath construction

technosophist 2025-09-24T14:48:16.990829Z

these are all good thoughts. I haven't given much love to CI until recently, but there are obviously improvements that could make life more plesant (for prod too)

technosophist 2025-09-23T20:50:38.874109Z

how can I get a better idea of what it thinks the increment is, or how it is making the decision about what tests to run?

tengstrand 2025-09-23T21:43:37.323029Z

If you run poly info :projects then my guess is that these projects after project:... will be marked to be tested (`--x` ). If any file under a project is changed, then the project will be marked to be tested.

technosophist 2025-09-23T21:52:04.535799Z

I'm running titan-backend

stable since: 02c02c8 | dev-20250923T165948                                       
                                                                                    
  projects: 4   interfaces: 62                                                      
  bases:    4   components: 62                                                      
                                                                                    
  active profiles: default                                                          
                                                                                    
  project            alias  status   dev                                            
  --------------------------------   ---                                            
  demeter-backend +  db      ---     ---                                            
  spreadsheet +      ss      ---     ---                                            
  titan-backend +    tb      ---     ---                                            
  development +      dev     s--     s--

technosophist 2025-09-23T21:52:59.166769Z

incremental testing works fine locally. It seems clear there's something different in the CI environment. I just don't know what it is and I'm at the end of my ideas for how to figure it out.

technosophist 2025-09-23T21:55:03.835869Z

This is what poly diff says in CI

.github/workflows/backend-lint-and-test.yml
.github/workflows/cd.yml
.secrets.edn
components/logging/test-resources/logback-test-ci.xml
components/logging/test-resources/logback-test.xml
components/minos/src/titan/minos/interface.clj
deps.edn
workspace-ci.edn
workspace.edn
then it proceeds to run tests for 38 bricks

seancorfield 2025-09-23T23:03:26.814069Z

Are you pushing the stable tag?

seancorfield 2025-09-23T23:04:22.698719Z

At work, our ci tags each successful build, so each run is only what's changed since the last successful ci

tengstrand 2025-09-24T05:23:32.331169Z

Try running this command locally and in CI to verify that you get the same result: ws get:changes:git-diff-command