|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: ~ |
| 5 | + release: |
| 6 | + types: [created] |
| 7 | + schedule: |
| 8 | + - |
| 9 | + cron: "0 1 * * 6" # Run at 1am every Saturday |
| 10 | + |
| 11 | +jobs: |
| 12 | + tests: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + name: "PHP ${{ matrix.php }}, MySQL ${{ matrix.mysql }}" |
| 16 | + |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + php: [7.4, 7.3] |
| 21 | + node: [10.x] |
| 22 | + mysql: [5.7, 8.0] |
| 23 | + |
| 24 | + exclude: |
| 25 | + - # PHP 7.3 does not support "caching_sha2_password" authentication plugin which is a default one in MySQL 8.0 |
| 26 | + php: 7.3 |
| 27 | + mysql: 8.0 |
| 28 | + |
| 29 | + env: |
| 30 | + APP_ENV: test |
| 31 | + DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" |
| 32 | + |
| 33 | + steps: |
| 34 | + - |
| 35 | + uses: actions/checkout@v2 |
| 36 | + |
| 37 | + - |
| 38 | + name: Setup PHP |
| 39 | + uses: shivammathur/setup-php@v2 |
| 40 | + with: |
| 41 | + php-version: "${{ matrix.php }}" |
| 42 | + ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=1, opcache.memory_consumption=256, opcache.max_accelerated_files=32531, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 |
| 43 | + extensions: intl, gd, opcache, mysql, pdo_mysql, :xdebug |
| 44 | + tools: symfony |
| 45 | + coverage: none |
| 46 | + |
| 47 | + - |
| 48 | + name: Setup Node |
| 49 | + uses: actions/setup-node@v1 |
| 50 | + with: |
| 51 | + node-version: "${{ matrix.node }}" |
| 52 | + |
| 53 | + - |
| 54 | + name: Shutdown default MySQL |
| 55 | + run: sudo service mysql stop |
| 56 | + |
| 57 | + - |
| 58 | + name: Setup MySQL |
| 59 | + uses: mirromutth/mysql-action@v1.1 |
| 60 | + with: |
| 61 | + mysql version: "${{ matrix.mysql }}" |
| 62 | + mysql root password: "root" |
| 63 | + |
| 64 | + - |
| 65 | + name: Output PHP version for Symfony CLI |
| 66 | + run: php -v | head -n 1 | awk '{ print $2 }' > .php-version |
| 67 | + |
| 68 | + - |
| 69 | + name: Install certificates |
| 70 | + run: symfony server:ca:install |
| 71 | + |
| 72 | + - |
| 73 | + name: Run Chrome Headless |
| 74 | + run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --disable-web-security --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & |
| 75 | + |
| 76 | + - |
| 77 | + name: Run webserver |
| 78 | + run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) |
| 79 | + |
| 80 | + - |
| 81 | + name: Get Composer cache directory |
| 82 | + id: composer-cache |
| 83 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 84 | + |
| 85 | + - |
| 86 | + name: Cache Composer |
| 87 | + uses: actions/cache@v2 |
| 88 | + with: |
| 89 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 90 | + key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} |
| 91 | + restore-keys: | |
| 92 | + ${{ runner.os }}-php-${{ matrix.php }}-composer- |
| 93 | + - |
| 94 | + name: Install PHP dependencies |
| 95 | + run: composer install --no-interaction |
| 96 | + |
| 97 | + - |
| 98 | + name: Get Yarn cache directory |
| 99 | + id: yarn-cache |
| 100 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 101 | + |
| 102 | + - |
| 103 | + name: Cache Yarn |
| 104 | + uses: actions/cache@v2 |
| 105 | + with: |
| 106 | + path: ${{ steps.yarn-cache.outputs.dir }} |
| 107 | + key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} |
| 108 | + restore-keys: | |
| 109 | + ${{ runner.os }}-node-${{ matrix.node }}-yarn- |
| 110 | + - |
| 111 | + name: Install JS dependencies |
| 112 | + run: (cd tests/Application && yarn install) |
| 113 | + |
| 114 | + - |
| 115 | + name: Prepare test application database |
| 116 | + run: | |
| 117 | + (cd tests/Application && bin/console doctrine:database:create -vvv) |
| 118 | + (cd tests/Application && bin/console doctrine:schema:create -vvv) |
| 119 | +
|
| 120 | + - |
| 121 | + name: Prepare test application assets |
| 122 | + run: | |
| 123 | + (cd tests/Application && bin/console assets:install public -vvv) |
| 124 | + (cd tests/Application && yarn build) |
| 125 | + - |
| 126 | + name: Prepare test application cache |
| 127 | + run: (cd tests/Application && bin/console cache:warmup -vvv) |
| 128 | + |
| 129 | + - |
| 130 | + name: Load fixtures in test application |
| 131 | + run: (cd tests/Application && bin/console sylius:fixtures:load -n) |
| 132 | + |
| 133 | + - |
| 134 | + name: Validate composer.json |
| 135 | + run: composer validate --ansi --strict |
| 136 | + |
| 137 | + - |
| 138 | + name: Validate database schema |
| 139 | + run: (cd tests/Application && bin/console doctrine:schema:validate) |
| 140 | + |
| 141 | + - |
| 142 | + name: Run PHPSpec |
| 143 | + run: vendor/bin/phpspec run --ansi -f progress --no-interaction |
| 144 | + |
| 145 | + - |
| 146 | + name: Run PHPUnit |
| 147 | + run: vendor/bin/phpunit --colors=always |
| 148 | + |
| 149 | + - |
| 150 | + name: Run Behat |
| 151 | + run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun |
| 152 | + |
| 153 | + - |
| 154 | + name: Upload Behat logs |
| 155 | + uses: actions/upload-artifact@v2 |
| 156 | + if: failure() |
| 157 | + with: |
| 158 | + name: Behat logs |
| 159 | + path: etc/build/ |
| 160 | + if-no-files-found: ignore |
0 commit comments