From fb14ae5fbcfbebea78963881227a7ac40495736d Mon Sep 17 00:00:00 2001 From: Alexandr Smirnov Date: Tue, 25 Jun 2024 15:35:52 +0300 Subject: [PATCH 1/2] Add matrix php: [7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3] --- .github/workflows/test.yaml | 144 +++++++++++++++++++++++++++--------- composer.json | 2 +- 2 files changed, 111 insertions(+), 35 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bca7243..cb81994 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -2,38 +2,114 @@ name: Test on: [push, pull_request] +permissions: + contents: read + jobs: - test: - name: PHP ${{ matrix.php-version }} - - runs-on: ubuntu-22.04 - - strategy: - matrix: - php-version: - - 7.3 - - 7.4 - - 8.0 - - 8.1 - - 8.2 - - 8.3 - - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - coverage: pcov - tools: composer:v2 - - - name: Install Composer dependencies - uses: ramsey/composer-install@v1 - with: - composer-options: --prefer-dist - - - name: Run Tests - run: vendor/bin/phpunit + + + test: + #name: PHP ${{ matrix.php-version }} + name: PHP ${{ matrix.php }} - ${{ matrix.phpunit }} - ${{ matrix.stability }} + runs-on: ubuntu-20.04 + + strategy: + fail-fast: true + matrix: + php: [7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3] + phpunit: ['9.6.16'] + # stability: [prefer-lowest, prefer-stable] + stability: [prefer-dist] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + # https://github.com/shivammathur/setup-php + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, :php-psr #sqlite, pdo_sqlite, gd, redis, igbinary, msgpack, lzf, zstd, lz4, memcached, gmp, + ini-values: error_reporting=E_ALL + tools: composer:v2 + coverage: none + #env: + #REDIS_CONFIGURE_OPTS: --enable-redis --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lzf --with-liblzf --enable-redis-zstd --with-libzstd --enable-redis-lz4 --with-liblz4 + #REDIS_LIBS: liblz4-dev, liblzf-dev, libzstd-dev + + # - name: Validate composer.json and composer.lock + # run: composer validate --strict + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + #key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + #restore-keys: ${{ runner.os }}-composer- + key: ${{ runner.os }}-composer-${{ matrix.prefer }}-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}- + + # - name: Install dependencies + # run: composer install --prefer-dist + + - name: Set PHPUnit + uses: nick-fields/retry@v3 + with: + timeout_minutes: 5 + max_attempts: 10 + command: composer require phpunit/phpunit:^${{ matrix.phpunit }} --dev --no-interaction --no-update + + - name: Install dependencies + uses: nick-fields/retry@v3 + with: + timeout_minutes: 5 + max_attempts: 10 + command: composer update --${{ matrix.stability }} --no-interaction --no-progress + + - name: Run Tests + run: vendor/bin/phpunit + +#name: Test +# +#on: [push, pull_request] +# +#jobs: +# test: +# name: PHP ${{ matrix.php-version }} +# +# runs-on: ubuntu-22.04 +# +# strategy: +# matrix: +# php-version: +# - 7.3 +# - 7.4 +# - 8.0 +# - 8.1 +# - 8.2 +# - 8.3 +# +# +# steps: +# - name: Checkout +# uses: actions/checkout@v2 +# +# - name: Install PHP with extensions +# uses: shivammathur/setup-php@v2 +# with: +# php-version: ${{ matrix.php-version }} +# coverage: pcov +# tools: composer:v2 +# +# - name: Install Composer dependencies +# uses: ramsey/composer-install@v1 +# with: +# composer-options: --prefer-dist +# +# - name: Run Tests +# run: vendor/bin/phpunit diff --git a/composer.json b/composer.json index ab5bc1e..30b92a8 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ } }, "require": { - "php": "^7.3|^8.0" + "php": "^7.1|^8.0" }, "require-dev": { "phpunit/phpunit": "^9" From 1e51625dd0f70ec2c5ed35b48ea116cefadcba29 Mon Sep 17 00:00:00 2001 From: Alexandr Smirnov Date: Tue, 25 Jun 2024 15:44:45 +0300 Subject: [PATCH 2/2] Require php >=7.3 phpunit/phpunit[9.6.16, ..., 9.6.19] --- .github/workflows/test.yaml | 2 +- composer.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index cb81994..f5dd3d0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: true matrix: - php: [7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3] + php: [7.3, 7.4, 8.0, 8.1, 8.2, 8.3] phpunit: ['9.6.16'] # stability: [prefer-lowest, prefer-stable] stability: [prefer-dist] diff --git a/composer.json b/composer.json index 30b92a8..d0e9e1e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,6 @@ "name": "kohanaworld/hmmmath", "description": "Collection of math related PHP functions (PHP >=7.2 <=8.3", "license": "MIT", - "version": "0.9.0", "authors": [ { "name": "Lars Strojny", @@ -24,7 +23,7 @@ } }, "require": { - "php": "^7.1|^8.0" + "php": "^7.3|^8.0" }, "require-dev": { "phpunit/phpunit": "^9"