From 66ff9d2b6bb16f30847026d82e633734611ee283 Mon Sep 17 00:00:00 2001 From: Paragon Initiative Enterprises Date: Sun, 18 Apr 2021 22:59:43 -0400 Subject: [PATCH] Migrate off Travis CI --- .github/workflows/ci.yml | 105 ++++++++++++++++++++++++++++++++ .travis.yml | 25 -------- README.md | 2 +- composer.json | 4 +- src/SternTrait.php | 2 +- tests/phpunit/WeakSternTest.php | 19 +++--- 6 files changed, 121 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0aa1fec --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,105 @@ +name: CI + +on: [push] + +jobs: + old: + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: ['ubuntu-16.04'] + php-versions: ['7.0'] + phpunit-versions: ['6.5.14'] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl + ini-values: post_max_size=256M, max_execution_time=180 + tools: psalm, phpunit:${{ matrix.phpunit-versions }} + + - name: Fix permissions + run: sudo chmod -R 0777 . + + - name: Install dependencies + run: composer self-update --1; composer install + + - name: PHPUnit tests + uses: php-actions/phpunit@v2 + with: + memory_limit: 256M + + moderate: + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: ['ubuntu-latest'] + php-versions: ['7.1', '7.2', '7.3'] + phpunit-versions: ['latest'] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, sodium + ini-values: post_max_size=256M, max_execution_time=180 + tools: psalm, phpunit:${{ matrix.phpunit-versions }} + + - name: Fix permissions + run: sudo chmod -R 0777 . + + - name: Install dependencies + run: composer install + + - name: PHPUnit tests + uses: php-actions/phpunit@v2 + timeout-minutes: 30 + with: + memory_limit: 256M + + modern: + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: ['ubuntu-latest'] + php-versions: ['7.4', '8.0'] + phpunit-versions: ['latest'] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, sodium + ini-values: post_max_size=256M, max_execution_time=180 + tools: psalm, phpunit:${{ matrix.phpunit-versions }} + + - name: Fix permissions + run: sudo chmod -R 0777 . + + - name: Install dependencies + run: composer install + + - name: PHPUnit tests + uses: php-actions/phpunit@v2 + timeout-minutes: 30 + with: + memory_limit: 256M + + - name: Install Psalm + run: composer require --dev vimeo/psalm:^4 + + - name: Static Analysis + run: vendor/bin/psalm diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 19e1cf7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: php -sudo: false - -matrix: - fast_finish: true - include: - - php: "7.0" - - php: "7.1" - - php: "7.2" - - php: "7.3" - - php: "7.4" - - php: "nightly" - - php: "hhvm" - allow_failures: - - php: "7.4" - - php: "nightly" - - php: "hhvm" - -install: - - composer self-update - - composer update - -script: - - vendor/bin/phpunit - - vendor/bin/psalm diff --git a/README.md b/README.md index 74be0a1..1311048 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Stern -[![Build Status](https://travis-ci.org/paragonie/stern.svg?branch=master)](https://travis-ci.org/paragonie/stern) +[![Build Status](https://github.com/paragonie/stern/actions/workflows/ci.yml/badge.svg)](https://github.com/paragonie/stern/actions) [![Latest Stable Version](https://poser.pugx.org/paragonie/stern/v/stable)](https://packagist.org/packages/paragonie/stern) [![Latest Unstable Version](https://poser.pugx.org/paragonie/stern/v/unstable)](https://packagist.org/packages/paragonie/stern) [![License](https://poser.pugx.org/paragonie/stern/license)](https://packagist.org/packages/paragonie/stern) diff --git a/composer.json b/composer.json index 8af35b9..120a1d8 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "php": "^7|^8" }, "require-dev": { - "phpunit/phpunit": "^6", - "vimeo/psalm": "^1|^3" + "phpunit/phpunit": "^6|^7|^8|^9", + "vimeo/psalm": "^1|^3|^4" } } \ No newline at end of file diff --git a/src/SternTrait.php b/src/SternTrait.php index 2504e07..3f1ff34 100644 --- a/src/SternTrait.php +++ b/src/SternTrait.php @@ -14,7 +14,7 @@ trait SternTrait * @return mixed * @throws \Error */ - public function __call($name, $arguments) + public function __call(string $name, $arguments) { if (\method_exists($this, 'strict' . $name)) { return $this->{'strict' . $name}(...$arguments); diff --git a/tests/phpunit/WeakSternTest.php b/tests/phpunit/WeakSternTest.php index bcda9a6..a31272a 100644 --- a/tests/phpunit/WeakSternTest.php +++ b/tests/phpunit/WeakSternTest.php @@ -1,10 +1,16 @@ assertSame(true, $weak->weakBool(true)); $this->assertSame(false, $weak->weakBool(false)); try { @@ -23,7 +29,7 @@ public function testWeakBool() public function testWeakFloat() { - $weak = new \ParagonIE\SternTests\Weak(); + $weak = new Weak(); $this->assertSame(123.45, $weak->weakFloat(123.45)); $this->assertSame(12345.0, $weak->weakFloat(12345.0)); @@ -37,7 +43,7 @@ public function testWeakFloat() public function testWeakInt() { - $weak = new \ParagonIE\SternTests\Weak(); + $weak = new Weak(); $this->assertSame(12345, $weak->weakInt(12344)); try { @@ -50,7 +56,7 @@ public function testWeakInt() public function testWeakString() { - $weak = new \ParagonIE\SternTests\Weak(); + $weak = new Weak(); $this->assertSame('nccyr', $weak->weakString('apple')); $this->assertSame('NCCYR', $weak->weakString('APPLE')); $this->assertSame('12345', $weak->weakString('12345')); @@ -62,5 +68,4 @@ public function testWeakString() $this->assertTrue($ex instanceof TypeError); } } - -} \ No newline at end of file +}