diff --git a/.github/workflows/code-sniffer.yml b/.github/workflows/code-sniffer.yml new file mode 100644 index 0000000..c5453d5 --- /dev/null +++ b/.github/workflows/code-sniffer.yml @@ -0,0 +1,33 @@ +name: "CodeSniffer" + +on: + pull_request: + push: + branches: + - "master" + +jobs: + codesniffer: + name: "CodeSniffer" + + runs-on: "ubuntu-latest" + + strategy: + matrix: + php-version: + - "7.4" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + ini-values: memory_limit=-1 + + - name: "Install dependencies" + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Code Sniffer" + run: "vendor/bin/phpcs --standard=PSR2 ./src ./tests/AssetManagerTest" diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 0000000..accc19e --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,70 @@ +name: "PHPUnit tests" + +on: + pull_request: + push: + branches: + - "master" + +jobs: + phpunit: + name: "PHPUnit tests" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + dependencies: + - "lowest" + - "highest" + php-version: + - "7.3" + - "7.4" + - "8.0" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "pcov" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + + - name: Get Composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-${{ matrix.dependencies }} + restore-keys: | + composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}- + composer-${{ runner.os }}-${{ matrix.php-version }}- + composer-${{ runner.os }}- + composer- + - name: "Install lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' && matrix.php-version != '8.0' }} + run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" + + - name: "Install highest dependencies" + if: ${{ matrix.dependencies == 'highest' && matrix.php-version != '8.0' }} + run: "composer update --no-interaction --no-progress --no-suggest" + + - name: "Install lowest dependencies (ignore-platform-reqs)" + if: ${{ matrix.dependencies == 'lowest' && matrix.php-version == '8.0' }} + run: "composer update --ignore-platform-reqs --no-interaction --no-progress --no-suggest" + + - name: "Install highest dependencies (ignore-platform-reqs)" + if: ${{ matrix.dependencies == 'highest' && matrix.php-version == '8.0' }} + run: "composer update --ignore-platform-reqs --no-interaction --no-progress --no-suggest" + + - name: "Tests" + run: "vendor/bin/phpunit --coverage-clover=clover.xml --coverage-text" + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f5bcb3a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -env: - global: - - COMPOSER_ARGS="--no-interaction" - -matrix: - fast_finish: true - include: - - php: 7.3 - env: dependencies=lowest - - php: 7.3 - env: dependencies=highest - - php: 7.4 - env: dependencies=lowest - - php: 7.4 - env: dependencies=highest - - php: 8.0 - env: - - dependencies=lowest - - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs" - - php: 8.0 - env: - - dependencies=highest - - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs" - -before_script: - - travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs - - if [[ "$dependencies" == "lowest" ]]; then travis_retry composer update --prefer-dist --prefer-lowest --prefer-stable $COMPOSER_ARGS; fi; - - if [[ "$dependencies" == "highest" ]]; then travis_retry composer update --prefer-dist $COMPOSER_ARGS; fi; - - if [[ "$dependencies" == "highest" ]]; then travis_retry composer require laminas/laminas-mvc-console:^1.1 --prefer-dist $COMPOSER_ARGS; fi; - -script: - - ./vendor/bin/phpunit - - if [[ "$CS_CHECK" == "true" ]]; then ./vendor/bin/phpcs --standard=PSR2 ./src ./tests/AssetManagerTest; fi;