diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..5c2a9568 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,67 @@ +name: build + +on: + push: + pull_request_target: + pull_request: + +jobs: + php-cs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + name: Checkout repository + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + + - uses: ramsey/composer-install@v1 + with: + dependency-versions: 'highest' + + - name: Static Code Analysis + run: composer lint + + test: + runs-on: ${{ matrix.operating-system }} + needs: + - php-cs + strategy: + fail-fast: true + matrix: + operating-system: [ ubuntu-latest ] + php: [ '7.2', '7.3', '7.4', '8.0' ] + dependencies: [ 'lowest', 'highest' ] + + name: PHP ${{ matrix.php }} on ${{ matrix.operating-system }} with ${{ matrix.dependencies }} dependencies + + steps: + - uses: actions/checkout@v2 + name: Checkout repository + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.composer/cache/files + key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: pcov + + - name: Composer install + uses: ramsey/composer-install@v1 + with: + dependency-versions: ${{ matrix.dependencies }} + composer-options: ${{ matrix.composer-options }} + + - name: PHPUnit Tests + uses: php-actions/phpunit@v1 + with: + bootstrap: vendor/autoload.php + configuration: phpunit.xml.dist + args: --coverage-text \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index 9cf1b05d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -sudo: false -language: php - -cache: - directories: - - $HOME/.composer/cache - -php: - - 7.2 - - 7.3 - - 7.4 - - nightly - -matrix: - include: - - php: 7.4 - env: CS=yes - -before_script: - - if [[ $TRAVIS_PHP_VERSION > 7.4 ]] ; then sed -i '/friendsofphp\/php-cs-fixer/d' composer.json; fi; - - composer self-update - - composer install --prefer-dist --no-interaction - -script: - - ./bin/phpunit - - if [ $CS = 'yes' ]; then composer run-script lint; fi diff --git a/README.md b/README.md index d25c1faa..2d7c6686 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://img.shields.io/travis/zircote/swagger-php/master.svg?style=flat-square)](https://travis-ci.org/zircote/swagger-php) +[![Build Status](https://img.shields.io/github/workflow/status/zircote/swagger-php/build?style=flat-square)](https://github.com/zircote/swagger-php/actions?query=workflow:build) [![Total Downloads](https://img.shields.io/packagist/dt/zircote/swagger-php.svg?style=flat-square)](https://packagist.org/packages/zircote/swagger-php) [![License](https://img.shields.io/badge/license-Apache2.0-blue.svg?style=flat-square)](LICENSE-2.0.txt) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4c91386f..0202aee6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,16 @@ - - - tests/ - + + + + + src + + + + + tests + +