• No results found

jenkins, drupal & testing automating every phing! miggle

N/A
N/A
Protected

Academic year: 2021

Share "jenkins, drupal & testing automating every phing! miggle"

Copied!
36
0
0

Loading.... (view fulltext now)

Full text

(1)

miggle

miggle

jenkins, drupal & testing

automating every phing!

(2)

miggle

about me

> Drupal dev for 6+ years > PHP dev for 10+ years > Husband

> Cyclist

> Frustrated rockstar…

miggle @8ballmedia

(3)
(4)
(5)

miggle

aims

> Encourage best practices > Ensure quality at scale

> Release more frequently and reliably > Develop more robust solutions

> Deploy with confidence

(6)

miggle

improving quality control

> Write better code

• Adhering to Drupal coding standards! • Evaluate code complexity

• Detect messy copy/paste code

> Validate that our code achieves objectives • Simpletests

• Behat tests

> Automate labour intensive tasks

(7)

miggle

my requirements

> Create something reusable & future proof > Create a starting point for future projects > Use open source

> Report failures

• email accountable team members!

(8)

miggle

Intercept obvious issues

(9)

miggle

…before they reach the

stakeholders!

(10)

miggle

create a development

pipeline…

STG

CI LIVE

(11)

miggle

(12)

miggle miggle

(13)

miggle

barrier to entry

(14)

miggle

buzz words & acronyms!

> Devops - a state of mind man!

• bridging the gap between sys/dev > BDD - Behaviour Driven Development > CDD - Code Driven Development

> TDD - Test Driven Development > CI - Continous Integration

> CD - Compact Disc Continuous Delivery

(15)

miggle

hi, I’m jenkins

> Continuous Integration application > Automate tasks

> Huge library of plugins

> Trigger tasks from other jobs or Github for example > Report Success/failures

> Communicate with other servers

(16)

miggle

> http://jenkins-php.org/

> http://reload.github.io/jenkins-drupal-template

(17)

miggle

creating your own ci setup

> Tools

> Requirements > Guidelines

(18)

miggle

tool box

> Ubuntu - Digital Ocean 1GB+

> Jenkins - CI server with numerous plugins > Github - good compatibility w/ Jenkins

> Composer - dependency manager

> Phing - Automation using XML files and PHP > Automated testing - Simpletest, Behat

> Drupal w/ Sqlite

(19)

miggle

evaluating code quality

> Code analysis w/ Coder > Duplicate code detection

> PHP Mess detection, copy/paste detection > JS & CSS linting

(20)

miggle

why composer

> PHP package manager > Alternative to PEAR

> Allows for dependencies per project

> Requires additional PATH config in Jenkins > Simpler transition to hosted services

(21)

miggle

composer.json

{ "repositories": [ { "type": "package", "package": { "name": "drupal/phing-drush-task", "version": "1.0", "source": { "url": "http://git.drupal.org/project/phingdrushtask.git", "type": "git", "reference": "7.x-1.0" }, "autoload": { "classmap": [ "DrushTask.php" ] }, "include-path": [ "." ] } } ], "require": { "phing/phing": "2.*", "drupal/phing-drush-task": "1.0", "drupal/drupal-extension": "1.0.*@stable", "drush/drush": "6.2.*", "squizlabs/php_codesniffer": "1.5.*", "phpmd/phpmd": "1.5.*", "sebastian/phpcpd": "*", "phploc/phploc": "*", "drupal/coder": "7.2.*" }, "config": { "bin-dir": "bin/" }, "minimum-stability": "beta" }

(22)

miggle

phing

> Build automation tool > Based on Apache ANT

> Good integration w/ Jenkins > XML & PHP based

> Drush integration available

miggle

<?xml version="1.0" encoding="UTF-8"?>

<project name="phing-drupal" default="build"> 


<!-- ## Main targets —>

<target name="build" depends="init, clean, verify,

analyze" /> </project>

> https://www.drupal.org/project/phingdrushtask

<drush command="site-install" assume="yes""> <option name="locale">uk</option>

<option name="site-name" value="${sitename}" /> <param>expert</param>

(23)

miggle

build.default.properties

> Specify project properties

> Can be overridden in Jenkins > Multiple properties files

• useful for different envs.

miggle

# The directory containing the modules and themes for the project relative to the drupal root

directory.

project.code.dir = sites/all

# A common prefix for modules to evaluate project.code.prefix = master

# The names of other modules and themes to evaluate project.code.custom = master_dependency

<drush command="site-install" assume="yes">

<option name="db-url">${drupal.db.url}</option> <param>${drupal.profile}</param>

(24)

miggle

follow the rules

> Standardisation is key > Naming conventions 


from the outset

> Standard directory 
 structures > Prefixing miggle build.xml build.default.properties build.components/ build.components/build.drupal_site_install.xml composer.json docroot/ docroot/sites/all/modules/features/my_feature/ docroot/sites/all/modules/features/my_feature2/ docroot/sites/all/modules/custom/my_helper/

(25)

miggle

let’s get going…

miggle

https://github.com/miggle/Migl-Phing-Drupal


(26)

miggle miggle

(27)

miggle

what just happened…

> Installed and started Jenkins

> Installed required server packages > Installed composer globally

(28)

miggle miggle

(29)
(30)
(31)

miggle

…finalising

> Configured Jenkins

> Install Drupal-Jenkins template > Initial build

> Configure Apache > Final build

(32)

miggle

review the results

> Set the levels at which a build is marked: • unstable

• broken

> Email contributing developers a status update • happens by default w/ github plugin

> Advise developers of where code can be improved > Provide metrics on code

(33)

miggle

caveats

> Additional overhead writing automated tests • devs need to learn how to write tests

> Tests need to be written correctly • false positives are not useful! > Initial project setup overhead

• although could be automated > Tests take time to run…but

> …automated on push so no need to wait!

(34)

miggle

hosted alternatives to

jenkins

> Travis CI - free for open source > Circle CI, Magnum CI and more… > Benefits of hosted CI

• infrastructure managed elsewhere • 100% self contained

(35)

miggle

thanks!

> Huge thanks to these amazing people!!:


> https://github.com/nlisgo

> http://reload.github.io/jenkins-drupal-template/ > https://github.com/omissis/drupal-ignite

> https://github.com/lhridley/drupal7-jenkins-templates

(36)

miggle

let’s discuss…

> Twitter: @8ballmedia > Web: 8ballmedia.co.uk > D.O. 8ballsteve > LinkedIn: uk.linkedin.com/in/stevegushrichards miggle > http://tinyurl.com/mwjgomv

References

Related documents

It was a short step from here to computer interpretation of test results, and programs were written to provide descriptions of individual characteristics based on scores

Still, a comparison of the flux-folded cross sections of MiniBooNE and T2K, shows that for forward muon scattering, the neutrino-induced low-energy nuclear excitations (ω &lt; 50

Convenience Food Stores - With Fast Food Restaurant - No Gasoline Sales.. 09341 Convenience Food Stores - With Fast Food Restaurant

We have presented a comparison between two high-level power estimation models: the Hamming distance model and the analytical model, considering both average values of in- put data

Multiple conversations are taking place on campus to explore matters of creating a safe space for students, recruiting a diverse student body, and covering social

Reconstruction Histories Courtney Walcott.. The

This study aims to recognize the effect of the working pillars of the internal audit committees in improving the financial performance in the commercial banks in Jordan.The