.gitlab-ci.yml 5.78 KB
Newer Older
Alexander Wink's avatar
Alexander Wink committed
1
stages:
2 3
    - style
    - quality
4 5
    - test
    - package
6
    - validate
Alexander Wink's avatar
Alexander Wink committed
7 8

cache:
9
    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
Alexander Wink's avatar
Alexander Wink committed
10 11

variables:
12 13 14
    DOCKER_DRIVER: overlay2
    BASE_SW_VERSION: '6.2.0'
    COMPOSER_COMMAND: "/var/www/html/composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader"
Alexander Wink's avatar
Alexander Wink committed
15 16

codestyle:
17
    stage: style
18 19 20 21 22 23 24 25 26 27
    image: "dockware/play:${BASE_SW_VERSION}"
    needs: [ ]
    except:
        variables: [ $DISABLE_PHP_CS == "1" ]
    before_script:
        - curl https://getcomposer.org/download/1.10.19/composer.phar -o /var/www/html/composer
        - chmod +x /var/www/html/composer
        - if [ $SW_VERSION == '6.4.0.0' ]; then /var/www/html/composer self-update --2; else /var/www/html/composer global require hirak/prestissimo; fi
        - ${COMPOSER_COMMAND}
        - cp -r ${CI_PROJECT_DIR} /var/www/html/custom/plugins/${CI_PROJECT_NAME}
28
    script:
29
        - cd /var/www/html/custom/plugins/${CI_PROJECT_NAME} && vendor/bin/php-cs-fixer fix -v --dry-run
30 31 32 33
    cache:
        key: global
        paths:
            - .php_cs.cache
34
            - vendor
35 36

k10r-phpstan:
37
    stage: quality
38
    image: "dockware/play:${SW_VERSION}"
39 40
    parallel:
        matrix:
41 42 43 44 45 46 47 48 49 50 51
            -   PHP_VERSION: [ "7.2", "7.3", "7.4" ]
                SW_VERSION: [ "6.2.0", "6.3.0", "6.3.1.0", "6.3.2.0", "6.3.3.0", "6.3.4.0", "6.3.5.0", "6.4.0.0" ]
    needs: [ ]
    except:
        variables: [ $DISABLE_PHPSTAN_K10R == "1" ]
    before_script:
        - curl https://getcomposer.org/download/1.10.19/composer.phar -o /var/www/html/composer
        - chmod +x /var/www/html/composer
        - if [ $SW_VERSION == '6.4.0.0' ]; then /var/www/html/composer self-update --2; else /var/www/html/composer global require hirak/prestissimo; fi
        - ${COMPOSER_COMMAND}
        - cp -r ${CI_PROJECT_DIR} /var/www/html/custom/plugins/${CI_PROJECT_NAME}
52
    script:
53 54 55 56 57
        - cd /var/www/html/custom/plugins/${CI_PROJECT_NAME} && vendor/bin/phpstan analyse -c phpstan.neon src tests
    cache:
        key: global
        paths:
            - vendor
58 59

sw-phpstan:
60
    stage: quality
61
    image: "dockware/play:${SW_VERSION}"
62 63
    parallel:
        matrix:
64 65 66 67 68 69 70 71 72 73 74 75 76
            -   PHP_VERSION: [ "7.2", "7.3", "7.4" ]
                SW_VERSION: [ "6.2.0", "6.3.0", "6.3.1.0", "6.3.2.0", "6.3.3.0", "6.3.4.0", "6.3.5.0", "6.4.0.0" ]
    needs: [ ]
    except:
        variables: [ $DISABLE_PHPSTAN_SW == "1" ]
    before_script:
        - curl https://getcomposer.org/download/1.10.19/composer.phar -o /var/www/html/composer
        - chmod +x /var/www/html/composer
        - if [ $SW_VERSION == '6.4.0.0' ]; then /var/www/html/composer self-update --2; else if [ $SW_VERSION == '6.4.0.0' ]; then /var/www/html/composer self-update --2; else /var/www/html/composer global require hirak/prestissimo; fi; fi
        - ${COMPOSER_COMMAND}
        - cp -r ${CI_PROJECT_DIR} /var/www/html/custom/plugins/${CI_PROJECT_NAME}
        - cd /tmp && git clone https://github.com/shopwareLabs/store-plugin-codereview.git
        - cp -r /tmp/store-plugin-codereview/configs/phpstan/phpstan.neon.sw6 /var/www/html/custom/plugins/${CI_PROJECT_NAME}/phpstan_sw.neon
