Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3.x] Update CI configuration, dependencies #101

Merged
merged 7 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 9 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
phpunit-versions: ['7.5.20']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -27,42 +27,29 @@ jobs:
run: composer self-update --1; composer install

- name: PHPUnit tests
uses: php-actions/phpunit@v2
with:
memory_limit: 256M
run: vendor/bin/phpunit

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.1', '7.2', '7.3', '7.4', '8.0', '8.1']
phpunit-versions: ['latest']
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- 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 }}
ini-values: error_reporting=-1, display_errors=On
coverage: none

- name: Install dependencies
run: composer install
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"

- name: PHPUnit tests
uses: php-actions/phpunit@v2
with:
memory_limit: 256M

- name: Install Psalm
if: contains(['7.4', '8.0], ${{ matrix.php-version }})
run: composer require --dev vimeo/psalm:^4

- name: Static Analysis
if: contains(['7.4', '8.0], ${{ matrix.php-version }})
run: composer static-analysis
run: vendor/bin/phpunit
34 changes: 34 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Psalm

on:
push:
branches: [ v3.x ]
pull_request:
branches: [ v3.x ]

jobs:
psalm:
name: Psalm on PHP ${{ matrix.php-versions }}
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.3']
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: psalm:4
coverage: none

- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"
with:
composer-options: --no-dev

- name: Static Analysis
run: psalm
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"ext-json": "*",
"ext-openssl": "*",
"paragonie/constant_time_encoding": "^1.0.4|^2",
"paragonie/sodium_compat": ">= 1.17 <2"
"paragonie/sodium_compat": "^1"
},
"require-dev": {
"phpunit/phpunit": "^4|^5|^6|^7|^8|^9"
Expand Down
2 changes: 1 addition & 1 deletion src/EncryptedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public function getStreamForFile($fileName = 'php://temp', $mode = 'wb')
*
* @throws CipherSweetException
*/
public function setActiveTenant($tenant, $dontError = false): static
public function setActiveTenant($tenant, $dontError = false)
{
if (!$this->getEngine()->isMultiTenantSupported()) {
if (!$dontError) {
Expand Down
6 changes: 3 additions & 3 deletions src/JsonFieldMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public static function fromString($string)
{
$crc32 = Binary::safeSubstr($string, 0, 8);
$json = Binary::safeSubstr($string, 8);
$calc = hash('crc32c', $json);
$calc = hash('crc32', $json);
if (!Util::hashEquals($calc, $crc32)) {
throw new CipherSweetException("CRC32C invalid; was config corrupted?");
throw new CipherSweetException("CRC32 invalid; was config corrupted?");
}

$decoded = \json_decode($json, true);
Expand Down Expand Up @@ -193,7 +193,7 @@ public function getMapping()
public function toString()
{
$json = \json_encode(['fields' => $this->fields]);
$crc = \hash('crc32c', $json);
$crc = \hash('crc32', $json);
return $crc . $json;
}

Expand Down
Loading