-
Notifications
You must be signed in to change notification settings - Fork 214
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
Gradle build cache issue with snapshots folder #1334
Comments
I locally moved snapshots folder to input as it is actually input for test and verify. record could have that folder as output without setting up test task output. but after those changes, running unit test again showed a new issue. the report produce new file every time it runs. that is not good for cache as output of the test will change every time we run test. |
@kozaxinan do you by chance have code snippets for how you modified those tasks (at runtime) or did you just modify the paparazzi code/plugin directly? Somehow coincidentally we both started investigating this issue at the same time (on the weekend nonetheless, though you're ahead of me in terms of solutions since i moved onto other cache issues in our build) so there's a theory that this caching issue is a recent regression. |
I copied the plugin code internally and modified it. At the moment the snapshot folder is input for the test task rather than output. Also I gave reports/paparazzi/debug/images as output instead of the whole paparazzi folder. Every test run modified the run folder in the build/report and produced unreproducible output for cached tasks. I would say the test task should do verification and fail. |
I internally added plugin code and changed what needed to be input and output. Our findings and changes:
Our current setup has the following changes.These are suggestions for changing the task input/output setup paparazzi library.
This approach makes the Test task cacheable for test runs. Also, allow us to do the verification in a single test run instead of testDebugUnitTest + verifyPapazazzi. If you want to see changes in a PR, I can open a pr with suggested changes around input and output changes. |
A few comments here: The original issue is a duplicate of the issue attempted to be address in #852, but most recently in progress here: #1522. That should land very soon 🤞
i'm a bit confused by this, since reportOutputDir is a task output, it should be cached/not rerun each time. can you elaborate more? (I also wonder if that bug goes away after #1522 lands.)
This was proposed in #1365 which was closed as a duplicate. That being said, I think #1522 fixes this.
The report folder is definitely an task output, but...subsequent runs shouldn't produce new results unless there are new changes. I'd love more insights into this, as this is likely a bug!
Agreed on changing the inputs/outputs, to be address in #1522. A separate record task isn't ideal as it relies on Gradle more, vs tackling the root of the issue.
Duplicate of #1365. I think a solution might be to eliminate direct invocations of testDebug entirely. My comment here explains why: #421 (comment) |
I reviewed recent changes. I am happy to see that there are significant changes. I am on vacation now without a pc. I will verify changes with snapshot builds in mid September |
Description
A clear and concise description of what the bug is.
Since we started using, we end up having cache issues for the all the modules with paparazzi test. At first, we didnt notice but now with lots of modules with Paparazzi, our test duration increased a lot.
Gradle reports following for cacheability of the Test task.
I tried adding all subfolders and files as output. That didnt work.
I noticed that "videos" folder is empty and not checked out to git. I tried deleting "videos" folder in
doLast
to delete empty folder. That didn't help. Empty output folder should not affect the cache.I checked all tasks and their outputs to find out if any other tasks has same output. It showed debug and release Test has same output directory. I disabled unitTests for release variant. testReleaseUnitTest stopped getting created. But that didn't solve the issue. Now I know that only one task has "src/test/snapshots/images" as output.
I have tried running test with
-Dorg.gradle.caching.debug=true
. That didn't give any more details that Gradle Scan.The cache debug about outputs.
Steps to Reproduce
Provide a sample project, failing test, or steps to reproduce.
I dont have reproducible case. It is always non cacheable on CI. Locally sometimes task become cacheable.
Expected behavior
A clear and concise description of what you expected to happen.
The snapshot folder should not be output of the Test and Verify tasks. They dont produce anything in that folder and there is no reason I can think of gradle to track that folder as output.
I created the Paparazzi Plugin in out codebase. I removed the snapshot folder from outputs. Now test task is cacheable.
Our build time changes without any code change:
testDebugUnitTest ~25m
verifyPaparazziDebug ~11m
jacoco ~12m
testDebugUnitTest ~2m
verifyPaparazziDebug ~50 seconds
jacoco ~1m
Without setting snapshot as output, we are able to save ~45m from out CI builds.
Additional information:
Screenshots
If applicable, add screenshots to help explain your problem.
The text was updated successfully, but these errors were encountered: