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

CI/CD basic implementation based on GitHub Actions #167

Merged
merged 68 commits into from
Apr 8, 2024

Conversation

ia
Copy link
Contributor

@ia ia commented Mar 26, 2024

TL;DR: utilize GitHub capabilities to make builds on every commit and on every pull-request.

Hello. I'm a bit surprised that this haven't been done yet. So I decided to take some liberty to help with that. There may be a lot of room for improvements in the future but this is work-able proof-of-concept which can be merged & adopted as is currently in my humble opinion. However, to fully integrate push.yml into hydrafw github project, admins may need to set some additional settings somewhere in Settings of the project using GitHub web interface manually.

The benefits are:

  • always be sure that current code at least build-able;
  • without need to enroll local devel environment, advanced users who just will need dfu-util, always be able to get the latest fresh build from main branch;

Partially this overlaps with #132 and I can't promise anything but every time I have some free time I try to keep contributing around these CI/CD improvements as well.

Now, to technical details so everyone who is interested & curious could be on the same page. Basically, push.yml here is the most minimal declarative file which tells GitHub to start Ubuntu 22.04 VM, then to start Debian oldstable container inside, install toolchain packages, build hydrafw.dfu and upload it as hydrafw.dfu artifact. The live "demo" can be seen in my forked repo here:

Now, why such "matreshka" with VMs/containers, you may ask. Well, GitHub doesn't have Debian oldstable to run it directly, but we can start it from VM which is available on GitHub. After tries & errors Debian oldstable has been picked as [so far] the most suitable one, since:

If you have any other questions, just let me know.

Oh, and that tiny update for python script comes from specific behavior of GitHub actions: on every checkout before build, GitHub infrastructure doesn't make full valid git checkout but downloads source tree in detached state so getting meta information about repo and its status (tag, revision, sha, etc.) may be tricky because I saw that with other GitHub projects so for a while we set revision as 0.0 for GitHub builds (which is default value) but it's even good in its own way because by that it will be the indicator that it is the latest upstream mainline build but not a stable release.

ia added 30 commits March 22, 2024 11:55
…t extractable due to detached git repo state on GH build server
@ia
Copy link
Contributor Author

ia commented Mar 27, 2024

Ok, it seems that after all with the power of bash & git commands we can get all needed meta information at the time of building on github to embed version string.

The question remains what string should be put into hydrafw.dfu, so considering my comment above just let me know and I will do some further modifications. I hope my comments are not looking rude in any way because I was just trying to figure things out. Will return to this in a day or too.

@bvernoux
Copy link
Member

bvernoux commented Mar 27, 2024

Ok, it seems that after all with the power of bash & git commands we can get all needed meta information at the time of building on github to embed version string.

The question remains what string should be put into hydrafw.dfu, so considering my comment above just let me know and I will do some further modifications. I hope my comments are not looking rude in any way because I was just trying to figure things out. Will return to this in a day or too.

We must just build it like it was done on computer it create src/common/hydrafw_version.hdr which is then used during build and those informations will be present in the final dfu (like it is in the bin ...) so there is nothing more to do
Example content of src/common/hydrafw_version.hdr created during build with latest commit:

#define HYDRAFW_GIT_TAG "v0.11-22-g34e3d63"
#define HYDRAFW_CHECKIN_DATE "2024-02-23"

In my case I'm using https://github.com/hydrabus/hydrafw of course in your case with your fork you will have different commit ...
When I check your fork https://github.com/ia/hydrafw you have +60 commits more (but your issue is that you do not have any tags in your fork see https://gist.github.com/kayagultekin/557975964ae26b99b46be3082ee828cf#what-about-syncing-tags) vs https://github.com/hydrabus/hydrafw and your latest commit ia@1e882a1 done on 2024-02-27, so we should have src/common/hydrafw_version.hdr:

#define HYDRAFW_GIT_TAG "v0.11-82-g1e882a1"
#define HYDRAFW_CHECKIN_DATE "2024-02-27"

At the end we shall find in the bin & dfu HydraFW (HydraBus) v0.11-82-g1e882a1 2024-03-27

@ia
Copy link
Contributor Author

ia commented Mar 29, 2024

Ookay, some status update.
Here is the content of hydrafw_version.hdr from local build on my local machine from my git feature branch:

#define HYDRAFW_GIT_TAG "v0.11-85-gb0f78b2"
#define HYDRAFW_CHECKIN_DATE "2024-03-29"

And here is the content of hydrafw_version.hdr from GitHub build here:

$ strings hydrafw.dfu  | grep v0.11
HydraFW (HydraBus) v0.11-86-gb0f78b2 2024-03-29

Are these appropriate results? Just asking for confirmation before cleaning up all those printf debugging stuff from scripts before final merge.

.github/workflows/push.yml Outdated Show resolved Hide resolved
@ia
Copy link
Contributor Author

ia commented Apr 5, 2024

Hello. Sorry to bother, but I'm just giving a friendly reminder of the most recent update since I'm very curious what you think.

So, could you, please, just give me the feedback about the current patch-set for this pull-request. Although I understand that we all may be very busy sometimes so take your time, of course, so I'm not rushing, but just giving an update. Thank you.

@bvernoux
Copy link
Member

bvernoux commented Apr 6, 2024

All seems good for me
Baldanos what do you think ?

@Baldanos
Copy link
Collaborator

Baldanos commented Apr 8, 2024

Looks good to me.

@ia Thank you for the contribution !

@bvernoux
Copy link
Member

bvernoux commented Apr 8, 2024

Thanks for your contribution

@bvernoux bvernoux merged commit ecfb2cc into hydrabus:master Apr 8, 2024
1 check passed
@bvernoux
Copy link
Member

bvernoux commented Apr 8, 2024

I have created a new issue #168 as the build has failed (after merge)

ia added a commit to ia/hydrafw that referenced this pull request Apr 9, 2024
…ore explicitly regardless build status (PR,merge,etc.) // hopefully fix for hydrabus#167
Baldanos pushed a commit that referenced this pull request Apr 10, 2024
…ore explicitly regardless build status (PR,merge,etc.) // hopefully fix for #167 (#169)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants