grgit icon indicating copy to clipboard operation
grgit copied to clipboard

Adds samples

Open stebbi opened this issue 5 years ago • 3 comments

Hi there, I picked one of your issues as an example for me to familiarize myself with the Github pull requests workflow, perhaps these samples can be useful for someone. Thanks for the library - I've used if a fair bit and it is very nice. Cheers - Stefan

stebbi avatar May 21 '20 14:05 stebbi

Again, sorry for the delay and thanks for the interest in contributing. I'm still pondering this one, since I'm not sure how I want to support samples. Main issue being ensuring they still work as changes are made to the library. As a manual step, there's a likelihood I'll forget to run them again.

ajoberstar avatar Sep 19 '20 22:09 ajoberstar

Hi, yes, understood, I have the same problem in my projects - I tend to like samples as the quickest way to pick up a new tool, so I've dealt with this by extending my builds to finalize the test task by running the samples. I don't know if that would work for you but, I do it roughly like so:

  1. Master build includes a statement similar to test.finalizedBy(':samples:runAll')
  2. Samples directory contains build.gradle with individual GradleBuild tasks for the samples
  3. The samples build file also defines the runAll task with dependencies on the individual sample tasks

I also tend to like to have self-checks in each sample, this can serve as a way to document what exactly the sample is trying to do. Once those are included, the master build effectively checks that the samples still work.

This is only a few lines of code, let me know if you'd like me to add that to the PR. The pattern is a little bit pedestrian maybe, but very simple, and has worked out alright for me.

stebbi avatar Oct 09 '20 06:10 stebbi

@stebbi poke :)

rusefillc avatar Jan 26 '22 13:01 rusefillc