Recent

Author Topic: Automating building using Github Continous Integration?  (Read 4777 times)

Gizmo

  • Hero Member
  • *****
  • Posts: 831
Automating building using Github Continous Integration?
« on: March 30, 2018, 04:49:28 pm »
Whenever I need to compile a new version of my cross platform tools, I do it like this :

Copy code to OSX system. Compile and build.
Copy code to Windows virtual machine. Compile and build.
Copy code to Linux 32-bit distribution virtual machine. Compile and build.
Copy code to Linux 64-bit distribution virtual machine. Compile and build.

Upload binaries, executable and OSX app file to web server. 

As you might imagine, that is a bit of a faff!! And can be frustrating, especially if you get to the end of even half way through and realise I've forgot to update a form caption or something and so have to repeat it all!

Someone mentioned that if code is on GitHub, the build process can be automated for all three systems using continuous integration.

Question 1 : Is that true, for Lazarus\Freepascal projects?
Question 2 : If so, how is it done?
Question 3 : If it can't be done using Githubs Continous Integration, is there a simpler way?

I realise in the project settings you can change the target CPU and so on, but I've never yet successfully managed to create, for example, a Linux binary on a Windows system. So I've always just done it as stated in the steps above.

Any guidance welcome.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8793
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Automating building using Github Continous Integration?
« Reply #1 on: March 31, 2018, 06:55:10 am »
Question 1 : Is that true, for Lazarus\Freepascal projects?
Yep, it's not tied to any specific language technologies. Github itself doesn't provide any CI, but it welcomes any kind of CI, you just need to make a good use of its webhooks service.
Question 2 : If so, how is it done?
Register a webhook on push event, that calls your CI server to build for all targets. Note that this means you must be able to setup cross compilation or forward the request to different machines capable of building each of your targets. You decide, the CI server won't have any knowledge for it.
Question 3 : If it can't be done using Githubs Continous Integration, is there a simpler way?
Build modes, but that requires you to be able to solve this:
I realise in the project settings you can change the target CPU and so on, but I've never yet successfully managed to create, for example, a Linux binary on a Windows system.
once solved, just press "compile many modes" which by default should pick all build modes, and press ok.

Gizmo

  • Hero Member
  • *****
  • Posts: 831
Re: Automating building using Github Continous Integration?
« Reply #2 on: March 31, 2018, 04:44:10 pm »
Thanks Lelumbo for the guidance.

Quote
that calls your CI server

does that mean you can't do this on the general public GitHub system? I don't have my own server. I use the global Github open-source free system.

UPDATE : Just discovered you can do it on that - https://github.com/marketplace/circleci

So I'll check it out and report back...thank you
« Last Edit: March 31, 2018, 04:48:32 pm by Gizmo »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8793
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Automating building using Github Continous Integration?
« Reply #3 on: March 31, 2018, 05:56:46 pm »
I don't have my own server.
You don't have to have dedicated machines and use hardware specifically designed for server, any computer will do. You can have it locally installed in the computer you're using for development (it's just maybe you will need a strong many core CPU, big and fast RAM and fast disk, otherwise either your work or the server work would be disturbed very often) or have a secondary computer with only the CI server installed and running, connected with your primary computer through local network.
UPDATE : Just discovered you can do it on that - https://github.com/marketplace/circleci

So I'll check it out and report back...thank you
Ah, I forgot that github has its own marketplace. In the continuous integration category, you can find more implementations. I remember somebody posted a Travis CI integration a couple of months ago. Unfortunately, those github hosted ones have preconfigured limited set of supported languages, despite the actual implementation doesn't have any language limitations, including Circle CI. Moreover, as you can read in the page, the github hosted one only supports building for linux, despite the out of github one supports MacOS.

Chronos

  • Sr. Member
  • ****
  • Posts: 250
    • PascalClassLibrary
Re: Automating building using Github Continous Integration?
« Reply #4 on: April 03, 2018, 09:58:22 am »
For Linux 32-bit and 64-bit versions you can setup new Launchpad project to import your github project automatically and let their build servers do the work. Thanks to that you can generate deb packages and install them with standard apt to your desktops/servers.
http://wiki.freepascal.org/Publish_project_on_Launchpad

But I would rather have own build system installed on local server which would be able to build for various Linux distributions, Windows and OSX at once. But cross-compilation from Linux to other platforms/architectures is not easy task, indeed.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: Automating building using Github Continous Integration?
« Reply #5 on: April 03, 2018, 10:35:06 am »
You could use https://jenkins.io/ as CI Server.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8793
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Automating building using Github Continous Integration?
« Reply #6 on: April 04, 2018, 10:18:53 pm »
But cross-compilation from Linux to other platforms/architectures is not easy task, indeed.
Windows is easy, others are not.

 

TinyPortal © 2005-2018