chipsalliance / yosys-f4pga-plugins

Plugins for Yosys developed as part of the F4PGA project.
https://f4pga.org
Apache License 2.0
82 stars 46 forks source link

Add version to Makefile; use that to automatically tag the release #490

Closed hzeller closed 1 year ago

hzeller commented 1 year ago

This is a suggestion to provide a version number to the project, and use that to also tag with the same version in git.

Context: https://github.com/chipsalliance/yosys-f4pga-plugins/issues/489

hzeller commented 1 year ago

So to tag a new version, just the version number has to be changed in the Makefile and submitted, the rest is automatic.

umarcor commented 1 year ago

@hzeller, see the alternative approach used in f4pga:

So, the "version" is composed by a hardcoded semver along with a suffix autogenerated by git. That allows to track each build to the sources without having to manually bump the version to tell them apart. It reduces the tagging to meaningful (sem)ver bumps.

hzeller commented 1 year ago

The problem with versions generated by git is, that people downloading a tar file can't really know what version something is as it is not recorded anywhere.

This is why I recently abandoned version tagging that is based on git, but rather inverse it: have a version stored in the project (which then also has everything available to make a #define VERSION ...) and then use git in CI to create a tag from that (and it is benign if there is no tag, as the most important version information comes with the source).

For packaging software, the mode where the software knows its version and then happens to be tagged with the same tag is useful.

I could be convinced if we had a base-version in a tag (say 1.5), and then the CI modifies the PLUGIN_VERSION in the Makefile to the number of git commits since last tagging 1.5.212. However, modifying files in the CI is somewhat icky, this is why I don't necessarily like that.

hzeller commented 1 year ago

We're using this succesfully in UHDM and Surelog now so that it is packagable. The CMakeLists.txt contains the version of the project anyway, and so this is then used to derive the current tag.

hzeller commented 1 year ago

Any decision on this ?