Setting a PHP Project in Jenkins

Continuous Integration (CI) is the process by which a developer makes his/her contribution a part of the whole and ensures that it fits well in the whole, regularly. Using CI, its easy to cross-check all the updates/check-ins into the project automatically with pre-defined validations. Their are number of CI tools available that are either free or very cheap.Most popular CI tools available are Jenkins, Travis CI, Cruise Control, Teamcity etc.After some deliberations and discussion I short-listed Jenkins to use for CI in one of our PHP projects. Here are my experiences for the benefit of any one else trying to accomplish the same.

First time ever when I started evaluating Jenkins, following questions came to my mind:-

A) How to install Jenkins with basic configuration?

B) Plugins used to build a PHP project?

C) How to create a PHP project in Jenkins?

A. Commands used to install Jenkins in Linux:-

  1. yum install -y wget
  2. sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
  3. sudo rpm –import https://jenkins-ci.org/redhat/jenkins-ci.org.key
  4. sudo yum install jenkins
  5. sudo yum install java-1.7.0-openjdk
  6. firewall-cmd –zone=public –add-port=8080/tcp –permanent
  7. firewall-cmd –reload
  8. sudo /etc/init.d/jenkins restart
  9. systemctl restart jenkins.service
  10. Open http://localhost:8080 URL in browser and the below screen will open. It shows Jenkins is installed and running successfully.

B. Their are number of php plugins, the following are the basic ones those can be used:-

  • PHPUnit : – allows running automated tests on code (required).
  • PHP_CodeSniffer : analyse our code and detect errors in the coding standards.
  • PHPLOC : is used to analyse the size and structure of the code.
  • PHP_Depend : does static code analysis and provide metrics to evaluate the quality of code.
  • PHPMD : detects problem in the code. For analysis it use s the PHP_Depend analysis data.
  • PHPCPD : detects the duplicacy or copy/paste instances throughout the code base.
  • Clover PHP Plugin : used to provide code coverage reports from PHPUnit.
  • xUnit Plugin : This tools is used to publish the build execution results into Jenkins tool.

C. Set up PHP job into Jenkins:-

Before doing that, we have to check whether Ant installed on our server or not. If not, please install it.

Commands used to install Ant in Linux:
  1. sudo apt-get install ant
Now, what is ANT?

It helps in automating the software build process. It reads and processes a configuration file (contains tasks to be performed), also defines our project’s dependencies. Most used ANT configuration file name is build.xml. I also created the same and added to our project, so that Ant will work during Jenkins build creation process.

PHPUnit Configuration:

We can also configure the PHPUnit XML details into build.xml. So during the build process, the PHPUnit xml configuration also gets processed and the PHP unit test cases will be executed.

After all these set-ups, lets start creating/configuring our first PHP job in Jenkins.

Step 1: Click on “New Item” from the left menu. Enter the Item Name like “testPHPProject” and select “Freestyle project” option and hit the “OK” button.

Step 2: A new project with name “testPHPProject” created and its configuration page opens. Here we need to configure our PHP project.

In below screen, basic details are shown which has to be filled to configure the project. The details are as follows:-

1: In “Source Code Management” section, we have to provide how would Jenkins fetch the code base. For example, from GIT or the File System. Here, I have shown an example using a File System.

2: In “Build Triggers” section, we specify which method should be used for automatic build creation. If we have used GIT as “Source Code Management” tool, then we can choose an option to create build when anything changes in the repository. But in our example, we selected “Build periodically” and added vaue as “0 14 * * *”, which means everyday at 2 PM the build creation process will be started.

3: In “Build” section, a number of “build step” options are provided. Here since we are using Ant for build process, please choose “Invoke Ant” option and provide the absolute path of the Ant configuration file path in “Build File” textbox.

4: Jenkins also provides an option to add multiple “Post-build Actions”. Using this we can add multiple actions like Publish HTML, JAVADoc, Clover PHP coverage report and many others.

Here, I have chosen “Publish Clover PHP Coverage Report”. To publish it we have to provide the Clover XML Location.

Step 3: Click Save. The project will be configured.

Step 4: Click use Build Now option to create our first project build.

Understand softwares!

