First implementation of Gitlab CI

This commit is contained in:
Abel Hoogeveen 2016-05-25 13:46:13 +02:00
parent 93a6addfaf
commit dbf6d87c95
5 changed files with 97 additions and 37 deletions

76
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,76 @@
before_script:
# Install dependencies
- bash CI/docker_install.sh > /dev/null
stages:
- build
- test
- deploy
build:composer:
image: php:5.6
stage: build
script:
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
cache:
key: "$CI_BUILD_REF/$CI_BUILD_REF_NAME"
paths:
- vendor/
test:5.4:
image: php:5.4
script:
- vendor/bin/phpunit -c phpunit.xml --coverage-text
cache:
key: "$CI_BUILD_REF/$CI_BUILD_REF_NAME"
paths:
- vendor/
allow_failure: true
test:5.5:
image: php:5.5
script:
- vendor/bin/phpunit -c phpunit.xml --coverage-text
cache:
key: "$CI_BUILD_REF/$CI_BUILD_REF_NAME"
paths:
- vendor/
allow_failure: true
test:5.6:
stage: test
image: php:5.6
script:
- vendor/bin/phpunit -c phpunit.xml --coverage-text
cache:
key: "$CI_BUILD_REF/$CI_BUILD_REF_NAME"
paths:
- vendor/
test:7.0:
stage: test
image: php:7.0
script:
- vendor/bin/phpunit -c phpunit.xml --coverage-text
cache:
key: "$CI_BUILD_REF/$CI_BUILD_REF_NAME"
paths:
- vendor/
release:
stage: deploy
image: php:5.6
only:
- master
script:
- vendor/bin/phpunit -c phpunit.xml --coverage-text
- vendor/bin/apigen generate -s . -d 'build/phpdoc' --todo --title 'FuzeWorks Build' --exclude 'tests/*','build/*','vendor/*','CI/*'
artifacts:
name: "${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}"
paths:
- build/
cache:
key: "$CI_BUILD_REF/$CI_BUILD_REF_NAME"
paths:
- vendor/

14
CI/docker_install.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# We need to install dependencies only for Docker
[[ ! -e /.dockerenv ]] && [[ ! -e /.dockerinit ]] && exit 0
set -xe
# Install git (the php image doesn't have it) which is required by composer
apt-get update -yqq
apt-get install git zip unzip -yqq
# Install mysql driver
# Here you can install any other extension that you need
docker-php-ext-install pdo_mysql

View File

@ -1 +0,0 @@
1.0.0pre

View File

@ -1,36 +0,0 @@
<project name="FuzeWorks" default="build" basedir=".">
<target name="clean">
<delete dir="${basedir}/build" />
</target>
<target name="prepare">
<mkdir dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/clover" />
<mkdir dir="${basedir}/build/phpdoc" />
</target>
<target name="phpunit">
<exec dir="${basedir}" executable="php" failonerror="true">
<arg value="phpunit.phar"/>
<arg line="--configuration phpunit.xml
--log-junit build/logs/phpunit.xml
--coverage-clover build/logs/clover.xml
--coverage-html build/clover" />
</exec>
</target>
<target name="phpdoc">
<exec dir="${basedir}" executable="php" failonerror="yes">
<arg value="apigen.phar"/>
<arg line="generate --source . --destination 'build/phpdoc' --exclude 'tests/*','build/*','Core/System/Smarty/*','vendor/*' "/>
</exec>
</target>
<target name="zip">
<exec dir="${basedir}" executable="git" failonerror="true">
<arg line="archive -o ${basedir}/build/fuzeworks-core.zip HEAD" />
</exec>
</target>
<target name="build" depends="clean,prepare,phpunit,phpdoc,zip" />
</project>

View File

@ -22,4 +22,11 @@
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<log type="json" target="build/phpunit/logfile.json"/>
<log type="junit" target="build/phpunit/logfile.xml" logIncompleteSkipped="false"/>
<log type="testdox-html" target="build/phpunit/testdox.html"/>
<log type="testdox-text" target="build/phpunit/testdox.txt"/>
</logging>
</phpunit>