Projekt

Obecné

Profil

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

    
4
stages:
5
    - build
6
    - linter
7
    - test
8
    - deploy
9
    
10
build:
11
    stage: build
12
    tags:
13
        - build
14
    script:
15
        # Test whether container can be build or not
16
        - ./scripts/build.sh
17
        - docker-compose stop crawler nginx
18
        # We could also push docker image to some registry or docker hub
19

    
20
php_linter: 
21
    stage: linter
22
    tags:
23
        - linter
24
    script:
25
        - ./scripts/composer.sh require --dev squizlabs/php_codesniffer
26
        - cd website
27
        - docker-compose exec -T php-fpm /bin/sh -c "/var/www/symfony/vendor/bin/php-cs-fixer fix /var/www/symfony/src --dry-run --config /var/www/symfony/.php_cs --stop-on-violation --using-cache=no"
28

    
29

    
30
tests:
31
    stage: test
32
    tags:
33
        - test
34
    script:
35
        - cd website
36
        - composer require --dev symfony/phpunit-bridge
37
        - composer require --dev symfony/browser-kit symfony/css-selector 
38
        - docker-compose exec -T php-fpm /bin/sh -c "export APP_ENV=test && cd ../symfony && php bin/phpunit"
39
        - docker stop $(docker ps -q)
40
        
41
deploy_prod:
42
    stage: deploy
43
    tags:
44
        - deploy
45
    variables:
46
        GIT_STRATEGY: none
47
    environment:
48
        name: heatmap
49
        url: https://heatmap.zcu.cz
50
    script:
51
        - 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"
52
    only:
53
        - master
54
    when: manual
(2-2/6)