Using GitHub action with setup-lazarus to have the Linux version compiled and offered in any release

gcarreno's profile image gcarreno posted 1 month ago in General Permalink

Hey Ansgar,

If you're so inclined I can help you navigate the GitHub actions in order to produce binaries for WIndows, Linux and macOS via the setup-lazarus action I made, on every release. All automated of course.

You can even have the GTK2 AND QT5 binaries compiled and made available upon a new release.

My heart is still wishing that you drop Delphi and use Free Pascal for all the versions, and possibly expanding for a macOS version. This would be rather awesome in my humble opinion.

I'll let you mull over it and see what you think about this suggestion.

Cheers, Gus

gcarreno's profile image gcarreno posted 1 month ago Permalink

Hey Ansgar,

I've decided to lend you a hand in the CI/CD department over at GitHub with the Lazarus branch. At the moment I've forked your repo to my own repos. Since my connection is quite bad at the moment, it will take me a while to clone the forked repo to my system.

My fork: https://github.com/gcarreno/gcarreno-HeidiSQL/tree/lazarus ( Since I'm too much of a noob on the forum, please remove the spaces from the above link )

Once that's done, here's what I'll do next to the lazarus branch:

  • Edit the README.md file to have some banners
  • Once the workflow file is able to compile something, I'll add the banner to track build success/failure
  • I'll probably have a look at the .gitignore and see if it needs padding
  • I'll add a .gitattributes file. Not necessary, but it's nice to have to exclude files we don't want to pollute the archive output of GIT. This is what's present on the releases under the files named Source.*
  • I'll add /bin to the .gitignore file. This way, I can modify the .lpi file to output the executable binary to /out and all the other compiled stuff to /bin, hence ignoring it all
  • I'll add /.github/workflows/lazarus.yaml and start the CI/CD process
  • My first step will be to get a successful compilation for Windows and Linux( both GTK2 and QT5 )
  • I'll then do the auto release thing with only an archive of the binaries + i18n files. No .dll/.so files
  • Next, I'll try to improve your .deb creation. There's a toolkit package one can install that does not need to use chroot, if I'm not mistaken. I'll need to consult some stuff, before I'm sure. If that doesn't pan out, I'll use a slightly modified version of your script that gets the version from environment variables of the GitHub workflow.

Optional stuff:

  • There's a cross platform windows installer creator that I may try to use in the GitHub workflows to wrap the Windows version of the lazarus branch
  • Try to get the .rpm toolkit package, in order to have the QT5 binary wrapped in a .rpm file. Will still have both the GTK2 and QT5 inside a respective .tar.gz archive, just so that peeps can choose without needing the repo tools.
  • Have a go at compiling the macOS version so we can ask someone with an OSX machine to have a go.

Disclaimer: I will not be creating a PR on my work. Some of the changes I'm proposing may not appeal to you at all. I'll do all of the above, and you can then pick and choose what you like and discard what you don't like.

Cheers, Gus

gcarreno's profile image gcarreno posted 1 month ago Permalink

Hey Ansgar,

Completely forgot to mention:
Once you have the compiled binaries listed on the releases page over at GitHub, you can point the download to GitHub.
This will definitely lower your bandwidth consumption at the main site.
And probably enhance download speeds and amount of downloads since GitHub has servers distributed along the globe to allow for more local access. At least that's what I think they do, not sure.

Nonetheless, having GitHub serve the downloads will always be a plus, right?

Cheers,
Gus

gcarreno's profile image gcarreno posted 1 month ago Permalink

Hey Ansgar,

Lets continue this conversation on the Discussions section of my forked repo.

I'll be putting progress reports there so you don't have to fumble through the source code to find out what and how I've done the changes.

Cheers,
Gus

ansgar's profile image ansgar posted 1 month ago Permalink

I don't get why people are so eager to do everything on (Microsoft!) Github. The release process is currently a bit cumbersome but works quite stable, even after moving heidisql.com from a Windows (build) server to a Linux based webpack. Download traffic is not an issue with modern hosting providers.

Well, let's give it a try. I must admit there seem to be some advantages compared to the my home brewn classic half-automated process. Well I'm not the youngest man as well, which is one aspect. Please note I'm a complete noob with Github Actions. One thing I am asking me is where Github gets the compiler binaries e.g. lazbuild from?

