|
| 1 | +# |
| 2 | +# Github actions for swoft component tests |
| 3 | +# https://github.com/marketplace?type=actions |
| 4 | +# |
| 5 | +name: Unit-tests |
| 6 | + |
| 7 | +on: [push, pull_request] |
| 8 | + |
| 9 | +# usage refer https://github.com/shivammathur/setup-php |
| 10 | +jobs: |
| 11 | + test: |
| 12 | + name: Test on php ${{ matrix.php}} and ${{ matrix.os }} OS |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + timeout-minutes: 20 |
| 15 | + env: |
| 16 | + SWOFT_DEBUG: 0 |
| 17 | + strategy: |
| 18 | + fail-fast: true # fast fail |
| 19 | + matrix: |
| 20 | + php: [7.2, 7.3, 7.4, 8.0] |
| 21 | + os: [ubuntu-latest] # , macOS-latest, windows-latest |
| 22 | + swoole-versions: [''] # latest |
| 23 | + include: |
| 24 | + - os: 'ubuntu-latest' |
| 25 | + php: '7.1' |
| 26 | + swoole-versions: '-4.5.24' |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + # usage refer https://github.com/shivammathur/setup-php |
| 31 | + - name: Setup PHP |
| 32 | + timeout-minutes: 5 |
| 33 | + uses: shivammathur/setup-php@v2 |
| 34 | + with: |
| 35 | + php-version: ${{ matrix.php}} |
| 36 | + extensions: mbstring, dom, fileinfo, mysql, openssl, redis, swoole${{ matrix.swoole-versions }} #optional, setup extensions |
| 37 | + ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration |
| 38 | + coverage: none #optional, setup coverage driver: xdebug, none |
| 39 | + |
| 40 | + - name: Display swoole extensions |
| 41 | + timeout-minutes: 1 |
| 42 | + run: php --ri swoole |
| 43 | + # sudo pecl install -f swoole |
| 44 | + # echo 'no' | pecl install -f redis |
| 45 | + # sudo pecl update-channels && pecl install -f msgpack && pecl install -f igbinary && php -m |
| 46 | + |
| 47 | + - name: Install dependencies |
| 48 | + run: composer install --no-progress --no-suggest |
| 49 | + |
| 50 | + # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" |
| 51 | + # Docs: https://getcomposer.org/doc/articles/scripts.md |
| 52 | + |
| 53 | + - name: Run test suite |
| 54 | + run: composer run test |
0 commit comments