diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..0a4997f --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,93 @@ +name: CI + +on: + push: + pull_request: + schedule: + - cron: '0 10 * * 5' + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: + - 7.4 + composer_args: + - '' + - '--prefer-stable' + - '--prefer-stable --prefer-lowest' + name: PHP ${{ matrix.php }} ${{ matrix.composer_args }} + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.composer/cache + key: composer-${{ hashFiles('composer.json') }}-${{ matrix.php }}-${{ matrix.composer_args }}-${{ github.run_number }} + restore-keys: | + composer-${{ hashFiles('composer.json') }}-${{ matrix.php }} + composer-${{ hashFiles('composer.json') }} + composer- + - name: Build + env: + COMPOSER_ARGS: ${{ matrix.composer_args }} + run: composer update --no-interaction --no-progress --prefer-dist $COMPOSER_ARGS + - run: | + ls -alh ~/.composer || true + ls -alh ~/.cache + - name: Lint + run: vendor/bin/parallel-lint -e php,phpt --exclude tests/temp src tests + - name: Tests + run: vendor/bin/tester -c tests/php.ini -s tests + - name: PHPStan + run: | + vendor/bin/phpstan analyse + vendor/bin/phpstan analyse -c phpstan.tests.neon.dist + - if: failure() + uses: actions/upload-artifact@v2 + with: + name: output + path: tests/**/output + + code_style: + runs-on: ubuntu-latest + needs: [ tests ] + name: Code Style + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + coverage: none + - name: Build + run: composer update --no-interaction --no-progress --prefer-dist --prefer-stable + - name: Check Code Style + run: vendor/bin/phpcs + + code_coverage: + runs-on: ubuntu-latest + needs: [ tests ] + continue-on-error: true + name: Code Coverage + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + coverage: none + - run: composer global require php-coveralls/php-coveralls + - name: Build + run: composer update --no-interaction --no-progress --prefer-dist --prefer-stable + - name: Calculate coverage + run: vendor/bin/tester -c tests/php.ini -p phpdbg tests --coverage coverage.xml --coverage-src src + - name: Upload Coverage Report + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: php-coveralls --verbose --config tests/coveralls.yml + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6840ff0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: php -php: - - 7.4 - -env: - - COMPOSER_ARGS="" - - COMPOSER_ARGS="--prefer-stable" - - COMPOSER_ARGS="--prefer-stable --prefer-lowest" - -jobs: - include: - - stage: Code Standard Checker - php: 7.4 - script: - - vendor/bin/phpcs - - stage: Code Coverage - php: 7.4 - script: - - vendor/bin/tester -p phpdbg tests -s --coverage ./coverage.xml --coverage-src ./src - after_script: - - travis_retry wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.0.0/php-coveralls.phar - - php php-coveralls.phar --verbose --config tests/coveralls.yml - allow_failures: - - stage: Code Coverage - -install: - - travis_retry composer update --no-interaction --prefer-dist $COMPOSER_ARGS - -script: - - vendor/bin/parallel-lint -e php,phpt --exclude tests/temp src tests - - vendor/bin/tester -s -p php -c tests/php.ini tests - - vendor/bin/phpstan analyse - - vendor/bin/phpstan analyse -c phpstan.tests.neon.dist - -after_failure: - - for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done - -sudo: false - -cache: - directories: - - $HOME/.composer/cache diff --git a/composer.json b/composer.json index 6013b89..8b15574 100644 --- a/composer.json +++ b/composer.json @@ -47,6 +47,9 @@ "NepadaTests\\": "tests/" } }, + "config": { + "platform-check": false + }, "extra": { "branch-alias": { "dev-master": "1.0-dev" diff --git a/tests/php.ini b/tests/php.ini index e69de29..720e7bc 100644 --- a/tests/php.ini +++ b/tests/php.ini @@ -0,0 +1,3 @@ +[php] +extension=json.so +extension=tokenizer.so