Does Github support code-signing the Windows executable with a paid Authenticode certificate? I am using such one and since a few years it is required these come with a hardware/USB token which must be connected when you sign an executable. Providing executables without such a certificate is horrible with the latest Windows versions, as users are warned with a huge red dialog about further use. I cannot tell you why they even introduced the hardware requirement - previously it was possible to use an exported certificate file with a password. A probable solution could be Signpath on https://signpath.io/ .

One more thing: I would rather invite you to the official HeidiSQL project on Github than picking things up I don't fully understand. I think your changes should currently not break the existing release processes. And that way your effort would be more likely used in production at some point. Or would you prefer your own repo?

gcarreno's profile image gcarreno posted 1 month ago Permalink

Hey Ansgar,

I don't get why people are so eager to do everything on (Microsoft!) Github.

I see your point, believe me!!
The thing is that GitHub has been the de-facto hub for all things open source.
I guess we can say that GitLab the the close second for people with an acute allergy to anything Microsoft.
For the past 5 or 6 years I've been investing quite a lot of time in both git and GitHub things.
I started quite the noob, quite like you now, and got better as time progressed.
While I was doing that I also got quite involved in Free Pascal. To the point where I saw the need to actually dive head-in into TypeScript in order to make an action that installs Lazarus from the Source Forge install binaries.
I called it setup-lazarus. And that's what I'm using to automate all things related to Free Pascal code CI/CD.
This allowed some very wide spread projects to use it, like Castle Game Engine, PasDoc and DoubleCMD.

The release process is currently a bit cumbersome but works quite stable, even after moving heidisql.com from a Windows (build) server to a Linux based webpack.

For the Delphi version, or the Lazarus one?

Download traffic is not an issue with modern hosting providers.

Kewl!! Noted :D

Well, let's give it a try.

Awesome sauce !!

I must admit there seem to be some advantages compared to the my home brewn classic half-automated process. Well I'm not the youngest man as well, which is one aspect. Please note I'm a complete noob with Github Actions.

Well, the entire premise of the GitHub actions is to facilitate Continuous Integration(CI) and Continuous Deployment(CD) for any project small or large. Because you can use other actions, and there's a ton of them, in conjunction with bash script on the repo, or even bash commands on the actual workflow, it's quite powerfull!!

I'm 55, so yeah, I count myself of the not-that-young crowd myself ;)

While you may be a complete noob in terms of GitHub actions, the setup I got on my forked repo really gives a good introduction to how things work. I tend to learn quite better if I'm looking at an example. And what I did is rather easy to follow and understand. I may be wrong because I'm biased due to the time I've spent on it. But still, it's not that hard.

Does Github support code-signing the Windows executable with a paid Authenticode certificate?

I'm guessing that if your solution requires an USB dongle, then we can't really automate that.
GitHub does allow for signing, if we use the correct service that can be reached via a Web API.
GitHub repos have a section on the settings to store secret stuff, like a key for a signing service.
I guess we can investigate that if or when you decide to ditch Delphi and go Lazarus for the Windows version.
My goal, at the moment, is to have the Linux version automated, with both GTK2 and QT5 being automatically available on every release on the lazarus branch.
We can always discuss what are our options for the Windows/macOS side in the future, since I'm guessing that Apple is now quite fond of code signing also :(

One more thing: I would rather invite you to the official HeidiSQL project on Github than picking things up I don't fully understand. I think your changes should currently not break the existing release processes. And that way your effort would be more likely used in production at some point. Or would you prefer your own repo?

I would be DELIGHTED and frankly quite humbled for this opportunity!! I don't think I qualify for the code itself, but I'll surely take the role of GitHub technician, so you don't have to worry about that. I can also give you A TON of pointers on the Lazarus side.
I'm guessing that you also have less experience there than you have with Delphi :)

Cheers,
Gus

ansgar's profile image ansgar posted 1 month ago Permalink

The release process is currently a bit cumbersome but works quite stable, even after moving heidisql.com from a Windows (build) server to a Linux based webpack.

For the Delphi version, or the Lazarus one?

