diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..9980088 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,62 @@ +name: Coverage + +on: + push: + branches: [ '**' ] + pull_request: + branches: [ '**' ] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: ['7.4'] + setup: ['stable'] + + name: PHP + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}- + + - name: Code Climate Test Reporter Preparation + if: ${{ env.CC_TEST_REPORTER_ID != '' }} + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer update --prefer-dist --prefer-${{ matrix.setup }} --no-progress --no-interaction + + - name: Run test suite + run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml + + - name: Code Climate Test Reporter + if: ${{ env.CC_TEST_REPORTER_ID != '' }} + run: | + cp coverage.xml clover.xml + bash <(curl -s https://codecov.io/bash) + ./cc-test-reporter after-build --coverage-input-type clover --exit-code 0 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..1e732db --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,50 @@ +name: Tests + +on: + push: + branches: [ '**' ] + pull_request: + branches: [ '**' ] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] + setup: ['lowest', 'stable'] + + name: PHP ${{ matrix.php }} - ${{ matrix.setup }} + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}- + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: | + composer require --no-update nodejs-php-fallback/uglify:^1.0.2 --no-interaction + ${{ matrix.php >= 7.3 && 'composer require --no-update "pug-php/pug:^2.7.5||^3.0" --no-interaction;' || '' }} + ${{ matrix.php >= 7.4 && 'composer require --no-update "pug-php/pug:^2.7.6||^3.0" --no-interaction;' || '' }} + ${{ matrix.php >= 8 && 'composer require --no-update phpunit/phpunit:^8.5.15 --no-interaction;' || '' }} + ${{ matrix.php >= 8 && 'composer require --no-update natxet/cssmin:^3.0.5 --no-interaction;' || '' }} + composer update --prefer-dist --prefer-${{ matrix.setup }} --no-progress --no-interaction ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }} + + - name: Run test suite + run: vendor/bin/phpunit --no-coverage --verbose diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8ebe985..0000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: php -matrix: - include: - - php: 5.4 - dist: trusty - env: PUG_VERSION='^2.7' - - php: 5.5 - dist: trusty - env: PUG_VERSION='^2.7' - - php: 5.5 - dist: trusty - env: PUG_VERSION='^3.0' - - php: 5.6 - env: PUG_VERSION='^2.7' - - php: 5.6 - env: PUG_VERSION='^3.0' - - php: 7.0 - env: PUG_VERSION='^2.7' - - php: 7.0 - env: PUG_VERSION='^3.0' - - php: 7.1 - env: PUG_VERSION='^2.7' - - php: 7.1 - env: PUG_VERSION='^3.0' - - php: 7.2 - env: PUG_VERSION='^2.7' - - php: 7.2 - env: PUG_VERSION='^3.0' - - php: 7.3 - env: PUG_VERSION='^2.7' - - php: 7.3 - env: PUG_VERSION='^3.0' -before_script: - - travis_retry composer self-update - - if [ "$PUG_VERSION" != "" ]; then travis_retry composer require "pug-php/pug:${PUG_VERSION}" --no-update; fi; - - travis_retry composer update --no-interaction -script: - - vendor/bin/phpunit --verbose --coverage-text --coverage-clover=coverage.xml -after_script: - - vendor/bin/test-reporter --coverage-report coverage.xml -after_success: - - bash <(curl -s https://codecov.io/bash) -addons: - code_climate: - repo_token: ac4bd1ebd11decb5ca0a7fe325021aaa0bcec956151ec49ed08565613b6ba1a2 diff --git a/composer.json b/composer.json index 2a59b86..23fde3b 100644 --- a/composer.json +++ b/composer.json @@ -3,8 +3,9 @@ "description": "Pug template assets manager", "type": "library", "require": { - "pug-php/pug": "^2.0.0 || ^3.0.0", - "pug-php/pug-minify": "^1.0.1", + "php": ">=5.4", + "pug-php/pug": "^2.0.2 || ^3.0.0", + "pug-php/pug-minify": "^1.1", "pug-php/pug-filter-coffee-script": "^1.2", "pug-php/pug-filter-less": "^1.0", "pug-php/pug-filter-markdown": "^1.1", @@ -12,8 +13,7 @@ "pug-php/pug-filter-stylus": "^2.0" }, "require-dev": { - "phpunit/phpunit": ">=4.8 <6.0", - "codeclimate/php-test-reporter": "^0.4.0" + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^8.5.15" }, "license": "MIT", "authors": [ diff --git a/tests/Pug/AssetsTest.php b/tests/Pug/AssetsTest.php index e57083e..cb2064b 100644 --- a/tests/Pug/AssetsTest.php +++ b/tests/Pug/AssetsTest.php @@ -2,10 +2,11 @@ namespace Pug\Tests; +use PHPUnit\Framework\TestCase; use Pug\Assets; use Pug\Pug; -class AssetsTest extends \PHPUnit_Framework_TestCase +class AssetsTest extends TestCase { private static function cleanUp() {