Skip to content

CI - Setup lorem.space backend API for test #10

CI - Setup lorem.space backend API for test

CI - Setup lorem.space backend API for test #10

Workflow file for this run

name: "CI"
on:
push:
branches:
- '**'
pull_request:
branches:
- 'master'
schedule:
- cron: '6 4 * * FRI'
env:
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader"
jobs:
tests:
name: "Run tests"
runs-on: "ubuntu-20.04"
env:
LOREM_SPACE_SELF_OWNED_URL: http://localhost:5000/image/
strategy:
matrix:
include:
- php-version: 7.2
xdebug: "xdebug2"
prefer-lowest: "--prefer-lowest"
- php-version: 7.2
xdebug: "xdebug2"
prefer-lowest: ""
- php-version: 7.3
xdebug: "xdebug"
prefer-lowest: "--prefer-lowest"
- php-version: 7.3
xdebug: "xdebug"
prefer-lowest: ""
- php-version: 7.4
xdebug: "xdebug"
prefer-lowest: "--prefer-lowest"
- php-version: 7.4
xdebug: "xdebug"
prefer-lowest: ""
- php-version: 8.0
xdebug: "xdebug"
prefer-lowest: "--prefer-lowest"
- php-version: 8.0
xdebug: "xdebug"
prefer-lowest: ""
# for php 8.1+ we skip prefer-lowest test due to too old version of phpunit (8.5.12)
# PHP Fatal error: Cannot acquire reference to $GLOBALS in
# /home/runner/work/faker-images/faker-images/vendor/phpunit/phpunit/src/Util/Configuration.php on line 407
- php-version: 8.1
xdebug: "xdebug"
prefer-lowest: ""
- php-version: 8.2
xdebug: "xdebug"
prefer-lowest: ""
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "${{ matrix.xdebug }}"
tools: composer
- name: "Print php and composer version"
run: |
php --version
composer --version
- name: "composer install"
run: |
echo DEFAULT_COMPOSER_FLAGS $DEFAULT_COMPOSER_FLAGS
echo PREFER_LOWEST ${{ matrix.prefer-lowest }}
composer update $DEFAULT_COMPOSER_FLAGS ${{ matrix.prefer-lowest }}
- name: "Run phpcs"
run: composer run phpcs
- name: "Run phpunit"
run: |
echo Setup lorem.space backend API
mkdir -p images/mycategory
wget --no-verbose https://github.com/manasky/lorem-server/releases/download/v1.0.12/lorem-server-v1.0.12-linux-amd64.tar.gz
tar xzvf lorem-server-v1.0.12-linux-amd64.tar.gz
wget --no-verbose -Oimages/mycategory/photo.jpg https://picsum.photos/200/300
./lorem-server --host 127.0.0.1:5000 --dir ./images &
echo End setup for lorem.space API
echo Xdebug env - ${{ matrix.xdebug }}
if [[ "${{ matrix.xdebug }}" == "xdebug2" ]]; then vendor/bin/phpunit --verbose --coverage-clover=coverage.xml; fi
if [[ "${{ matrix.xdebug }}" == "xdebug" ]]; then php -dxdebug.mode=coverage vendor/bin/phpunit --verbose --coverage-clover=coverage.xml; fi
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
verbose: true