Both. Using build.php and InnoSetup on the Windows side, and the shell scripts for the Linux version. But as said, I must admit there is room to optimize. You're knowledge is definitely welcome.

I would be DELIGHTED and frankly quite humbled for this opportunity!!

You're welcome. I gave you maintainer privileges, please shout if you need to be admin.

I don't think I qualify for the code itself, but I'll surely take the role of GitHub technician, so you don't have to worry about that.

Wonderful!

I can also give you A TON of pointers on the Lazarus side. I'm guessing that you also have less experience there than you have with Delphi :)

Yes my Lazarus experience is less than a year old, while my Delphi fiddlings go back to 1991 where I was learning Turbo Pascal and wrote procedures with a pencil on a sheet of paper.

gcarreno's profile image gcarreno posted 1 month ago Permalink

Hey Ansgar,

Both. Using build.php and InnoSetup on the Windows side, and the shell scripts for the Linux version. But as said, I must admit there is room to optimize. You're knowledge is definitely welcome.

Welp, unfortunately, while using Delphi for the Windows side, I cannot do anything about that in terms of GitHub CI/CD automation.
It's actually one of the things I've discussed quite a lot with Ian Barker since he made me MVP.
Something that, up to this day, I've never fully understood. He claimed that it was for my activity on Discord on the servers that are dedicated to Object Pascal, both Delphi and Free Pascal. But still... :D

Like I said many times before, I still dream of the moment you say: I can't manage 2 code branches. I'll opt for Lazarus only.
If or when you decide that, then I can pour all my knowledge of Lazarus and GitHub in making all the automation happen. Even the signing of the Windows and/or the macOS versions.
Until then, I'll gladly help on the lazarus branch in which ever way I can, and that's a pinky promise ;)

I gave you maintainer privileges, please shout if you need to be admin.

I think maintainer will do for now. If in the immediate future we both see the need for me to get upped to admin, we can do that.
I'll have a look at the invite once I post this reply.

Yes my Lazarus experience is less than a year old, while my Delphi fiddlings go back to 1991 where I was learning Turbo Pascal and wrote procedures with a pencil on a sheet of paper.

WOW, quite the experience!!

I, myself, also started with Turbo Pascal 5.5/6.0.
Then did a bit of Delphi in the late 90's and early 2000's, but I have to admit that I'm now quite better at Free Pascal/Lazarus than I am at Delphi. In the last 20 years, Delphi has evolved in leaps and bounds, while I wasn't looking/using it.
For the last ~10 years I've been investing quite the time into Free Pascal and Lazarus and I feel a lot more confident in using it.

Cheers,
Gus

gcarreno's profile image gcarreno posted 1 month ago Permalink

Hey Ansgar,

Thanks for the invite!! I really, REALLY appreciate it !!

I'm not gonna do anything to the main repo, yet.
I think we should use my own forked repo to test the waters and see if you agree with my changes.
I've turned Discussions on, and have a pinned thread for us to discuss things.
This will allow you to get familiar with some of the stuff that GitHub provides, get familiar with the norms of Open Source repos in GitHub, and all that jazz.
But in a gradual way, with someone holding your hand, instead of having to bang your head against a problem, or having to Google something every 5 seconds ;).

One of the things I'm using on my forked repo is automation of release notes with git-cliff.
It's a Rust application that can be run from under git, as in git cliff ....
But this is quite far away from what you're doing now in terms of release notes. I would love to learn if you have any automation for it. If so, we can go from git-cliff to your thang.

The thing with git-cliff is that it uses this new thing called Conventional Commit Messages.
They all start with a section name( doc, fix, feat, refactor, etc... ), followed by a colon(:) and then a description, all not exceeding 50 chars.
You can also add some more text after an empty line, and that can be used for a more extensive description of the commit, along with things like Closes: <Issue Number>, which GitHub will auto-close that issue.
If you're interested you can go to: https://www.conventionalcommits.org/en/v1.0.0/ .
There's a lot of these nice automation things that GitHub provides.
I guess that GitLab does too, but I've been more focused on GitHub.

Okydokes, I'll see you over at my forked repo Discussion in order for us to have a move focused discussion of what I've changed and plan for the future!!

Cheers,
Gus

Please login to leave a reply, or register at first.