jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
6.02k stars 651 forks source link

Git-Version on info page not set #1002

Closed caco3 closed 2 years ago

caco3 commented 2 years ago

The info page does not show the git hash: grafik

It seems this variable does not (or not under all circumstances?) get set:

version.cpp shows this:

const char* GIT_REV="47da2d6";
const char* GIT_TAG="";
const char* GIT_BRANCH="rolling";
const char* BUILD_TIME="2022-09-04 18:01";

I tried to fix it with following in version.h:

 const char* libfive_git_version(void)
 {
-    return GIT_TAG;
+    if (strlen(GIT_TAG) != 0) {
+        return GIT_TAG;
+    }
+    else {
+        return GIT_REV;
+    }
 }

Bit it did not work.

@jomjol Do you know how to fix it?

jomjol commented 2 years ago

No, but we can remove the Git-Tag. It is not needed anyway from my point of view.

caco3 commented 2 years ago

I think on a tagged build it would be nice to see the tag instead the commit hash

caco3 commented 2 years ago

@jomjol With the issues we have with 11.3.0 (https://github.com/jomjol/AI-on-the-edge-device/issues/1023) I really think we must do some changes on the build/release process:

  1. Remove the firmware folder
  2. only use auto builds
  3. in the autobuild, we can update https://github.com/jomjol/AI-on-the-edge-device/blob/master/code/version.cpp
  4. make sure the version info gets printed to the log
  5. make sure the version information gets shown on the info page.

When you need the firmware folder for yourself, you still could upload them to a dev branch!

haverland commented 2 years ago

@jomjol With the issues we have with 11.3.0 (#1023) I really think we must do some changes on the build/release process:

  1. Remove the firmware folder
  2. only use auto builds
  3. in the autobuild, we can update https://github.com/jomjol/AI-on-the-edge-device/blob/master/code/version.cpp
  4. make sure the version info gets printed to the log
  5. make sure the version information gets shown on the info page.

When you need the firmware folder for yourself, you still could upload them to a dev branch!

1.) Could we commit the last build to the firmware folder? 2.) Full Ack 3.) Why not each branch? 4.) Ack 5.) Could we add the version info as small footer in main page? Often I ask for myself which version used when I get a screenshot.

jomjol commented 2 years ago

Agree, but I use the firmware folder rather intensively in my local environment - but that's not a problem as I can just exclude it from uploading.

I cannot modify the build action - @caco3 : can you do that?

caco3 commented 2 years ago
  1. What is your need to have an outdated firmware in the repo? Why can we not use the auto built artifacts? This way we have a direct link between the repo commit and its built.
  2. This implies that we cant add the artifacts to the repo, else we will get an endless build chain :)
  3. Not sure what you mean? It would get updated for every commit in every branch. I have to look how to do this properly. We might be able to do it through cmake files, then the information also would get updated on a local build.
  4. :+1:
  5. Thats a great idea!
caco3 commented 2 years ago

Agree, but I use the firmware folder rather intensively in my local environment - but that's not a problem as I can just exclude it from uploading.

:+1:

I cannot modify the build action - @caco3 : can you do that?

It is a normal file in the repo, .github/workflows/build.yaml. Just edit it like a normal file. To speed testing up, I usually disabled line https://github.com/jomjol/AI-on-the-edge-device/blob/master/.github/workflows/build.yaml#L42 but enabled the line above.

jomjol commented 2 years ago

Sorry wrong wording. Technically I can modify the build.yaml. But I only roughly know, what I do there, as I'm not experienced in github-actions.

jomjol commented 2 years ago

One more question: for the rolling I don't want to make releases. If we remove the firmware folder, how do the users get the automatically build firmware files then?

caco3 commented 2 years ago

No problem, I am also just learning it :smile:

I can modify them as needed if you want. Or also add more comments to explain it better. Once we have the new update procedure (all in single zip files) it gets simpler again.

For the rolling: We don't need to create releases! Currently every branch containing the action file will run it on a commit. Means for every commit we get builds which people can download and use (at their risc). You can see that nicely on https://github.com/jomjol/AI-on-the-edge-device/actions, the branch is in blue. And also the commit is shown.

jomjol commented 2 years ago

Then let's go this way.

caco3 commented 2 years ago

@haverland also seems to have some experience with actions, he uses them to build his tools. Also I like that it can add artifact directly to a release. I haven't tested it yet, but it looks like there are also actions which can be run when you create a release. And it could attach the rights artifacts automatically.

caco3 commented 2 years ago

The only issues we have of now is that the artifacts always get zipped. and of now the firmware must be a not-zipped bin file.

jomjol commented 2 years ago

On the zip-topic I'm working. It will be accepted by a new update API RST.

caco3 commented 2 years ago

@jomjol https://github.com/caco3/AI-on-the-edge-device/blob/rolling/code/CMakeLists.txt#L5 still shows 0.0.9.3. Did you keep that on this value for a reason? Or should it be updated to what we provide through the tag or commit?

caco3 commented 2 years ago

@jomjol It seems there are already a cmake version script, do you remember why yo uadded it or where it is from?

https://github.com/caco3/AI-on-the-edge-device/blob/rolling/code/main/gitversion.cmake

jomjol commented 2 years ago

1) Did not take care about the Version (0.0.9.3) and we can update this automatically through the cmake. 2) The CMake creates the verison.h to write there the git branch (rolling, master) ...

caco3 commented 2 years ago

thanks!

Did you set GIT_BASE_BRANCH in https://github.com/caco3/AI-on-the-edge-device/blob/rolling/code/main/version.h#L16 manually or is this also generated?

What is the meaning of the libfive in the function names in functions in https://github.com/caco3/AI-on-the-edge-device/blob/rolling/code/main/version.h?

jomjol commented 2 years ago

This I did by hand so far.

caco3 commented 2 years ago

ok. I think we can (should) replace it based on the automatically generated defines in version.cpp

haverland commented 2 years ago

@haverland also seems to have some experience with actions, he uses them to build his tools. Also I like that it can add artifact directly to a release. I haven't tested it yet, but it looks like there are also actions which can be run when you create a release. And it could attach the rights artifacts automatically.

Yes. I'am only the the last commit with "v1.2.3" and it build the artifacts and push it to the release. The release will be created automatically.

Currently I'm on https://github.com/olivierlacan/keep-a-changelog to add the changes to the release depending on a CHANGELOG.md.

haverland commented 2 years ago

On the zip-topic I'm working. It will be accepted by a new update API RST.

On it could we give errors back to the website? Currently it only be logged to the serial. So if an error occurs we would have a better chance to reproduce what's going on.

caco3 commented 2 years ago

versions get now logged and shown in status line: https://github.com/jomjol/AI-on-the-edge-device/pull/1033 @jomjol no need to set GIT_BASE_BRANCH in code/main/version.h anymore!