From d9507b2b3c824f8c54638544ac1f64877d4bffc9 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Sun, 22 Mar 2020 10:54:55 -0700 Subject: [PATCH] Migrate to Github Actions for CI (#3) --- .github/workflows/php.yml | 57 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 32 ---------------------- README.md | 6 +++-- 3 files changed, 61 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/php.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..bad621b --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,57 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +env: + DEFAULT_COMPOSER_FLAGS: --no-interaction --no-ansi --no-progress --no-suggest + +jobs: + + test: + + name: Test + + runs-on: ubuntu-latest + + strategy: + matrix: + php-version: + - 7.1 + - 7.2 + - 7.3 + - 7.4 + dependencies: + - low + - high + steps: + - uses: actions/checkout@v2 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - name: Show PHP info + run: php -v + + - name: Validate Composer + run: composer validate + + - name: Install dependencies + run: | + if [[ ${{ matrix.dependencies }} = 'high' ]]; then composer update $DEFAULT_COMPOSER_FLAGS; fi + if [[ ${{ matrix.dependencies }} = 'low' ]]; then composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi + + + - name: PHPUnit + run: composer phpunit + + - name: PHPStan + run: composer phpstan + + - name: PHPCS + run: composer phpcs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7a7b37b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: php - -sudo: false - -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4snapshot - -matrix: - fast_finish: true - -env: - matrix: - - DEPENDENCIES="high" - - DEPENDENCIES="low" - global: - - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest" - -install: - - if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS; fi - - if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi - -script: - - composer phpunit - - composer phpstan - - composer phpcs - -after_success: - - bash <(curl -s https://codecov.io/bash) - diff --git a/README.md b/README.md index d378ab4..f6b8506 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # JWT - JSON Web Tokens +![CI](https://github.com/Firehed/jwt/workflows/CI/badge.svg) + ## Installation `composer require firehed/jwt` @@ -87,7 +89,7 @@ Note: key ID can take any scalar format. The example above uses a datestamp, but When calling `getClaims()`, an exception may be thrown if the signature cannot be verified or the time validity specified in standard `nbf` or `exp` claims is out of line. -Be prepared to catch `InvalidSignatureException`, `TokenExpiredException`, and `TokenNotYetValidException` when calling those methods. +Be prepared to catch `InvalidSignatureException`, `TokenExpiredException`, and `TokenNotYetValidException` when calling those methods. If an invalid token is passed to `JWT::fromEncoded()`, an `InvalidFormatException` will be thrown. @@ -174,4 +176,4 @@ try { } ``` -`SessionHandler` will always use the default value from the `KeyContainer`. That means the most recently key will be used unless one was specified with `->setDefaultKey()`. \ No newline at end of file +`SessionHandler` will always use the default value from the `KeyContainer`. That means the most recently key will be used unless one was specified with `->setDefaultKey()`.