mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-18 16:24:24 +00:00
adding CI to project
This commit is contained in:
parent
99c1d488e3
commit
6c1586e370
60
.gitlab-ci.yml
Normal file
60
.gitlab-ci.yml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
.test_definition: &test_definition
|
||||||
|
services:
|
||||||
|
- chill/database:latest
|
||||||
|
before_script:
|
||||||
|
- composer config github-oauth.github.com $GITHUB_TOKEN
|
||||||
|
- composer install
|
||||||
|
- cp Resources/test/Fixtures/App/config/parameters.gitlab-ci.yml Tests/Fixtures/App/config/parameters.yml
|
||||||
|
- php Resources/test/Fixtures/App/console --env=test cache:warmup
|
||||||
|
- php Resources/test/Fixtures/App/console doctrine:migrations:migrate --env=test --no-interaction
|
||||||
|
- php Resources/test/Fixtures/App/console doctrine:fixtures:load --env=test --no-interaction
|
||||||
|
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- build-doc
|
||||||
|
- deploy-doc
|
||||||
|
- test
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
test:php-5.6:
|
||||||
|
stage: test
|
||||||
|
<<: *test_definition
|
||||||
|
image: chill/ci-image:php-5.6
|
||||||
|
script: phpunit
|
||||||
|
|
||||||
|
test:php-7:
|
||||||
|
stage: test
|
||||||
|
<<: *test_definition
|
||||||
|
image: chill/ci-image:php-7
|
||||||
|
script: phpunit
|
||||||
|
|
||||||
|
# deploy documentation
|
||||||
|
api-doc-build:
|
||||||
|
stage: build-doc
|
||||||
|
environment: api-doc
|
||||||
|
image: chill/ci-image:php-7
|
||||||
|
before_script:
|
||||||
|
- mkdir api-doc
|
||||||
|
script: apigen generate --destination api-doc/$CI_PROJECT_NAME/$CI_BUILD_REF_NAME
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- "api-doc/"
|
||||||
|
name: api
|
||||||
|
expire_in: '2h'
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- tags
|
||||||
|
|
||||||
|
deploy-packagist:
|
||||||
|
stage: deploy
|
||||||
|
image: chill/ci-image:php-7
|
||||||
|
before_script:
|
||||||
|
# test that PACKAGIST USERNAME and PACKAGIST_TOKEN variable are set
|
||||||
|
- if [ -z ${PACKAGIST_USERNAME+x} ]; then echo "Please set PACKAGIST_USERNAME variable"; exit -1; fi
|
||||||
|
- if [ -z ${PACKAGIST_TOKEN+x} ]; then echo "Please set PACKAGIST_TOKEN variable"; exit -1; fi
|
||||||
|
script:
|
||||||
|
- STATUSCODE=$(curl -XPOST -H'content-type:application/json' "https://packagist.org/api/update-package?username=$PACKAGIST_USERNAME&apiToken=$PACKAGIST_TOKEN" -d"{\"repository\":{\"url\":\"$CI_PROJECT_URL.git\"}}" --silent --output /dev/stderr --write-out "%{http_code}")
|
||||||
|
- if [ $STATUSCODE = "202" ]; then exit 0; else exit $STATUSCODE; fi
|
Loading…
x
Reference in New Issue
Block a user