Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up PHPUnit with Gitlab Continuous Integration

I've been tasked with investigating Continuous Integration, and one of the things I am looking at is Gitlab CI.

I have set up Gitlab, Gitlab CI and two runners, but I am absolutely stuck on how to really use this. How could I do something like create a unit test, push that to the repo, and have one of the runners test it?

Or am I completely missing the point here? I'm new to this CI stuff (as in, I was asked to do this yesterday and that's the first time I've come in contact with CI) so if I'm missing the point, please let me know and point me towards some resources.

Thanks a lot.

like image 493
jrdn Avatar asked Aug 01 '13 10:08

jrdn


People also ask

Can GitLab be used for CI CD?

all tiers. GitLab CI/CD is a tool for software development using the continuous methodologies: Continuous Integration (CI) Continuous Delivery (CD)

What is CI CD in PHP?

CI & CD – An IntroductionContinuous Integration is a development workflow in which multiple developers continuously merge their code changes into a common, shared code repository. This is usually combined with code testing.

How does GitLab CI CD pipeline work?

A pipeline is usually triggered by a source code repository. Changes in code activate a notification in the CI/CD pipeline tool, which operates the corresponding pipeline. Other triggers you might see frequently include user-initiated or automatically scheduled workflows, as well as results of other pipelines.


1 Answers

Turns out that in the settings for either the runners or the repo in the CI panel, there is a scripts window. This can be used to directly execute shell commands, such as phpunit -c /path/to/tests, and will work out whether the tests have failed or passed.

I think this might be due to PHPUnit outputting to stderr instead of stdout, but I don't really know - not part of the scope so I haven't looked into it yet.

like image 115
jrdn Avatar answered Oct 16 '22 10:10

jrdn