Si vous constatez la perte de tickets, de commentaires ou de projets, veuillez consulter la page https://status.framasoft.org/incident/626.

.gitlab-ci.yml 2.7 KB
Newer Older
1 2 3 4 5
.test_definition: &test_definition
    services:
       - chill/database:latest
     
    before_script:
6
       - echo "PHP version is $(php --version)"
7 8
       - composer config github-oauth.github.com $GITHUB_TOKEN
       - if [ $CI_BUILD_REF_NAME = "1.0" ] ; then export COMPOSER_ROOT_VERSION="1.0-dev"; else export COMPOSER_ROOT_VERSION="dev-master"; fi
9
       - php -d memory_limit=-1 /usr/local/bin/composer install --no-interaction 
Julien Fastré's avatar
Julien Fastré committed
10
       - cp  Resources/test/Fixtures/App/app/config/parameters.gitlab-ci.yml Resources/test/Fixtures/App/app/config/parameters.yml
Julien Fastré's avatar
Julien Fastré committed
11 12 13
       - php Resources/test/Fixtures/App/app/console --env=test cache:warmup
       - php Resources/test/Fixtures/App/app/console doctrine:migrations:migrate --env=test --no-interaction
       - php Resources/test/Fixtures/App/app/console doctrine:fixtures:load --env=test --no-interaction
14 15 16
       
stages:
   - deploy
17
   - test
18 19
   - build-doc
   - deploy-doc
20
   
21
test:php-7.2:
Julien Fastré's avatar
Julien Fastré committed
22
   stage: test
23
   image: chill/ci-image:php-7.2
Julien Fastré's avatar
Julien Fastré committed
24 25 26
   <<: *test_definition
   script: vendor/bin/phpunit

27 28
deploy-packagist:    
    stage: deploy    
29
    image: chill/ci-image:php-7.2   
30 31 32 33 34 35 36
    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
37 38 39 40 41
        
# deploy documentation
api-doc-build:
   stage: build-doc
   environment: api-doc
42
   image: chill/ci-image:php-7.2
43 44
   before_script:
      - mkdir api-doc
45
   script: apigen generate --destination api-doc/$CI_BUILD_REF_NAME/$CI_PROJECT_NAME
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
   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