Forum > Third party

GitHub Action to setup Lazarus+FPC and/or OPM Packages

(1/2) > >>

Gustavo 'Gus' Carreno:
Hi there,

First of all, full disclosure, I'm far from being a JavaScript or TypeScript developer.
Second of all, because I'm such a developer, I had to develop this by "feeling in the dark".

And it really shows in the amount of tini-tyni commits I've done, while "feeling in the dark".

Ok, whit that said, I want to present setup-lazarus a GitHub Action, listed in the GitHub Marketplace.

Main features are:

* Works for Windows and Ubuntu environments provided by the Actions engine.
* I think I have a solution to make it work on the mac environment, but I've been lazy to resume the "feel in the dark" programming approach
* It uses the Lazarus and FPC bundles provided on Sourceforge
* It has a very early support for packages from the OPM homepage.
* I need to implement full support for dependency drill down
* I need to implement installing entries that have more than one package <-- At the moment this really breaks the action
I've also made a repository where I test the Action in a Lazarus project: lazarus-with-github-actions

I have a love/hate relationship with being in the spotlight, love because I'm human and have an ego, hate because I hate having my head explode due to ego.

So I would be remiss if I didn't mention that @salvadorbs didn't like my implementation, because it lacked cross-compilation and did another solution.

He decided to use @DonAlfredo's(Reinero?) fpcup / fpcuplaz combination.
He decided to code it all up in a command line kinda way.


--- Quote from: El Salvador on April 14, 2021, 07:33:07 pm ---Yes. My workflow is in https://github.com/salvadorbs/Asuite/blob/develop/.github/workflows/main.yml. But beware, the workflow is not entirely my doing. I have the idea (and many parts of the workflow) from @Olly (and its workflow file https://github.com/ollydev/Simba/blob/simba1400/.github/workflows/build.yml ): https://forum.lazarus.freepascal.org/index.php/topic,34645.msg389924.html#msg389924

--- End quote ---

If I ever finish the main 2 issues of setup-lazarus(dependency on OPM and mac support), I'll maybe try and put this idea in TypeScript form.

Cheers,
Gus
PS: @trev Dunno if this belongs in Third Party. If not, could you kindly move my sorry ass? MTIA!!

Warfley:
A year ago I built something similar for gitlab, the core of it is this python script: Link, it already solves the dependency issue and the multipackage packages (sounds kinda weird). Also has some neat functions like automatically detecting which packages a project requires, so maybe give it a look.

I don't know much about how github actions work, but for gitlab I used Linux docker images, which contain the Lazarus installation (Link) including a cross compiler for Windows, build using fpclazup.
This has the advantage of the docker images being prebuilt, so the lazarus and the cross compiler installation don't take up runtime during the CI/CD. If you are more interested in how this works, at least on gitlab, you can checkout my gitlab example: Link, but I have no idea how this would look on github.

I thought about porting this apporach to github actions, but tbh I mostly use gitlab anyway and github actions are to complicated for me xD. But it's nice to see that others also work on devops stuff for Lazarus.

Edit: just seen that I never commited the dependency resolution in my python script, so what I claimed earlier isn't really true. Maybe I can find it on my old laptop, but seems like this commit is lost, but maybe I will update this script some time, lately I've been using this again and I found a few things I wanted to add anyway.

El Salvador:
Hi Gus!  :D


--- Quote from: Gustavo 'Gus' Carreno on April 12, 2021, 08:22:49 pm ---So I would be remiss if I didn't mention that @salvadorbs1 didn't like my implementation, because it lacked cross-compilation and did another solution.

--- End quote ---
Your solution is valid, but it is not suitable for my project. That's all. For example, your solution lacks cross-compilation for win64 (if I remember correctly, but I have a bad memory  :-[ ).


--- Quote ---He decided to only use the Ubuntu environment.
--- End quote ---
Nope. I use both windows and ubuntu. In particular one Windows 64bit and three Ubuntu (so I can build easily for GTK2, GTK3 and QT).


--- Quote ---He decided to use @DonAlfredo's(Reinero?) old fpcup.
--- End quote ---
Yep, but it is not old. @DonAlfredo keeps the codebase aligned with the counterpart FpcUpDeluxe. Why fpcup (with docker option)? Well, for these reasons:
- I can easily install Lazarus (and FPC) patches in my lazarus build. Yes, I need it to restore a feature in windows that was removed in Lazarus 2.2.
- Since OPM doesn't support install packages of a particular version, I decided to directly put third party packages as git submodules into my project's repository. So, I add these packages using lazbuild.exe (with param --skip-dependencies)

Slow lazarus build isn't a big deal because I can cache the entire Lazarus directory using github actions/cache (no cache 13minutes, cache only 3minutes).


--- Quote ---He decided to code it all up in a command line kinda way.
--- End quote ---
Yes. I don't have time to learn how to develop Github Actions (and typescript).  :D


--- Quote ---@SalvadorBS: If it's you, could you please gimme a link to your workflow.yaml file, so I can link it here? Thanks!!
--- End quote ---
Yes. My workflow is in https://github.com/salvadorbs/Asuite/blob/develop/.github/workflows/main.yml. But beware, the workflow is not entirely my doing. I have the idea (and many parts of the workflow) from @Olly (and its workflow file https://github.com/ollydev/Simba/blob/simba1400/.github/workflows/build.yml ): https://forum.lazarus.freepascal.org/index.php/topic,34645.msg389924.html#msg389924

Gustavo 'Gus' Carreno:
Hey Warfley,