77
    script:
78 79 80 81 82
        - cd /var/www/html/custom/plugins/${CI_PROJECT_NAME} && vendor/bin/phpstan analyse -c phpstan_sw.neon -a vendor/autoload.php -a ../../../vendor/autoload.php src tests
    cache:
        key: global
        paths:
            - vendor
Alexander Wink's avatar
Alexander Wink committed
83 84

phpunit:
85
    stage: test
86
    image: "dockware/play:${SW_VERSION}"
87 88
    parallel:
        matrix:
89 90 91 92 93
            -   PHP_VERSION: [ "7.2", "7.3", "7.4" ]
                SW_VERSION: [ "6.2.0", "6.3.0", "6.3.1.0", "6.3.2.0", "6.3.3.0", "6.3.4.0", "6.3.5.0", "6.4.0.0" ]
    needs: [ ]
    except:
        variables: [ $DISABLE_PHPUNIT == "1" ]
94
    before_script:
95 96 97 98 99 100 101 102 103
        - curl https://getcomposer.org/download/1.10.19/composer.phar -o /var/www/html/composer
        - chmod +x /var/www/html/composer
        - if [ $SW_VERSION == '6.4.0.0' ]; then /var/www/html/composer self-update --2; else /var/www/html/composer global require hirak/prestissimo; fi
        - ${COMPOSER_COMMAND}
        - cp -r ${CI_PROJECT_DIR} /var/www/html/custom/plugins/${CI_PROJECT_NAME}
        - sudo rm -rf /var/run/mysqld/mysqld.sock.lock
        - sudo chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
        - sudo service mysql start
        - cd /var/www/html/ && rm -rf vendor && ${COMPOSER_COMMAND} --no-scripts
104
    script:
105
        - cd /var/www/html/ && php bin/console plugin:refresh -nq && php bin/console plugin:install --activate -c CrefoPay -nq
106 107
        - cd /var/www/html/ && /var/www/html/composer dump-autoload -d custom/plugins/${CI_PROJECT_NAME}
        - cd /var/www/html/ && php -d pcov.enabled=1 -d pcov.directory=/var/www/html/
108 109
            vendor/bin/phpunit
            --configuration custom/plugins/${CI_PROJECT_NAME}/phpunit.xml.dist
110 111
    cache:
        key: global
112
        paths:
113
            - vendor
Alexander Wink's avatar
Alexander Wink committed
114 115

package:
116 117 118
    image:
        name: ghcr.io/friendsofshopware/platform-plugin-dev:v6.3.1
        entrypoint: [""]
119 120 121 122
    stage: package
    only:
        - tags
        - master
Daniel Kazior's avatar
Daniel Kazior committed
123
        - develop
124
        - /^integration.*$/
125
        - /^fix.*$/
126 127
    except:
        variables: [ $DISABLE_PACKAGE == "1" ]
128
    script:
129 130 131 132 133
        - start-mysql
        - ln -s "$(pwd)" "/plugins/CrefoPay"
        - plugin-uploader ext:prepare "/plugins/CrefoPay"
        - rm -rf $( cat .sw-zip-blocklist ) && rm -rf .sw-zip-blocklist
        - pack-plugin CrefoPay
134 135
    artifacts:
        paths:
136
            - "*.zip"
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152

shopware-validate:
    image:
        name: friendsofshopware/plugin-uploader:0.3.5
        entrypoint: [ "/bin/sh", "-c" ]
    stage: validate
    needs:
        - package
    only:
        - tags
        - master
        - /^integration.*$/
        - /^fix.*$/
    except:
        variables: [ $DISABLE_VALIDATION == "1" ]
    script:
153
        - php /app/bin/pluginupload ext:validate CrefoPay.zip