Skip to content

Commit

Permalink
Merge pull request #18 from paragonie/ga
Browse files Browse the repository at this point in the history
Travis CI -> Github Actions
  • Loading branch information
paragonie-security authored Apr 17, 2021
2 parents aefe70b + e143ea3 commit bae5f15
Show file tree
Hide file tree
Showing 16 changed files with 137 additions and 39 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
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: ['7.5.20']
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: 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: 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: 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
23 changes: 0 additions & 23 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 @@
# Sapient: Secure API toolkit

[![Build Status](https://travis-ci.org/paragonie/sapient.svg?branch=master)](https://travis-ci.org/paragonie/sapient)
[![Build Status](https://github.com/paragonie/sapient/actions/workflows/ci.yml/badge.svg)](https://github.com/sapient/actions)
[![Latest Stable Version](https://poser.pugx.org/paragonie/sapient/v/stable)](https://packagist.org/packages/paragonie/sapient)
[![Latest Unstable Version](https://poser.pugx.org/paragonie/sapient/v/unstable)](https://packagist.org/packages/paragonie/sapient)
[![License](https://poser.pugx.org/paragonie/sapient/license)](https://packagist.org/packages/paragonie/sapient)
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"php": "^7|^8",
"guzzlehttp/psr7": "^1",
"paragonie/constant_time_encoding": "^2",
"paragonie/sodium_compat": "^1",
"paragonie/sodium_compat": ">= 1.15.4",
"psr/http-message": "^1"
},
"require-dev": {
"guzzlehttp/guzzle": "^6",
"phpunit/phpunit": "^6|^7",
"vimeo/psalm": "^2|^3"
"guzzlehttp/guzzle": "^6|^7",
"phpunit/phpunit": "^6|^7|^8|^9",
"vimeo/psalm": "^2|^3|^4"
},
"suggest": {
"guzzlehttp/guzzle": ">= 6.0 -- Sapient can be used a Guzzle adapter"
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="true"
bootstrap="vendor/autoload.php"
bootstrap="phpunit-autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
Expand Down
14 changes: 14 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
<?xml version="1.0"?>
<psalm
autoloader="phpunit-autoload.php"
useDocblockTypes="true"
totallyTyped="true"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MoreSpecificImplementedParamType errorLevel="suppress" /><!-- this is fine -->
<RedundantConditionGivenDocblockType errorLevel="suppress" /><!-- we're being explicit -->
<RedundantCastGivenDocblockType errorLevel="suppress" /><!-- we're being explicit -->
<DocblockTypeContradiction errorLevel="info" /><!-- We're still supporting PHP 5 -->
<UnnecessaryVarAnnotation errorLevel="suppress" />
<UnusedFunctionCall errorLevel="info" />
<UnusedVariable errorLevel="info" />
<RedundantCast errorLevel="suppress" />
<MixedReturnTypeCoercion errorLevel="info" />
<InternalMethod errorLevel="suppress" />
<RedundantConditionGivenDocblockType errorLevel="info" />
<UnsafeInstantiation errorLevel="info" />
</issueHandlers>
</psalm>
2 changes: 1 addition & 1 deletion src/Adapter/Generic/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Stream implements StreamInterface
/**
* The underlying stream resource
*
* @var resource|null
* @var resource|closed-resource|null
*/
protected $stream;

Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Guzzle.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,8 @@ public function getGuzzleClient(): Client
* @param string $input
* @return StreamInterface
* @throws \TypeError
*
* @psalm-suppress DeprecatedFunction
*/
public function stringToStream(string $input): StreamInterface
{
Expand Down
6 changes: 4 additions & 2 deletions src/CryptographyKeys/SealingSecretKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,17 @@ public function deriveSharedEncryptionkey(
$this->getString(true),
$publicKey->getString(true),
$publicKey->getString(true),
$this->getPublickey()->getString(true)
$this->getPublickey()->getString(true),
true
);
} else {
// You are the client:
$shared = \ParagonIE_Sodium_Compat::crypto_kx(
$this->getString(true),
$publicKey->getString(true),
$this->getPublickey()->getString(true),
$publicKey->getString(true)
$publicKey->getString(true),
true
);
}
return new SharedEncryptionKey($shared);
Expand Down
3 changes: 2 additions & 1 deletion tests/Adapter/GenericTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class GenericTest extends TestCase
protected $adapter;
/**
* Populate the methods.
* @before
*/
public function setup()
public function before()
{
$this->adapter = new Adapter();
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Adapter/GuzzleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ class GuzzleTest extends TestCase

/**
* Populate the methods.
* @before
*/
public function setup()
public function before()
{
if (!\class_exists('GuzzleHttp\Client')) {
$this->markTestSkipped('Guzzle not included as a dependency.');
Expand Down
3 changes: 2 additions & 1 deletion tests/KeyExchangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class KeyExchangeTest extends TestCase

/**
* Setup the class properties
* @before
*/
public function setUp()
public function before()
{
$this->clientSealSecret = SealingSecretKey::generate();
$this->clientSealPublic = $this->clientSealSecret->getPublickey();
Expand Down
3 changes: 2 additions & 1 deletion tests/SapientAuthenticateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ class SapientAuthenticateTest extends TestCase

/**
* Setup the class properties
* @before
*/
public function setUp()
public function before()
{
$this->sapient = new Sapient(new Guzzle());

Expand Down
3 changes: 2 additions & 1 deletion tests/SapientSealTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class SapientSealTest extends TestCase

/**
* Setup the class properties
* @before
*/
public function setUp()
public function before()
{
$this->sapient = new Sapient(new Guzzle());

Expand Down
3 changes: 2 additions & 1 deletion tests/SapientSignTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ class SapientSignTest extends TestCase

/**
* Setup the class properties
* @before
*/
public function setUp()
public function before()
{
$this->sapient = new Sapient(new Guzzle());

Expand Down
3 changes: 2 additions & 1 deletion tests/SapientSymmetricTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ private function getSampleObjects(): array

/**
* Setup the class properties
* @before
*/
public function setUp()
public function before()
{
$this->sapient = new Sapient(new Guzzle());
$this->sharedEncryptionKey = SharedEncryptionKey::generate();
Expand Down

0 comments on commit bae5f15

Please sign in to comment.