Every day, we come across different types of computer software that helps us with our tasks and increase our efficiency. From MS Windows that greets us when we switch on the system to the web browser that is used to surf the internet or the games that we play on our computer to the calorie burn counter on our smartphone, are all examples of software. In this world of technology, we even come across various software development trends that help our business to grow, we are surrounded by all these software that are determined to make our lives easier. By definition, Software (also abbreviated as an SW or S/W) is a collection of data, programs, procedures, instructions, and documentation that perform various predefined tasks on a computer system. They enable users to interact with the computer

In the field of software engineering and computer science, the software is nothing but information processed by a computer system and programs. The software includes libraries, programs, and corresponding non-executable data, such as digital media and online documentation. Computer hardware and software need each other and neither one of them can be convincingly used on its own. The amalgamation of the hardware and the software gives control and flexibility to modern-day computing systems. Without software, computers would be of no use. For instance, without the help of your web browser software, you will not be able to surf the Internet. Similarly, without an operating system, no application can run on your computer.

Today there are abundant high-end technologies and software accessible to us that outline the way we lead our lives and house our continuously changing and increasing needs. The endless number of software types can be overwhelming for anybody, especially when one does not understand the various types of software and their users thoroughly.

Different Types of Software

Typically, there are two major classifications of software, namely System Software and Application Software.

1. System Software

A system software aids the user and the hardware to function and interact with each other. Basically, it is a software to manage computer hardware behavior so as to provide basic functionalities that are required by the user. In simple words, we can say that system software is an intermediator or a middle layer between the user and the hardware. These computer software sanction a platform or environment for the other software to work in. This is the reason why system software is very important in managing the entire computer system. When you first turn on the computer, it is the system software that gets initialized and gets loaded in the memory of the system. The system software runs in the background and is not used by the end-users. This is the reason why system software is also known as ‘low-level software’.

System Software

Some common system software examples are:

  • Operating System: It is the most prominent example of System Software. It is a collection of software that handles resources and provides general services for the other applications that run over them. Although each Operating System is different, most of them provide a Graphical User Interface through which a user can manage the files and folders and perform other tasks. Every device, whether a desktop, laptop or mobile phone requires an operating system to provide the basic functionality to it. As an OS essentially determines how a user interacts with the system, therefore many users prefer to use one specific OS for their device. There are various types of operating system such as real-time, embedded, distributed, multiuser, single-user, internet, mobile, and many more. It is important to consider the hardware specifications before choosing an operating system. Some examples of Operating systems given below:
    • Android
    • CentOS
    • iOS
    • Linux
    • Mac OS
    • MS Windows
    • Ubuntu
    • Unix
  • Device Drivers: It is a type of software that controls particular hardware which is attached to the system. Hardware devices that need a driver to connect to a system include displays, sound cards, printers, mice and hard disks. Further, there are two types of device drivers: Kernel Device Drivers and User Device Driver. Some examples of device drivers are:
    • BIOS Driver
    • Display Drivers
    • Motherboard Drivers
    • Printer Drivers
    • ROM Drivers
    • Sound card Driver
    • USB Drivers
    • USB Drivers
    • VGA Drivers
    • VGA Drivers
    • Virtual Device Drivers
  • Firmware: Firmware is the permanent software that is embedded into a read-only memory. It is a set of instructions permanently stored on a hardware device. It provides essential information regarding how the device interacts with other hardware. Firmware can be considered as ‘semi-permanent as it remains permanent unless it is updated using a firmware updater. Some examples of firmware are:
    • BIOS
    • Computer Peripherals
    • Consumer Applications
    • Embedded Systems
    • UEFI
  • Programming Language Translators: These are mediator programs on which software programs rely to translate high-level language code to simpler machine-level code. Besides simplifying the code, the translators also do the following :
    • Assign data storage
    • Enlist source code as well as program details
    • Offer diagnostic reports
    • Rectify system errors during the runtime
    • Examples of Programming Language Translators are Interpreter, Compiler and Assemblers.
  • Utility: Utility software is designed to aid in analyzing, optimizing, configuring, and maintaining a computer system. It supports the computer infrastructure. This software focuses on how an OS functions and then accordingly it decides its trajectory to smoothen the functioning of the system. Softwares like antiviruses, disk cleanup & management tools, compression tools, defragmenters, etc are all utility tools. Some examples of utility tools are:
    • Avast Antivirus
    • Directory Opus
    • McAfee Antivirus
    • Piriform CCleaner
    • Razer Cortex
    • Windows File Explorer
    • WinRAR
    • WinZip

