How to build a Windows Qt/MSBuild C++ application inside a Jenkins docker container - c++

First of all, I'm completely new in CI.
I am trying to set up a Jenkins to build several C++ projects I am hosting on my own Gitea instance.
The applications I want to add to my Jenkins build pipeline are mostly Qt or MSBuild projects.
I have installed the MSBuild plugin for Jenkins, however I couldn't find a Qt plugin.
Since the Jenkins docker container runs inside a Linux environment and runs on Linux itself too, I couldn't find out how to make Jenkins build MSBuild (.sln) or qt (.pro) projects.
How do I have to configure Jenkins to make it build MSBuild or Qt repositories?
Do I have to create makefile or CMakeLists files?
My goal is to have automated release builds inside my repositories built using my Jenkins docker container running on my Linux machine.
I really couldn't find a useful tutorial or explanation on this.
Thanks a lot in advance.

Related

How to configure my Jenkins to auto build and test my Qt project?

I'm a newer to Qt project,strange to its project structure.
I have used jenkins+git+github+MSBuild+xUnit to build CI for VS project in windows.
Now my job is to configure jenkins so that it can auto build and test my qt project(in Ubuntu).
However,it seems there is few information about "jenkins build Qt project".
I don't know which plugins should I use on jenkins and how to configure them.
Can you show me how to do that?(I use Ubuntu 16.04)
I have read this blog,and try to run that way:
https://www.peter.hartmann.tk/single-post/2015/06/17/Minimal-Continuous-Integration-for-Git-projects-with-Jenkins-and-a-Qt-example
In this blog,it use "qmake && make && make check" to do all the thing(build and test) without installing any plugin.what does this command do?Does it work for all Qt project?
What's more,in Ubuntu,can I pack my Qt project using jenkins?If yes,how to do that?(Windows can pack qt project as .exe file, Ubuntu pack as what kind of file?)
I'll just link to already existing materials, which there's plenty of.
In general there's three main steps in what you want to do:
Trigger Jenkins build after git push: How can I make Jenkins CI with git trigger on pushes to master?. That gives you Jenkins job execution (that at this point does nothing) after each git push automatically.
Pulling changes from SCM - that is a ready step within regular Jenkins project that you just click through.
Building your project - in case of QT project which can be built from command line (Compile a Qt project from command Line) you can add this as a simple shell command build step in Jenkins.
Optionally you can then run tests on the result, store your artifacts after a successful build and/or trigger email notifications on failed builds.
As for storing artifacts - there's a ready plugin for that (https://wiki.jenkins.io/display/JENKINS/Compress+Artifacts+Plugin).

TFS 2017 - Build and Release

I am very new in TFS, need to implement CICD using TFS 2017 and its build and release feature,
when I tried to run build after creating build definition, I got error like no agent found, I googled and found how to configure agent, but I have logical confusion in my mind as below:
How Agent works with TFS 2017?
Where process of CI will be run on Agent or on TFS server?
Where I need to have msbuild ? where my built code will be placed?
What other dependencies would be there on Agent machine?
all question might be silly but as I have worked with Jenkins and Git, i dont have knowledge of Microsoft technologies, and I can't find well documents for the same.
How Agent works with TFS 2017?
In short to build with TFS, you need to Deploy an agent, in the agent machine you need to install the proper build components/SDKs accordingly based on your project.
Create a build definition. Once a build is triggered , the sources will be downloaded from the TFS repository to the agent machine and then build in the agent machine.
Related documents : Agent pools and queues; Build and Release Agents; Build definition options
Where process of CI will be run on Agent or on TFS server?
You can eanble the CI (turn on the Continuous integration trigger) in build definition. See Configure continuous integration for details. Thus the build will automatically be triggered once changes are checked in.
Related documents: A quick introduction to CI/CD ; Build and release
Where I need to have msbuild ? where my built code will be placed?
For vNext build, it's task based build system. You can define your build definition based on the tasks. See Build and release tasks .
e.g.: You can use MSBuild or Visual Studio Build task, you can specify the MSBuild Arguments as needed.
You can use the utility task: Copy and Publish Build Artifacts and Publish Build Artifacts to specify where the built code will be placed. (Artifact Type : Server/File share path)
What other dependencies would be there on Agent machine?
Refer to the answer for the first question.

How to build Qt applications using Team Foundation Server 2017

I am currently in the process of migrating a couple of legacy Qt5 projects to a new Team Foundation Server. All projects have been developed for Windows in Visual Studio using the Qt VS AddIn (and thus don't use .pro-files). I would love to use the TFS Build Agent to build these on other platforms (mainly linux).
I have previously done this on other projects using Jenkins and qmake, having platform-dependent settings in the .pro-file.
Is there an established workflow for building VS projects using Qt5 via a TFS Build Server on other platforms?
I don't use TFS but, since TFS Build operates on Visual Studio solutions, it ought to be possible to use the "Linux development with C++" feature of VS2017. Just setup a Linux project in the VS solution and it should build like any other.
Seems you'd like to build Cross-Platform Code in Linux using TFS vNext build system. To build or deploy you'll need at least one agent. The cross platform build agent is support on Ubuntu, Red Hat, and CentOS.
Detail steps please refer this tutorial-- Deploy an agent on Linux. Then simply create the build definition add build task, select the Linux build agent the same as build on windows. More detail step and build configuration you could take a look at this video tutorial-- Building and Deploy Applications In Linux With TFS
In your case, there is not corresponding VS/Qt VS AddIn in your Linux environment. You need to set up your Linux build agent local environment to build your qt5 application successfully, then it's not hard to build through tfs.
Another way is scripting the Linux build process to run over SSH or some other remote protocol, and driving this process from the Windows build agent.

Managed builds on Linux

We have a TFS server which runs builds of our Windows-based software.
Now we had to port part of our software to Linux and we want to run the builds in a similar manner on Linux.
The project on Linux is created using Eclipse CDT, written in C++. The question would be how to run builds of this project on a Linux machine, and will it be possible to somehow integrate it into TFS infrastructure? For quality control, etc.
There is no out-of-the-box solution: currently there are no agents for Linux.
But wait, I did this once for a customer. The solution's pieces were:
setup SSH on Linux
write a Linux build script and save it in TFS version control
modify the custom template using the Community Build Extensions to:
a. push the script
b. invoke the script remotely
c. collect the build log(s)
d. copy the logs to the OutDir
I wrote a blog post with detailed instruction: http://casavian.eu/wordpress/2014/02/13/integrating-linux-builds-in-tfs/.

Jenkins with a Cocos2d-X project

I have just recently moved into developing Cocos2d-X application for Android devices, from native Android application development. I am looking to configure my Cocos2d-X C++/JAVA project in a JENKINS environment.
Has anyone any experience of using JENKINS with cocos2d-X projects ? Any tips on where i can get started ?
You can use the cutom scrip option, for example if you use the cocos2d-x model for build you can build your project with the custom command "make", in adition you can use statically code check, bla, bla, ...
I use too my machine as slave for no put the build environment in the server.
Yes. It depends upon the build tool you are using. I am using Ant with Eclipse. Try to read about building an Android Project from Command Line Using ant or gradle. and there you go,Include "Build Step"-> "Execute shell" in jenkins.
You have to manually check for all dependencies.