Skip to content

Fix unit test for php 7.4 #143

Fix unit test for php 7.4

Fix unit test for php 7.4 #143

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
build:
name: Build (PHP ${{ matrix.php }})
runs-on: ubuntu-20.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1']
flag: ['--prefer-lowest', '--prefer-stable']
steps:
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, xdebug
- name: Check out code
uses: actions/checkout@v2
- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer update --prefer-dist --no-interaction ${{ matrix.flag }} --no-progress --ansi # --prefer-source
- name: Run static analyze
run: vendor/bin/psalm --php-version=${{ matrix.php }}
- name: Build test server
run: docker build --tag test-server:local -f ./tests/test-server/Dockerfile ./tests/test-server
- name: Start test server
run: docker run --name test-server --rm -d -p "7079:7079/tcp" test-server:local
- name: Run tests
run: composer test-cover
- uses: codecov/codecov-action@v1 # Docs: <https://github.com/codecov/codecov-action>
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: php
fail_ci_if_error: false