|
| 1 | +name: Build with MySQL |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - "master" |
| 8 | + |
| 9 | +jobs: |
| 10 | + Tests: |
| 11 | + name: PHP ${{ matrix.php }} + MySQL ${{ matrix.mysql }} |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + php: ['7.4', '8.0'] |
| 17 | + mysql: ['8.0'] |
| 18 | + services: |
| 19 | + mysql: |
| 20 | + image: mysql:${{ matrix.mysql }} |
| 21 | + env: |
| 22 | + MYSQL_ALLOW_EMPTY_PASSWORD: false |
| 23 | + MYSQL_ROOT_PASSWORD: password |
| 24 | + MYSQL_DATABASE: migration |
| 25 | + MYSQL_USER: migration |
| 26 | + MYSQL_PASSWORD: password |
| 27 | + ports: |
| 28 | + - 3306/tcp |
| 29 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v2 |
| 34 | + |
| 35 | + - name: Install PHP |
| 36 | + uses: shivammathur/setup-php@v2 |
| 37 | + with: |
| 38 | + php-version: ${{ matrix.php }} |
| 39 | + extensions: mbstring, intl, mysql |
| 40 | + coverage: none |
| 41 | + env: |
| 42 | + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + update: true |
| 44 | + |
| 45 | + - name: Start MySQL service |
| 46 | + run: sudo /etc/init.d/mysql start |
| 47 | + |
| 48 | + - name: Get composer cache directory |
| 49 | + id: composer-cache |
| 50 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 51 | + |
| 52 | + - name: Cache composer dependencies |
| 53 | + |
| 54 | + with: |
| 55 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 56 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 57 | + restore-keys: ${{ runner.os }}-composer- |
| 58 | + |
| 59 | + - name: Install dependencies |
| 60 | + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader |
| 61 | + |
| 62 | + - name: Prepare DB connections for tests |
| 63 | + run: printf "<?php\n\n\$config['mysql']['dsn']='mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=migration';\n" >> tests/config.local.php; |
| 64 | + |
| 65 | + - name: PHPUnit tests |
| 66 | + run: vendor/bin/phpunit --exclude-group pgsql,sqlite |
0 commit comments