mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-19 08:44:24 +00:00
71 lines
2.5 KiB
YAML
71 lines
2.5 KiB
YAML
.test_definition: &test_definition
|
|
services:
|
|
- chill/database:latest
|
|
before_script:
|
|
- if [ -z ${GITHUB_TOKEN+x} ]; then composer config github-oauth.github.com $GITHUB_TOKEN; fi
|
|
- php -d memory_limit=-1 /usr/local/bin/composer install --no-interaction
|
|
- cp Tests/Fixtures/App/app/config/parameters.gitlab-ci.yml Tests/Fixtures/App/app/config/parameters.yml
|
|
- php Tests/Fixtures/App/app/console.php --env=test cache:warmup
|
|
- php Tests/Fixtures/App/app/console.php doctrine:migrations:migrate --env=test --no-interaction
|
|
- php Tests/Fixtures/App/app/console.php doctrine:fixtures:load --env=test --no-interaction
|
|
|
|
stages:
|
|
- test
|
|
- deploy
|
|
- build-doc
|
|
- deploy-doc
|
|
|
|
test:php-7:
|
|
image: chill/ci-image:php-7
|
|
stage: test
|
|
<<: *test_definition
|
|
script: php vendor/bin/phpunit
|
|
|
|
test:php-7.1:
|
|
image: chill/ci-image:php-7.1
|
|
stage: test
|
|
<<: *test_definition
|
|
script: php vendor/bin/phpunit
|
|
|
|
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
|
|
|
|
# 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_BUILD_REF_NAME/$CI_PROJECT_NAME
|
|
artifacts:
|
|
paths:
|
|
- "api-doc/"
|
|
name: api
|
|
expire_in: '2h'
|
|
only:
|
|
- master
|
|
- tags
|
|
|
|
api-doc-deploy:
|
|
stage: deploy-doc
|
|
image: pallet/swiftclient:latest
|
|
before_script:
|
|
# test that CONTAINER_API variable is set
|
|
- if [ -z ${CONTAINER_API+x} ]; then echo "Please set CONTAINER_API variable"; exit -1; fi
|
|
# go to api-doc to have and url with PROJECT/BUILD
|
|
- cd api-doc
|
|
# upload, and keep files during 1 year
|
|
script: "swift upload --header \"X-Delete-After: 31536000\" $CONTAINER_API $CI_BUILD_REF_NAME/$CI_PROJECT_NAME"
|
|
only:
|
|
- master
|
|
- tags
|