--- Quote from: Warfley on April 14, 2021, 04:49:50 pm ---A year ago I built something similar for gitlab, the core of it is this python script: Link, it already solves the dependency issue and the multipackage packages (sounds kinda weird). Also has some neat functions like automatically detecting which packages a project requires, so maybe give it a look.

--- End quote ---

I'll have a look into that repo.
I have to be perfectly honest and say that it's mainly due to laziness that I haven't done the dependency and multipackage packages(it does sound funny) and nothing else.
So maybe looking at someone else's code may flicker a spark, hopefully :)


--- Quote from: Warfley on April 14, 2021, 04:49:50 pm ---I don't know much about how github actions work, but for gitlab I used Linux docker images, which contain the Lazarus installation (Link) including a cross compiler for Windows, build using fpclazup.
This has the advantage of the docker images being prebuilt, so the lazarus and the cross compiler installation don't take up runtime during the CI/CD. If you are more interested in how this works, at least on gitlab, you can checkout my gitlab example: Link, but I have no idea how this would look on github.

--- End quote ---

Under GitHub I'm not sure of the virtualization software they use.
What you're given access is a Windows/Ubuntu/macOS machine with some stuff already installed.
Mainly linux tools to aid in installing other software. And even that I'm not sure since I didn't dig into the docs for Actions.
I looked at some simple TypeScript code and then hacked my way to the current incarnation.


--- Quote from: Warfley on April 14, 2021, 04:49:50 pm ---I thought about porting this apporach to github actions, but tbh I mostly use gitlab anyway and github actions are to complicated for me xD. But it's nice to see that others also work on devops stuff for Lazarus.

--- End quote ---

GitHub actions are not complicated at all, it's just a YAML file to configure the triggers and list other actions you can use, like the necessary action to clone the project.
But you don't have to use any fancy stuff,  cuz on that same YAML you can just use plain old bash scripting, or call python, etc, from that YAML.


--- Quote from: Warfley on April 14, 2021, 04:49:50 pm ---Edit: just seen that I never commited the dependency resolution in my python script, so what I claimed earlier isn't really true. Maybe I can find it on my old laptop, but seems like this commit is lost, but maybe I will update this script some time, lately I've been using this again and I found a few things I wanted to add anyway.

--- End quote ---

You naughty, naughty boy!!! ;) Giving me hope in continuing to be a lazy bastard, and then you yank the rug ritght  under me feet, AHHH THE DESPAIR ;)

I would really thank you if you could find even the smallest of implementations!!!

Cheers,
Gus

Gustavo 'Gus' Carreno:
Hey Salvador,


--- Quote from: El Salvador on April 14, 2021, 07:33:07 pm ---Your solution is valid, but it is not suitable for my project. That's all. For example, your solution lacks cross-compilation for win64 (if I remember correctly, but I have a bad memory  :-[ ).

--- End quote ---

That is no longer the case, and it's because of you that I found out that the Windows machines are actually 64b and not 32b as I, wrongly, assumed.
At the moment the Windows machines are downloading the 64b version of Lazarus+FPC and using that to compile.

What I don't have is the ability to specify any cross-compilation.
Which isn't needed if you're only interested in the CI(Continuous Integration) aspect.
If you want to cross-compile, package(zip, tar.gz) and then upload to a release, well, that will need some thought as it's more in the realm of CD(Continuous Distribution)
I guess I can mess around a bit with the cross packages provided at sourceforge(?) and get it done, but that will have to wait until I get dependency and multipackage packages(still sounds funny) done and also after making it macOS enabled.


--- Quote from: El Salvador on April 14, 2021, 07:33:07 pm ---Nope. I use both windows and ubuntu. In particular one Windows 64bit and three Ubuntu (so I can build easily for GTK2, GTK3 and QT).

--- End quote ---

Ooopps, sorry, mea culpa. I still think my memory is any good and don't confirm my facts...


--- Quote from: El Salvador on April 14, 2021, 07:33:07 pm ---Yep, but it is not old. @DonAlfredo keeps the codebase aligned with the counterpart FpcUpDeluxe. Why fpcup (with docker option)? Well, for these reasons:

--- End quote ---

Yeap, my fault again. I agree that the word OLD was misused.
What I shoulda said was: Came before fpcupdeluxe. That's more accurate than old.


--- Quote from: El Salvador on April 14, 2021, 07:33:07 pm ---Slow lazarus build isn't a big deal because I can cache the entire Lazarus directory using github actions/cache (no cache 13minutes, cache only 3minutes).

--- End quote ---

Humm, that's a nice thing to have in mind :)


--- Quote from: El Salvador on April 14, 2021, 07:33:07 pm ---Yes. I don't have time to learn how to develop Github Actions (and typescript).  :D

--- End quote ---

Yeah, can relate to this one. It was a rather steep learning curve to get the Action to it's current incarnation :)


--- Quote from: El Salvador on April 14, 2021, 07:33:07 pm ---
--- Quote ---@SalvadorBS: If it's you, could you please gimme a link to your workflow.yaml file, so I can link it here? Thanks!!
--- End quote ---
Yes. My workflow is in https://github.com/salvadorbs/Asuite/blob/develop/.github/workflows/main.yml. But beware, the workflow is not entirely my doing. I have the idea (and many parts of the workflow) from @Olly (and its workflow file https://github.com/ollydev/Simba/blob/simba1400/.github/workflows/build.yml ): https://forum.lazarus.freepascal.org/index.php/topic,34645.msg389924.html#msg389924

--- End quote ---

Thanks Salvador, I'll update my post with this and all the corrections you posted.

Cheers,
Gus

Navigation

[0] Message Index

[#] Next page

Go to full version