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.46 KB
Newer Older
Julien Fastré's avatar
Julien Fastré committed
1 2 3 4 5 6
.test_definition: &test_definition
    services:
        - chill/database:latest
    before_script:
        - composer config github-oauth.github.com $GITHUB_TOKEN
        - composer install
Julien Fastré's avatar
Julien Fastré committed
7 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 --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
Julien Fastré's avatar
Julien Fastré committed
11
    
Julien Fastré's avatar
Julien Fastré committed
12

13
stages:
Julien Fastré's avatar
Julien Fastré committed
14
   - deploy
Julien Fastré's avatar
Julien Fastré committed
15
   - test
16 17
   - build-doc
   - deploy-doc
Julien Fastré's avatar
Julien Fastré committed
18
 
19
test:php-7.2:
Julien Fastré's avatar
Julien Fastré committed
20 21
    stage: test
    <<: *test_definition
22
    image: chill/ci-image:php-7.2
Julien Fastré's avatar
Julien Fastré committed
23
    script: APP_ENV=test vendor/bin/phpunit
Julien Fastré's avatar
Julien Fastré committed
24 25 26

# deploy documentation
api-doc-build:
27
   stage: build-doc
Julien Fastré's avatar
Julien Fastré committed
28
   environment: api-doc
29
   image: chill/ci-image:php-7.2
30
   before_script:
Julien Fastré's avatar
Julien Fastré committed
31
      - mkdir api-doc
32
   script: apigen generate --destination api-doc/$CI_BUILD_REF_NAME/$CI_PROJECT_NAME
Julien Fastré's avatar
Julien Fastré committed
33 34
   artifacts:
      paths:
Julien Fastré's avatar
Julien Fastré committed
35
         - "api-doc/"
Julien Fastré's avatar
Julien Fastré committed
36 37 38 39 40
      name: api
      expire_in: '2h'
   only:
      - master
      - tags
41 42 43 44 45 46

api-doc-deploy:
   stage: deploy-doc
   image: pallet/swiftclient:latest
   before_script:
        # test that CONTAINER_API variable is set        
47 48 49
        - 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
Julien Fastré's avatar
Julien Fastré committed
50
        # upload, and keep files during 1 year
51
   script: "swift upload --header \"X-Delete-After: 31536000\"  $CONTAINER_API $CI_BUILD_REF_NAME/$CI_PROJECT_NAME"
52 53 54
   only:
      - master
      - tags
Julien Fastré's avatar
Julien Fastré committed
55 56 57
      
deploy-packagist:    
    stage: deploy    
58
    image: chill/ci-image:php-7.2    
Julien Fastré's avatar
Julien Fastré committed
59 60 61 62 63 64 65
    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