Projekt

Obecné

Profil

Stáhnout (1.48 KB) Statistiky
| Větev: | Revize:
1
# variables:
2
#     IMAGE_NAME: zcu-campus-life-app:$CI_COMMIT_REF_NAME
3

    
4
stages:
5
    - linter
6
    - build
7
    - test
8
    - deploy
9
    
10
php_linter: 
11
    stage: linter
12
    tags:
13
        - linter
14
    script:
15
        - ./scripts/composer.sh require --dev squizlabs/php_codesniffer
16
        - cd website
17
        - docker-compose exec php-fpm ./vendor/bin/php-cs-fixer fix /var/www/symfony/src --dry-run --config /var/www/symfony/.php_cs --stop-on-violation --using-cache=no
18

    
19
build:
20
    stage: build
21
    tags:
22
        - build
23
    script:
24
        # Test whether container can be build or not
25
        - ./scripts/build.sh
26
        - docker-compose stop crawler nginx
27
        # We could also push docker image to some registry or docker hub
28

    
29
tests:
30
    stage: test
31
    tags:
32
        - test
33
    script:
34
        - cd website
35
        - composer require --dev symfony/phpunit-bridge
36
        - composer require --dev symfony/browser-kit symfony/css-selector 
37
        - docker-compose exec -T php-fpm /bin/sh -c "export APP_ENV=test && cd ../symfony && php bin/phpunit"
38
        - docker stop $(docker ps -q)
39
        
40
deploy_prod:
41
    stage: deploy
42
    tags:
43
        - deploy
44
    variables:
45
        GIT_STRATEGY: none
46
    environment:
47
        name: heatmap
48
        url: https://heatmap.zcu.cz
49
    script:
50
        - ssh root@heatmap.zcu.cz "cd ~ && rm -rf aswi2020sebela && git clone https://gitlab.kiv.zcu.cz/aswi/aswi-2020/aswi2020sebela.git && cd aswi2020sebela && ./scripts/build.sh && exit"
51
    only:
52
        - master
53
    when: manual
(2-2/6)