diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..3198dc9 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,47 @@ +name: PHPStan + +on: + push: + branches: + - master + pull_request: + +jobs: + tests: + name: PHP ${{ matrix.php-versions }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: ['7.3', '7.4'] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up PHP ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring + tools: cs2pr, phpstan:0.12.9 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: PHPStan + run: phpstan analyse --error-format=checkstyle | cs2pr diff --git a/.github/workflows/runTests.yml b/.github/workflows/runTests.yml new file mode 100644 index 0000000..43b7db4 --- /dev/null +++ b/.github/workflows/runTests.yml @@ -0,0 +1,66 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + +jobs: + tests: + name: PHP ${{ matrix.php-versions }} on ${{ matrix.os }} w/ ${{ matrix.dependencies }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + php-versions: ['7.3', '7.4'] + os: [ubuntu-latest, windows-latest, macOS-latest] + dependencies: ['install', 'update --prefer-lowest', 'update'] + + steps: + - name: Configure git + if: runner.os == 'Windows' + run: git config --system core.autocrlf false; git config --system core.eol lf + + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up PHP ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring + coverage: xdebug + + - name: Setup Problem Matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Setup Problem Matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer ${{ matrix.dependencies }} --prefer-dist --no-progress --no-suggest + + - name: Run test suite + run: composer run-script test -- --coverage-text + + - name: Notify Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: | + composer require php-coveralls/php-coveralls + composer run-script php-coveralls -- --verbose diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2c159c4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: php - -php: - - 7.3 - - 7.4 - - 7.4snapshot - - nightly - -matrix: - fast_finish: true - allow_failures: - - php: nightly - - php: 7.4snapshot - -install: - - composer install - - curl -L https://github.com/phpstan/phpstan/releases/download/0.12.9/phpstan.phar -o phpstan - - chmod +x phpstan - -script: - - vendor/bin/phpunit --coverage-text - - ./phpstan analyse - -after_success: - - composer require php-coveralls/php-coveralls - - travis_retry vendor/bin/php-coveralls diff --git a/README.md b/README.md index b631ad1..5383042 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ Provides assertions for unit tests. Package status -------------- -[![Build Status](https://secure.travis-ci.org/bovigo/assert.png)](http://travis-ci.org/bovigo/assert) [![Build Status Windows](https://ci.appveyor.com/api/projects/status/t1u7ylbvdkbqqxyv?svg=true)](https://ci.appveyor.com/project/mikey179/assert) [![Coverage Status](https://coveralls.io/repos/github/bovigo/assert/badge.svg?branch=master)](https://coveralls.io/github/bovigo/assert?branch=master) + +![Build Status](https://github.com/bovigo/assert/workflows/Tests/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/bovigo/assert/badge.svg?branch=master)](https://coveralls.io/github/bovigo/assert?branch=master) [![Latest Stable Version](https://poser.pugx.org/bovigo/assert/version.png)](https://packagist.org/packages/bovigo/assert) [![Latest Unstable Version](https://poser.pugx.org/bovigo/assert/v/unstable.png)](//packagist.org/packages/bovigo/assert) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index d15d81c..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,28 +0,0 @@ -build: false -shallow_clone: true - -cache: - - .\php -> appveyor.yml - - vendor -> composer.lock - -init: - - set PATH=%PATH%;.\php - - set COMPOSER_NO_INTERACTION=1 - - set CACHED=0 - -install: - - if exist .\php (set CACHED=1) else (mkdir .\php) - - if %CACHED%==0 cd .\php - - if %CACHED%==0 curl --fail --location --silent --show-error -o php.zip https://windows.php.net/downloads/releases/archives/php-7.3.11-nts-Win32-VC15-x64.zip - - if %CACHED%==0 appveyor DownloadFile https://getcomposer.org/composer.phar - - if %CACHED%==0 7z x php.zip -y - - if %CACHED%==0 copy php.ini-production php.ini /Y - - if %CACHED%==0 echo date.timezone="Europe/Berlin" >> php.ini - - if %CACHED%==0 echo extension_dir=ext >> php.ini - - if %CACHED%==0 echo extension=php_openssl.dll >> php.ini - - if %CACHED%==0 echo extension=php_mbstring.dll >> php.ini - - if %CACHED%==0 cd .. - -test_script: - - php .\php\composer.phar install - - vendor/bin/phpunit.bat --coverage-text diff --git a/composer.json b/composer.json index 421d454..981b242 100644 --- a/composer.json +++ b/composer.json @@ -31,5 +31,9 @@ } }, "minimum-stability": "dev", - "prefer-stable": true + "prefer-stable": true, + "scripts": { + "test": "phpunit", + "php-coveralls": "php-coveralls" + } }