From 62b16c20b82611493f6c797c7125f4585ee24f08 Mon Sep 17 00:00:00 2001 From: Tint Naing Win Date: Sun, 7 Apr 2024 21:13:28 +0700 Subject: [PATCH] chore:support laravel 11.x --- .gitattributes | 23 +++++---- .../workflows/fix-php-code-style-issues.yml | 39 +++++++++----- .github/workflows/phpstan.yml | 23 ++++++--- .github/workflows/run-tests.yml | 38 +++++++------- .github/workflows/update-changelog.yml | 40 +++++++-------- .gitignore | 22 +++++--- composer.json | 10 ++-- phpunit.xml.dist | 51 ++++++++----------- src/SmspohChannel.php | 1 - 9 files changed, 138 insertions(+), 109 deletions(-) diff --git a/.gitattributes b/.gitattributes index 576d8f4..f6160d5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,10 +1,15 @@ -* text=auto +# Path-based git attributes +# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html -/tests export-ignore -/docs export-ignore -.editorconfig export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.styleci.yml export-ignore -.travis.yml export-ignore -phpunit.xml.dist export-ignore +# Ignore all test and documentation with "export-ignore". +/.github export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/art export-ignore +/tests export-ignore +/.editorconfig export-ignore +/CHANGELOG.md export-ignore +/phpstan.neon.dist export-ignore +/phpstan-baseline.neon export-ignore +/phpunit.xml.dist export-ignore +/README.md export-ignore diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index f942563..e7a240b 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -1,24 +1,35 @@ -name: Fix PHP code style issues +name: Check & fix styling -on: - push: - paths: - - '**.php' +on: [push] jobs: php-code-styling: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + + strategy: + fail-fast: true steps: - - name: Checkout code - uses: actions/checkout@v3 + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - ref: ${{ github.head_ref }} + php-version: 8.2 + tools: composer:v2 + coverage: none - - name: Fix PHP code style issues - uses: aglipanci/laravel-pint-action@2.1.0 + - name: Composer & GitHub Authentication + run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v4 + - name: Install composer dependencies + uses: nick-fields/retry@v2 with: - commit_message: Fix styling + timeout_minutes: 3 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress + + - name: Check code style + timeout-minutes: 2 + run: ./vendor/bin/pint --test --preset laravel diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 7cdcb47..48f6ef2 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -8,20 +8,31 @@ on: jobs: phpstan: - name: phpstan - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + + strategy: + fail-fast: true + + name: Static Analysis + steps: - - uses: actions/checkout@v3 + - name: Check out repository code + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: 8.2 + tools: composer:v2 coverage: none - name: Install composer dependencies - uses: ramsey/composer-install@v2 + uses: nick-fields/retry@v2 + with: + timeout_minutes: 3 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress - name: Run PHPStan timeout-minutes: 2 - run: ./vendor/bin/phpstan --error-format=github + run: ./vendor/bin/phpstan analyse --error-format=github diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ed5d951..9d77c6a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,38 +8,42 @@ on: jobs: test: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-22.04 + strategy: fail-fast: true matrix: - os: [ubuntu-latest] - php: [8.2, 8.1] - laravel: [10.*, 9.*] - dependency-version: [prefer-lowest, prefer-stable] - include: - - laravel: 10.* - testbench: 8.* - larastan: 2.4.* - - laravel: 9.* - testbench: 7.* - larastan: 2.* - - name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} + php: [ 8.1, 8.2, 8.3 ] + laravel: [ 9, 10, 11 ] + exclude: + - php: 8.1 + laravel: 11 + - php: 8.3 + laravel: 9 + + name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} + ini-values: error_reporting=E_ALL + tools: composer:v2 coverage: none + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nunomaduro/larastan:${{ matrix.larastan }}" --no-interaction --no-update - composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + composer require "laravel/framework:^${{ matrix.laravel }}" --no-update + composer update --prefer-dist --no-interaction --no-progress - name: Execute tests timeout-minutes: 2 diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 4fd4220..c3fd327 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -1,28 +1,28 @@ name: "Update Changelog" on: - release: - types: [released] + release: + types: [released] jobs: - update: - runs-on: ubuntu-latest + update: + runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - ref: master + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: master - - name: Update Changelog - uses: stefanzweifel/changelog-updater-action@v1 - with: - latest-version: ${{ github.event.release.name }} - release-notes: ${{ github.event.release.body }} + - name: Update Changelog + uses: stefanzweifel/changelog-updater-action@v1 + with: + latest-version: ${{ github.event.release.name }} + release-notes: ${{ github.event.release.body }} - - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v4 - with: - branch: master - commit_message: Update CHANGELOG - file_pattern: CHANGELOG.md + - name: Commit updated CHANGELOG + uses: stefanzweifel/git-auto-commit-action@v5 + with: + branch: master + commit_message: Update CHANGELOG + file_pattern: CHANGELOG.md diff --git a/.gitignore b/.gitignore index e6a66ff..a6dbfff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,17 @@ -/vendor -/.idea -/.vagrant -/build +.DS_Store +.vagrant +.idea +.php_cs +.php_cs.cache +.phpunit.result.cache composer.phar composer.lock -.DS_Stor -.phpunit.result.cache -coverage.clover +coverage +build +phpunit.xml +phpstan.neon +testbench.yaml +vendor +node_modules +.php-cs-fixer.cache +.phpunit.cache diff --git a/composer.json b/composer.json index 32a704b..b89ae28 100644 --- a/composer.json +++ b/composer.json @@ -13,17 +13,17 @@ } ], "require": { - "php": "^8.1|^8.2", + "php": "^8.1", "ext-json": "*", "guzzlehttp/guzzle": "^7.0", - "illuminate/notifications": "^9.0|^10.0", - "illuminate/support": "^9.0|^10.0" + "illuminate/notifications": "^9.0|^10.0|^11.0", + "illuminate/support": "^9.0|^10.0|^11.0" }, "require-dev": { "laravel/pint": "^1.5", "mockery/mockery": "^1.3", - "nunomaduro/larastan": "^1.0|^2.0", - "orchestra/testbench": "^7.0|^8.0", + "larastan/larastan": "^1.0|^2.0", + "orchestra/testbench": "^7.31|^8.11|^9.0", "pestphp/pest": "^1.21|^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index fc1602a..ff0494e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,32 +1,23 @@ - - - - ./tests - - - - - ./src - - - - - - - - - + + + + + + + + + + + ./tests + + + + + + + + ./src + + diff --git a/src/SmspohChannel.php b/src/SmspohChannel.php index c1125f6..2620099 100644 --- a/src/SmspohChannel.php +++ b/src/SmspohChannel.php @@ -18,7 +18,6 @@ class SmspohChannel protected string $sender; /** - * @var int * The message body content count should be no longer than 6 message parts(918). */ protected int $character_limit_count = 918;