From 0adb2919d6d3b947774f59e548c69acd3d8b00db Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 17 Nov 2021 20:16:29 +0100 Subject: [PATCH] Add github actions to run tests Run github actions with php 7.3, 7.4, 8.0, 8.1, 8.2 Bump min php 7.3 to match phpunit test requirement Add sodium to composer suggestion Add package to avoid dependencies with known security vulnerabilities --- .github/workflows/php.yml | 40 +++++++++++++++++++++++++++++++++++++++ .gitignore | 5 +++++ composer.json | 13 ++++++++++--- 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..e069a39 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,40 @@ +name: PHP Tests + +on: [ push, pull_request ] + +jobs: + + build: + strategy: + matrix: + operating-system: [ ubuntu-latest ] + php-versions: [ '7.3', '7.4', '8.0', '8.1' ] + experimental: [ false ] + include: + - php-versions: '8.2' + operating-system: ubuntu-latest + experimental: true + fail-fast: false + runs-on: ${{ matrix.operating-system }} + continue-on-error: ${{ matrix.experimental }} + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies + if: "${{ matrix.experimental == false }}" + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Install dependencies, ignore php requirements + if: "${{ matrix.experimental == true }}" + run: composer install --prefer-dist --no-progress --no-suggest --ignore-platform-reqs + + - name: Run test suite + run: composer run-script test diff --git a/.gitignore b/.gitignore index e48cc98..e74ce5f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,8 @@ .tmp pkg tmp + +.phpunit.result.cache +composer.lock +.idea/ +vendor/ diff --git a/composer.json b/composer.json index f1e477a..de577a4 100644 --- a/composer.json +++ b/composer.json @@ -13,16 +13,23 @@ } ], "require": { - "php": "^5.6 || ^7.0 || ^8.0", + "php": "^7.3 || ^8.0", "phpseclib/phpseclib": "^2.0.31" }, "require-dev": { + "roave/security-advisories": "dev-latest", "phpunit/phpunit": "^9.0" }, "suggest": { - "ext-mcrypt": "required if you use encryption cast5" + "ext-mcrypt": "required if you use encryption cast5", + "ext-sodium": "required if you use signature ed25519" }, "autoload": { - "classmap": ["lib/"] + "classmap": [ + "lib/" + ] + }, + "scripts": { + "test": "./vendor/bin/phpunit" } }