mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-30 22:16:14 +00:00
The scripts now test that variables are set. The "deploy to packagist" build should return an error if not successful.
33 lines
1.5 KiB
YAML
33 lines
1.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
|
|
- 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
|
|
|
|
test:php-5.6:
|
|
stage: test
|
|
image: chill/ci-image:php-5.6
|
|
<<: *test_definition
|
|
script: phpunit
|
|
test:php-7:
|
|
image: chill/ci-image:php-7
|
|
stage: test
|
|
<<: *test_definition
|
|
script: 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\"}}")
|
|
- if [ $STATUSCODE = "202" ]; then exit 0; else exit $STATUSCODE; fi
|