Recently I posted about how to run codeception with DDEV.
https://dev.to/tomasnorre/codeception-ddev-selenium-docker-36kk
This is of course really nice, but having it as part of the CI pipeline is even better.
So I decided to try to make it run within Travis CI which is my preferred public CI at the moment.
What to do?
- Signup with travis-ci and registre your repository
- Add a
.travis.yml
to your github repository - Make changes and push, and wait for the results of the tests.
You can see the step in the Travis CI Tutorial
The advantages here is that you will have your behaviour driven tests executed on every commit and pull request, to make sure you or others don't break functionality.
Configuring Travis CI
The .travis.yml
is the configuration file for Travis CI. I contains different step and instructions to enable travis to do what you want.
This can be used to run PHPUnit, Checking Coding Standard, Codeception tests and so on, only your imagination is the limit.
This is how the .travis.yml
looks like for my https://github.com/tomasnorre/ddev-codeception-poc
language: php
dist: bionic
notifications:
email:
on_success: never
on_failure: never
before_install:
# turn off XDebug for speed up
- phpenv config-rm xdebug.ini || return 0
php:
- '7.4'
services:
- docker
cache:
directories:
- $HOME/.composer/cache
before_script:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
- sudo apt update
- sudo apt install docker-ce
- sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- sudo chmod +x /usr/local/bin/docker-compose
- docker-compose --version
- wget https://github.com/drud/ddev/releases/download/v1.13.1/ddev_linux.v1.13.1.tar.gz
- tar vxzf ddev_linux.v1.13.1.tar.gz
- sudo chmod +x ddev
- sudo chmod +x mkcert
- ./mkcert -install
jobs:
fast_finish: true
include:
-
stage: Tests
name: "Code ception"
script:
- composer install
- ./ddev --version
- ./ddev start
- php vendor/bin/codecept run
I had to install a never version of docker, manually to meet the requirements from ddev.
The result
Have fun.
Top comments (1)
Curious, do you have a "current" version?