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.43 KB
Newer Older
1
.test_definition: &test_definition
Julien Fastré's avatar
Julien Fastré committed
2 3 4 5 6
    services:
       - chill/database:latest
     
    before_script:
       - composer config github-oauth.github.com $GITHUB_TOKEN
7
       - php -d memory_limit=-1 /usr/local/bin/composer install --no-interaction
8 9 10
       - cp  Resources/test/Fixtures/App/app/config/parameters.gitlab-ci.yml Resources/test/Fixtures/App/app/config/parameters.yml
       - 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
Julien Fastré's avatar
Julien Fastré committed
11

12 13
stages:
    - deploy
14
    - test
15 16 17
    - build-doc
    - deploy-doc

18
test:php-7.2:
Julien Fastré's avatar
Julien Fastré committed
19
    stage: test
20
    image: chill/ci-image:php-7.2
Julien Fastré's avatar
Julien Fastré committed
21
    <<: *test_definition
22
    script: php vendor/bin/phpunit
23

24 25
deploy-packagist:    
    stage: deploy    
26
    image: chill/ci-image:php-7.2
27 28 29 30 31 32 33
    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
34 35 36 37 38
        
# deploy documentation
api-doc-build:
   stage: build-doc
   environment: api-doc
39
   image: chill/ci-image:php-7.2
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
   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