Skip to content
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

feat(Build, workflow): Add Version Info Files #937

Merged
merged 12 commits into from
Mar 15, 2024

Conversation

Jake-Carter
Copy link
Contributor

Pull Request Template

Description

This PR adds a mxc_version.h info file with the following definitions that can be used by application code to check against a specific release of the MSDK.

  • MSDK_VERSION_STRING
  • MSDK_VERSION_YEAR
  • MSDK_VERSION_MONTH

It also merges the release branch back into main, so that main can see the latest release tag.

The definitions are generated by a Python script. It uses git describe --tags to get an info string in relation to the latest tag.
It also generates a version info file for the build system.

The result is that the build output will now print:

Loaded project.mk
****************************************************************************
* Analog Devices MSDK
* v2024_02-6-g6c5f512e2e # <---
* - User Guide: https://analogdevicesinc.github.io/msdk/USERGUIDE/
* - Get Support: https://www.analog.com/support/technical-support.html
* - Report Issues: https://github.com/analogdevicesinc/msdk/issues
* - Contributing: https://analogdevicesinc.github.io/msdk/CONTRIBUTING/
****************************************************************************

and application code can include the version info file.

#include "mxc_version.h"
#if MSDK_VERSION_YEAR < 2024
#error Required MSDK 2024 release or above!
#endif

Workflow

A workflow has also been added that will update newly created tags on the release branch with the latest version info files.

I am not triggering the workflow to run automatically on any branches, because that would generate a lot of upstream commits. In the future, I will set up another workflow to trigger on approved PRs

Checklist Before Requesting Review

  • PR Title follows correct guidelines.
  • Description of changes and all other relevant information.
  • (Optional) Link any related GitHub issues using a keyword
  • (Optional) Provide info on any relevant functional testing/validation. For API changes or significant features, this is not optional.

@github-actions github-actions bot added the Workflow Related to Workflow development label Feb 27, 2024
@Jake-Carter Jake-Carter changed the title feat(Build, Workflow): Add Version Info Files feat(Build, workflow): Add Version Info Files Feb 27, 2024
Copy link
Contributor

@sihyung-maxim sihyung-maxim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice new feature. Just minor copyright updates.

.github/workflows/scripts/update_version.py Outdated Show resolved Hide resolved
Libraries/CMSIS/Device/Maxim/GCC/mxc_version.mk Outdated Show resolved Hide resolved
@BrentK-ADI
Copy link
Contributor

What happens in the case of working off the master branch for example versus a release? Will the new constants be loaded with the latest release, empty, or another unknown value?

@Jake-Carter
Copy link
Contributor Author

@BrentK-ADI I just added some minor Makefile black magic to check whether you're working off the git repo, and if you've got a valid python installation. If those conditions are met, the version info files will be updated every time you run a build. (f7d335c)

If you're exactly on a release tag, you should see your version info match the tag exactly. If you're on a development branch, you'll get a modified version string with the following format: [latest release tag]-[commits since latest release tag]-g[commit SHA]

I'm not sure if this is too annoying for every day development, since the version info files will always show as changed and you should be adding them into all your commits from here on out. Open to feedback here.

@Jake-Carter Jake-Carter merged commit f1d7a10 into analogdevicesinc:main Mar 15, 2024
6 of 7 checks passed
@Jake-Carter Jake-Carter deleted the feat/version_info branch March 15, 2024 23:31
EricB-ADI pushed a commit that referenced this pull request Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Workflow Related to Workflow development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants