-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GitHub Actions for testing (#330)
* Add workflow file for tests on github actions * Remove travis ci * Check CI variable correctly and fix PHPStan issue * Stop running tests on PHP 7.2 * Use openssl_pkey_get_* methods on keys before passing to openssl_pkey_derive * Update link to badge in README * Reduce setup-php extensions to bare minimum * Remove PR branch from workflows file * Add builds for PHP 8.1 * Stop skipping PushServiceTest on CI * Run tests with web-push-testing * Remove invalid assert from PushServiceTest * Add fallback for running WebPushTest on CI environment * Remove PHP 7.2 from tests as that is no longer supported * Resolve phpstan errors * Skip running php-cs-fixer on PHP 8.1 PHP 8.1 is currently not supported by this. * Remove extra conversions of public & private key strings * Throw exception instead of silent fallback when unpack fails
- Loading branch information
Showing
8 changed files
with
183 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: ['7.3', '7.4', '8.0', '8.1'] | ||
|
||
name: PHP ${{ matrix.php }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: curl, mbstring, openssl, gmp | ||
coverage: none | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Cache Composer dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/composer-cache | ||
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Prepare composer | ||
run: | | ||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" | ||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | ||
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" | ||
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] | ||
then | ||
>&2 echo 'ERROR: Invalid installer checksum' | ||
rm composer-setup.php | ||
exit 1 | ||
fi | ||
sudo php composer-setup.php --quiet --install-dir=/usr/local/bin --filename=composer | ||
RESULT=$? | ||
rm composer-setup.php | ||
composer config discard-changes true | ||
composer install | ||
- name: Setup web-push-testing-service | ||
run: | | ||
npm install web-push-testing -g | ||
- name: Run tests | ||
run: | | ||
web-push-testing --port 9012 start | ||
composer test:unit | ||
web-push-testing --port 9012 stop | ||
- name: Run PHPStan | ||
run: composer test:typing | ||
|
||
- name: Run php-cs-fixer | ||
if: ${{ matrix.php != '8.1' }} | ||
run: composer test:syntax |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.