.gitlab-ci.yml 1.71 KB
Newer Older
1 2 3 4 5 6
.test_definition: &test_definition
    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
Julien Fastré's avatar
Julien Fastré committed
8 9 10 11
        - 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
12

Julien Fastré's avatar
Julien Fastré committed
13 14 15 16 17
stages:
    - test
    - build-doc
    - deploy-doc

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

Julien Fastré's avatar
Julien Fastré committed
24 25 26 27
# deploy documentation
api-doc-build:
   stage: build-doc
   environment: api-doc
28
   image: chill/ci-image:php-7.2
Julien Fastré's avatar
Julien Fastré committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
   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