2. Application Software

Application software and Peopleware

Application Software, also known as end-user programs or productivity programs is software that helps the user in completing tasks such as doing online research, jotting down notes, setting an alarm, designing graphics, keeping an account log, doing calculations or even playing games. They lie above the system software. Unlike system software, they are used by the end-user and are specific in their functionality or tasks and do the job that they are designed to do. For example, a browser is an application designed specifically for browsing the internet, or MS Powerpoint is an application used specifically for making presentations. Application Software or simply apps can also be referred to as non-essential software as their requirement is highly subjective and their absence does not affect the functioning of the system. All the apps that we see on our mobile phones are also examples of Application Software. There is certain software that is exclusively made for app development like Meteor and Flutter. These are examples of Application software too.

There are various types of application software:

  • Word Processors: These applications for documentation. Along with that it also helps in storing, formatting and printing of these documents. Some examples of word processors are:
    • Abiword
    • Apple iWork- Pages
    • Corel WordPerfect
    • Google Docs
    • MS Word
  • Database Software: This software is used to create and manage a database. It is also known as the Database Management System or DBMS. They help with the organization of data. Some examples of DBMS are:
    • Clipper
    • dBase
    • FileMaker
    • FoxPro
    • MS Access
    • MySQL
  • Multimedia Software: It is the software that is able to play, create or record images, audio or video files. They are used for video editing, animation, graphics, and image editing, Some examples of Multimedia Software are:
    • Adobe Photoshop
    • Inkscape
    • Media Monkey
    • Picasa
    • VLC Media Player
    • Windows Media Player
    • Windows Movie Maker
  • Education and Reference Software: These types of software are specifically designed to facilitate learning on a particular subject. There are various kinds of tutorial software that fall under this category. They are also termed academic software. Some examples are:
    • Delta Drawing
    • GCompris
    • Jumpstart titles
    • KidPix
    • MindPlay
    • Tux Paint
  • Graphics Software: As the name suggests, Graphics Software has been devised to work with graphics as it helps the user to edit or make changes in visual data or images. It comprises of picture editors and illustration software. Some examples are:
    • Adobe Photoshop
    • Autodesk Maya
    • Blender
    • Carrara
    • CorelDRAW
    • GIMP
    • Modo
    • PaintShop Pro
  • Web Browsers: These applications are used to browse the internet. They help the user in locating and retrieving data across the web. Some examples of web browsers are:
    • Google Chrome
    • Internet Explorer
    • Microsoft Edge
    • Mozilla Firefox
    • Opera
    • Safari
    • UC Browser

Other than these, all the software that serves a specific purpose fall under the category of Application Software.

However, there exists one more classification of the software. The software can also be classified based on its availability and sharability.

This classification is as given below:

1. Freeware

Freeware software is available without any cost. Any user can download it from the internet and use it without paying any fee. However, freeware does not provide any liberty for modifying the software or charging a fee for its distribution. Examples are:

  • Adobe Reader
  • Audacity
  • ImgBurn
  • Recuva
  • Skype
  • Team Viewer
  • Yahoo Messenger

2. Shareware

It is software that is freely distributed to users on a trial basis. It usually comes with a time limit and when the time limit expires, the user is asked to pay for the continued services. There are various types of shareware like Adware, Donationware, Nagware, Freemium, and Demoware (Cripplewareand Trialware). Some examples of shareware are:

  • Adobe Acrobat
  • Getright
  • PHP Debugger
  • Winzip

3. Open-source

Linux: "Collabora. An open-source (and libre software) …" - LinuxRocks.Online

These kinds of software are available to users with the source code which means that a user can freely distribute and modify the software and add additional features to the software. Open-Source software can either be free or chargeable. Some examples of open-source software are:

  • Apache Web Server
  • GNU Compiler Collection
  • Moodle
  • Mozilla Firefox
  • Thunderbird

4. Software

They are also known as Closed-source software. These types of applications are usually paid and have intellectual property rights or patents over the source code. The use of these is very restricted and usually, the source code is preserved and kept as a secret.

 

 

error: Content is protected !!