yakshaveinc / linux

software engineering for Linux projects
The Unlicense
1 stars 3 forks source link

Release snap only when its files are modified #36

Closed abitrolly closed 3 years ago

abitrolly commented 4 years ago

Right now every commit releases new snap at https://snapcraft.io/yakshaveinc That creates unnecessary flow of update downloads. The solution is to build and deploy only when modifications touch files related to specific snap.

The should help

CHANGED_FILES=($(git diff --name-only $TRAVIS_COMMIT_RANGE))

https://stackoverflow.com/questions/38549616/travis-determine-which-files-changed

abitrolly commented 3 years ago

There is a problem with this approach. If the previous build fails, or has been skipped, the won't be any releases on subsequent commits. For example:

  1. The commit modifies both top level .travis.yml and snap/snapcraft.yaml
  2. The build fails because of error in .travis.yml
  3. The next commit fixes .travis.yml, but rebuild of snap is not triggered, because snap/snapcraft.yaml was not touched

Another solution to the problem of unnecessary flow of updates is to build snaps always, in reproducible way, and upload only if the built snap changes.

abitrolly commented 3 years ago

See #39.

abitrolly commented 3 years ago

See also https://dev.to/ahferroin7/skip-ci-stages-in-travis-based-on-what-files-changed-3a4k