From 22b28418f90b8b253b4d37df9b3de80b7314d321 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 May 2021 09:06:16 -0700 Subject: [PATCH 01/10] chore: remove travis, add github actions --- .github/workflows/tests.yml | 66 +++++++++++++++++++++++++++++++++++++ .travis.yml | 36 -------------------- 2 files changed, 66 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..73ad7b8e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,66 @@ +name: Test Suite +on: + push: + branches: + - master + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + php: [ "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0" ] + name: PHP ${{matrix.php }} Unit Test + steps: + - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - name: Install Dependencies + uses: nick-invision/retry@v1 + with: + timeout_minutes: 10 + max_attempts: 3 + command: composer install + - name: Run Script + run: vendor/bin/phpunit + + # use dockerfiles for old versions of php (setup-php times out for those). + test_php55: + name: "PHP 5.5 Unit Test" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run Unit Tests + uses: docker://php:5.5-cli + with: + entrypoint: php composer.phar install && vendor/bin/phpunit + + test_php54: + name: "PHP 5.4 Unit Test" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run Unit Tests + uses: docker://php:5.4-cli + with: + entrypoint: php composer.phar install && vendor/bin/phpunit + + style: + runs-on: ubuntu-latest + name: PHP Style Check + steps: + - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + - name: Run Script + run: | + composer require friendsofphp/php-cs-fixer && + vendor/bin/php-cs-fixer fix --diff --dry-run . && + vendor/bin/php-cs-fixer fix --rules=native_function_invocation --allow-risky=yes --diff src diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 90e516cd..00000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: php - -branches: - - only: [master] - -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -matrix: - include: - - php: 5.3 - dist: precise - - php: 5.4 - dist: trusty - - php: 5.5 - dist: trusty - - name: "Check Style" - php: "7.4" - env: RUN_CS_FIXER=true - -sudo: false - -before_script: composer install -script: - - if [ "${RUN_CS_FIXER}" = "true" ]; then - composer require friendsofphp/php-cs-fixer && - vendor/bin/php-cs-fixer fix --diff --dry-run . && - vendor/bin/php-cs-fixer fix --rules=native_function_invocation --allow-risky=yes --diff src; - else - vendor/bin/phpunit; - fi From 42f6b64cfe20a33f53fe2aa9fb6ea0778dc8c7cd Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 May 2021 09:12:16 -0700 Subject: [PATCH 02/10] fix github action --- .github/workflows/tests.yml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 73ad7b8e..5e58ba9b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,7 @@ jobs: strategy: matrix: php: [ "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0" ] + older_php: [ "5.4", "5.5" ] name: PHP ${{matrix.php }} Unit Test steps: - uses: actions/checkout@v2 @@ -28,27 +29,18 @@ jobs: run: vendor/bin/phpunit # use dockerfiles for old versions of php (setup-php times out for those). - test_php55: - name: "PHP 5.5 Unit Test" + test_older_php: + name: "PHP ${{ matrix.older_php }} Unit Test" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Run Unit Tests - uses: docker://php:5.5-cli + uses: docker://php:${{ matrix.older_php }}-cli with: - entrypoint: php composer.phar install && vendor/bin/phpunit - - test_php54: - name: "PHP 5.4 Unit Test" - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run Unit Tests - uses: docker://php:5.4-cli - with: - entrypoint: php composer.phar install && vendor/bin/phpunit + run: | + php composer.phar install + vendor/bin/phpunit style: runs-on: ubuntu-latest From 94b86019b13ec52eec8a8c0323ba81a5e494b77e Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 May 2021 09:18:10 -0700 Subject: [PATCH 03/10] fix cs --- .github/workflows/tests.yml | 4 ++-- src/BeforeValidException.php | 1 + src/ExpiredException.php | 1 + src/JWT.php | 6 +++--- src/SignatureInvalidException.php | 1 + tests/JWKTest.php | 1 + tests/JWTTest.php | 1 + 7 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5e58ba9b..9460b479 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,6 +53,6 @@ jobs: php-version: "7.4" - name: Run Script run: | - composer require friendsofphp/php-cs-fixer && - vendor/bin/php-cs-fixer fix --diff --dry-run . && + composer require friendsofphp/php-cs-fixer + vendor/bin/php-cs-fixer fix --diff --dry-run . vendor/bin/php-cs-fixer fix --rules=native_function_invocation --allow-risky=yes --diff src diff --git a/src/BeforeValidException.php b/src/BeforeValidException.php index fdf82bd9..c147852b 100644 --- a/src/BeforeValidException.php +++ b/src/BeforeValidException.php @@ -1,4 +1,5 @@ Date: Mon, 17 May 2021 09:20:09 -0700 Subject: [PATCH 04/10] fix matrix --- .github/workflows/tests.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9460b479..c31de2a5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,6 @@ jobs: strategy: matrix: php: [ "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0" ] - older_php: [ "5.4", "5.5" ] name: PHP ${{matrix.php }} Unit Test steps: - uses: actions/checkout@v2 @@ -29,14 +28,26 @@ jobs: run: vendor/bin/phpunit # use dockerfiles for old versions of php (setup-php times out for those). - test_older_php: - name: "PHP ${{ matrix.older_php }} Unit Test" + test_php56: + name: "PHP 5.6 Unit Test" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Run Unit Tests - uses: docker://php:${{ matrix.older_php }}-cli + uses: docker://php:5.6-cli + with: + run: | + php composer.phar install + vendor/bin/phpunit + test_php55: + name: "PHP 5.5 Unit Test" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run Unit Tests + uses: docker://php:5.5-cli with: run: | php composer.phar install From b0b687be35c9984e69b5d8935ddfe75da75b9a84 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 May 2021 09:21:43 -0700 Subject: [PATCH 05/10] remove public const --- src/JWT.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/JWT.php b/src/JWT.php index ca562494..b167abd7 100644 --- a/src/JWT.php +++ b/src/JWT.php @@ -22,9 +22,9 @@ */ class JWT { - public const ASN1_INTEGER = 0x02; - public const ASN1_SEQUENCE = 0x10; - public const ASN1_BIT_STRING = 0x03; + const ASN1_INTEGER = 0x02; + const ASN1_SEQUENCE = 0x10; + const ASN1_BIT_STRING = 0x03; /** * When checking nbf, iat or expiration times, From 8e2ce41bf91ad5ad29b021d9b7ee6698b4c213a2 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 May 2021 09:24:08 -0700 Subject: [PATCH 06/10] tries again to fix gh-actions --- .github/workflows/tests.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c31de2a5..2955afad 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,30 +28,28 @@ jobs: run: vendor/bin/phpunit # use dockerfiles for old versions of php (setup-php times out for those). - test_php56: - name: "PHP 5.6 Unit Test" + test_php55: + name: "PHP 5.5 Unit Test" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Run Unit Tests - uses: docker://php:5.6-cli - with: - run: | - php composer.phar install - vendor/bin/phpunit - test_php55: - name: "PHP 5.5 Unit Test" + uses: docker://php:5.5-cli + run: | + php composer.phar install + vendor/bin/phpunit + test_php54: + name: "PHP 5.4 Unit Test" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Run Unit Tests - uses: docker://php:5.5-cli - with: - run: | - php composer.phar install - vendor/bin/phpunit + uses: docker://php:5.4-cli + run: | + php composer.phar install + vendor/bin/phpunit style: runs-on: ubuntu-latest From 9c227f2ff82ace0a9db4e78101f0a9905974bb75 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 May 2021 09:28:07 -0700 Subject: [PATCH 07/10] add entrypoint file --- .github/actions/entrypoint.sh | 10 ++++++++++ .github/workflows/tests.yml | 13 ++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100755 .github/actions/entrypoint.sh diff --git a/.github/actions/entrypoint.sh b/.github/actions/entrypoint.sh new file mode 100755 index 00000000..266bec2f --- /dev/null +++ b/.github/actions/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh -l + +curl --silent --show-error https://getcomposer.org/installer | php +php composer.phar self-update + +echo "---Installing dependencies ---" +php composer.phar update + +echo "---Running unit tests ---" +vendor/bin/phpunit diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2955afad..3994e097 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,9 +36,9 @@ jobs: uses: actions/checkout@v2 - name: Run Unit Tests uses: docker://php:5.5-cli - run: | - php composer.phar install - vendor/bin/phpunit + with: + entrypoint: ./github/actions/entrypoint.sh + test_php54: name: "PHP 5.4 Unit Test" runs-on: ubuntu-latest @@ -47,9 +47,8 @@ jobs: uses: actions/checkout@v2 - name: Run Unit Tests uses: docker://php:5.4-cli - run: | - php composer.phar install - vendor/bin/phpunit + with: + entrypoint: ./github/actions/entrypoint.sh style: runs-on: ubuntu-latest @@ -59,7 +58,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "7.4" + php-version: "7.0" - name: Run Script run: | composer require friendsofphp/php-cs-fixer From 41c51f5cd1f25e56cd6bb25677daed295a4c2c1c Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 May 2021 09:30:40 -0700 Subject: [PATCH 08/10] fix path --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3994e097..09539931 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: - name: Run Unit Tests uses: docker://php:5.5-cli with: - entrypoint: ./github/actions/entrypoint.sh + entrypoint: ./.github/actions/entrypoint.sh test_php54: name: "PHP 5.4 Unit Test" @@ -48,7 +48,7 @@ jobs: - name: Run Unit Tests uses: docker://php:5.4-cli with: - entrypoint: ./github/actions/entrypoint.sh + entrypoint: ./.github/actions/entrypoint.sh style: runs-on: ubuntu-latest From 09d7e64b09be2bb23b4ef5b77dcd5d32f2b54fca Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 May 2021 09:33:03 -0700 Subject: [PATCH 09/10] add deps --- .github/actions/entrypoint.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/actions/entrypoint.sh b/.github/actions/entrypoint.sh index 266bec2f..ce8379cb 100755 --- a/.github/actions/entrypoint.sh +++ b/.github/actions/entrypoint.sh @@ -1,5 +1,13 @@ #!/bin/sh -l +apt-get update && \ +apt-get install -y --no-install-recommends \ + git \ + zip \ + curl \ + unzip \ + wget + curl --silent --show-error https://getcomposer.org/installer | php php composer.phar self-update From 0c7bdd001a15ca45cc943a13f34479292d42bbda Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 May 2021 09:34:35 -0700 Subject: [PATCH 10/10] remove invalid syntaxCheck element in phpunit.xml --- phpunit.xml.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9f85f5ba..092a662c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="tests/bootstrap.php" >