Skip to content

Commit

Permalink
CI - migrate running tests from travis to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenekdrahos committed Feb 2, 2021
1 parent ccd26ef commit 012a5ce
Showing 1 changed file with 57 additions and 38 deletions.
95 changes: 57 additions & 38 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,75 @@ on:
- master

jobs:
build:
phpqa:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [7.0, 7.1, 7.2]
stability: [prefer-stable]

steps:
- uses: actions/checkout@v2
- name: Debug
run: pwd && ls -lAh

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: xsl
coverage: none
# TODO: ? https://github.com/EdgedesignCZ/phpqa/runs/1813676801?check_suite_focus=true#step:6:28 ?
tools: composer:v1

# TODO: better cache? suggested installs probably won't be cached
- name: Cache vendor
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: |
composer install --no-interaction --no-progress
- name: Install suggested tools
env:
CI_PHP_VERSION: ${{ matrix.php }}
run: |
if [[ ${CI_PHP_VERSION:0:3} == "7.1" ]]; then
# 1) delete sebastian dependency hell
composer remove phpunit/phpunit --dev --no-interaction && composer remove sebastian/phpcpd --no-interaction;
# 2) update tools
composer update;
# 3) reinstall sebastian...
composer require phpunit/phpunit:~7.0 --dev && composer require sebastian/phpcpd;
# 4) install suggested tools
bin/suggested-tools.sh install;
fi
# test installing suggested tools like docker image
if [[ ${CI_PHP_VERSION:0:3} == "7.2" ]]; then
bin/suggested-tools.sh install --prefer-dist;
fi
- name: Run tests
run: |
vendor/phpunit/phpunit/phpunit
./phpqa tools
bin/ci.sh
ls -lAh build
# DEPRECATED TRAVIS
#sudo: required
#dist: trusty
#language: php
#services:
# - docker
#matrix:
# include:
# - php: 5.4
# - php: 5.5
# - php: 5.6
# - php: 7.0
# - php: 7.1
# - php: 7.2
# - php: 7.3
# - php: 7.4
#install:
# - if [ -n "$GITHUB_OAUTH_TOKEN" ]; then composer config -g github-oauth.github.com ${GITHUB_OAUTH_TOKEN}; fi;
# - composer install --no-interaction
# - |
# # test latest tool versions (needs symfony3 components)
# if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.1" ]]; then
# # 1) delete sebastian dependency hell
# composer remove phpunit/phpunit --dev --no-interaction && composer remove sebastian/phpcpd --no-interaction;
# # 2) update tools
# composer update;
# # 3) reinstall sebastian...
# composer require phpunit/phpunit:~7.0 --dev && composer require sebastian/phpcpd;
# # 4) install suggested tools
# bin/suggested-tools.sh install;
# # 5) hotfix CI issues - see commit 48dd427
# composer require sensiolabs/security-checker:~5;
# fi
# # test installing suggested tools like docker image
# if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.2" ]]; then
# bin/suggested-tools.sh install --prefer-dist;
# fi
#script:
# - vendor/phpunit/phpunit/phpunit
# - ./phpqa tools
# - bin/ci.sh
# - ls -lAh build
#deploy:
# - provider: script
# script: .docker/build-image
Expand All @@ -66,6 +86,5 @@ jobs:
## http://blog.wyrihaximus.net/2015/07/composer-cache-on-travis/
#cache:
# directories:
# - vendor
# - $HOME/.composer/cache
#

0 comments on commit 012a5ce

Please sign in to comment.