Skip to content

Commit

Permalink
Merge pull request #46 from PHPCompatibility/feature/ghactions-update…
Browse files Browse the repository at this point in the history
…-for-sodium-2

Updates for latest SodiumCompat 1.x and allow for SodiumCompat 2.x
  • Loading branch information
jrfnl authored Apr 24, 2024
2 parents 135b06a + 93a3376 commit ede80c8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 13 deletions.
65 changes: 52 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,38 @@ jobs:

strategy:
matrix:
php: ['5.4', 'latest']
phpcompat: ['stable']
experimental: [false]

include:
# Sodium Compat 1.x is compatible with PHP 5.3 - current.
- php: '5.4'
phpcompat: 'stable'
sodium: '1'
experimental: false
- php: 'latest'
phpcompat: 'stable'
sodium: '1'
experimental: false

# Sodium Compat 2.x (master) is compatible with PHP 8.1 - current.
- php: '8.1'
phpcompat: 'stable'
sodium: 'dev'
experimental: false
- php: 'latest'
phpcompat: 'stable'
sodium: 'dev'
experimental: false

# Experimental builds against PHPCompatibility 10.
- php: '7.4'
phpcompat: 'dev-develop as 9.99.99'
sodium: '1'
experimental: true
- php: '8.1'
phpcompat: 'dev-develop as 9.99.99'
sodium: 'dev'
experimental: true

name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat }}"
name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat != 'stable' && ' dev' || 'stable' }} - Sodium ${{ matrix.sodium }}"
continue-on-error: ${{ matrix.experimental }}

steps:
Expand All @@ -90,6 +112,11 @@ jobs:
composer config minimum-stability dev
composer require --no-update phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" --no-interaction
- name: Conditionally update Sodium Compat
if: ${{ matrix.sodium != 'dev' }}
run: |
composer require --no-update paragonie/sodium_compat:"^${{ matrix.sodium }}.0" --no-interaction
- name: Install dependencies
run: composer install --no-interaction --no-progress

Expand All @@ -99,13 +126,25 @@ jobs:
run: composer validate --no-check-all --strict

# Make sure that known polyfills don't trigger any errors.
- name: Test the rulesets
run: |
vendor/bin/phpcs -ps ./Test/ParagonieRandomCompatTest.php --standard=PHPCompatibilityParagonieRandomCompat --runtime-set testVersion 5.2-
vendor/bin/phpcs -ps ./Test/ParagonieSodiumCompatTest.php --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 5.3-
- name: Test the RandomCompat ruleset
run: vendor/bin/phpcs -ps ./Test/ParagonieRandomCompatTest.php --standard=PHPCompatibilityParagonieRandomCompat --runtime-set testVersion 5.2-

- name: "Test the SodiumCompat ruleset (1.x)"
if: ${{ matrix.sodium != 'dev' }}
run: vendor/bin/phpcs -ps ./Test/ParagonieSodiumCompatTest.php --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 5.3-

- name: "Test the SodiumCompat ruleset (2.x)"
if: ${{ matrix.sodium == 'dev' }}
run: vendor/bin/phpcs -ps ./Test/ParagonieSodiumCompatTest.php --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 8.1-

# Check that the rulesets don't throw unnecessary errors for the compat libraries themselves.
- name: Test running against the polyfills
run: |
vendor/bin/phpcs -ps ./vendor/paragonie/random_compat/ --standard=PHPCompatibilityParagonieRandomCompat --runtime-set testVersion 5.2- --ignore=/random_compat/psalm-autoload.php,/random_compat/phpunit-autoload.php,/random_compat/tests/*,/random_compat/other/*
vendor/bin/phpcs -ps ./vendor/paragonie/sodium_compat/ --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 5.3- --ignore=/sodium_compat/tests/*
- name: Test running against the RandomCompat polyfills
run: vendor/bin/phpcs -ps ./vendor/paragonie/random_compat/ --standard=PHPCompatibilityParagonieRandomCompat --runtime-set testVersion 5.2- --ignore=/random_compat/psalm-autoload.php,/random_compat/phpunit-autoload.php,/random_compat/tests/*,/random_compat/other/*

- name: "Test running against the SodiumCompat polyfills (1.x)"
if: ${{ matrix.sodium != 'dev' }}
run: vendor/bin/phpcs -ps ./vendor/paragonie/sodium_compat/ --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 5.3- --ignore=/sodium_compat/tests/*

- name: "Test running against the SodiumCompat polyfills (2.x)"
if: ${{ matrix.sodium == 'dev' }}
run: vendor/bin/phpcs -ps ./vendor/paragonie/sodium_compat/ --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 8.1- --ignore=/sodium_compat/tests/*
1 change: 1 addition & 0 deletions PHPCompatibilityParagonieSodiumCompat/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
</rule>
<rule ref="PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__debuginfoFound">
<exclude-pattern>/sodium_compat/src/Core(32)?/Curve25519/Fe\.php$</exclude-pattern>
<exclude-pattern>/sodium_compat/src/Core/AES/Block\.php$</exclude-pattern>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.hash_equalsFound">
<exclude-pattern>/sodium_compat/src/Core/Util\.php$</exclude-pattern>
Expand Down

0 comments on commit ede80c8

Please sign in to comment.