KevinMarquette / PlasterTemplates

A set of Plaster templates that I use.
MIT License
37 stars 9 forks source link

Semantic version calculation - problems + solutions #30

Closed christianacca closed 6 years ago

christianacca commented 6 years ago

Related to https://github.com/KevinMarquette/PlasterTemplates/issues/4

Been looking at the fingerprint logic and I think there is non-obvious implication to how it works (please correct me if I'm wrong). Most of the time the logic will miss feature changes and bump the patch version instead.

Take the following typical scenario...

  1. I write a new function
  2. I run the build locally
    • this generates the fingerprint file which now includes the new function
  3. I commit the changes that are pending in my working directory (ie new function and the fingerprint file); I use the commit message '!deploy' to trigger the deploy
  4. The build runs on the CI server:
    • it compares the current list of functions (includes the new function) with the fingerprint file (also includes the new function)
    • determines that there are no new features, as the new function is seen in both the current command list and the fingerprint file
    • bumps the patch version

Possible solutions

1. Commit fingerprint only after a deploy

That's a pain to remember.

2. Generate the fingerprint from the previous version of the module

To really fix this, the calculation logic needs to install the previous version of the module, generating a fingerprint from this. It can then compare this with a fingerprint calculated from the current module.

The trick would be:

christianacca commented 6 years ago

Also, by calculating the fingerprint from the previous version of the module, you do not have to commit the fingerprint file into source control

christianacca commented 6 years ago

FYI, just trying out my proposed solution. If it works I'll send a PR

christianacca commented 6 years ago

PR with my proposed solution: https://github.com/KevinMarquette/PlasterTemplates/pull/34

Also a nice by-product is that the fingerprint file no longer needs to be checked into git