Skip to content

Commit

Permalink
Merge pull request #5 from paragonie/ga
Browse files Browse the repository at this point in the history
Migrate off Travis CI
  • Loading branch information
paragonie-security committed Apr 19, 2021
2 parents e9ced50 + 66ff9d2 commit 21359fc
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 36 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion src/SternTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
19 changes: 12 additions & 7 deletions tests/phpunit/WeakSternTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?php

class WeakSternTest extends \PHPUnit\Framework\TestCase
use PHPUnit\Framework\TestCase;
use ParagonIE\SternTests\Weak;

/**
* Class WeakSternTest
*/
class WeakSternTest extends TestCase
{
public function testWeakBool()
{
$weak = new \ParagonIE\SternTests\Weak();
$weak = new Weak();
$this->assertSame(true, $weak->weakBool(true));
$this->assertSame(false, $weak->weakBool(false));
try {
Expand All @@ -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));

Expand All @@ -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 {
Expand All @@ -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'));
Expand All @@ -62,5 +68,4 @@ public function testWeakString()
$this->assertTrue($ex instanceof TypeError);
}
}

}
}

0 comments on commit 21359fc

Please sign in to comment.