summaryrefslogtreecommitdiffstats
path: root/.github/workflows/phpunit.yaml
blob: e5336a44143f68a30cae60fa46899c243a9cadd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Testing php7-mysql-shim
on: [push, pull_request]
jobs:
  lib:
    name: php7-mysql-shim (PHP ${{ matrix.php-versions }})
    runs-on: ubuntu-latest
    services:
      mysql:
        image: mysql:5.7
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: true
          MYSQL_DATABASE: testing
        ports:
          - 3306/tcp
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
    strategy:
      fail-fast: false
      matrix:
        php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup PHP, with composer and extensions
        uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
          coverage: xdebug #optional
      - name: Start mysql service
        run: sudo /etc/init.d/mysql start
      - name: Get composer cache directory
        id: composercache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"
      - name: Cache composer dependencies
        uses: actions/cache@v2
        with:
          path: ${{ steps.composercache.outputs.dir }}
          # Use composer.json for key, if composer.lock is not committed.
          # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-
      - name: Install Composer dependencies
        run: |
           composer update --prefer-lowest --no-interaction --prefer-source
      - name: Run Tests
        run: php bin/phpunit --coverage-text