Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
GitLab Quick Start Guide

You're reading from   GitLab Quick Start Guide Migrate to GitLab for all your repository management solutions

Arrow left icon
Product type Paperback
Published in Nov 2018
Publisher Packt
ISBN-13 9781789534344
Length 180 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Adam O'Grady Adam O'Grady
Author Profile Icon Adam O'Grady
Adam O'Grady
Arrow right icon
View More author details
Toc

Adding .gitlab-ci.yml to our example project

We've added tests to our ROT13Formatter project, but now we need to get those tests to be automatically executed in GitLab (either GitLab.com or our own hosted instance). To do this, let's create a file called .gitlab-ci.yml in our project and add the following to it:

before_script:
- apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq ca-certificates git php php-xml
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php
- php composer.phar install

phpunit:
script:
- vendor/bin/phpunit tests/ROT13FormatterTest

This exact file was discussed in the previous section, so we know that it simply executes a series of commands to configure the Runner and then runs one task that executes our tests. Now save, commit, and...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime