From eb8eb6483c3f18b1b19b9b47cba4818f7fb866e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bouc=CC=8Cek?= Date: Sat, 28 Oct 2023 21:34:22 +0200 Subject: [PATCH 1/4] Update PhpStan --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1ecd812..41d6712 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "ext-iconv": "*" }, "require-dev": { - "phpstan/phpstan": "^0.12.89" + "phpstan/phpstan": "^1.10" }, "autoload": { "psr-4": { From 02e028c3873c3a5587a94e7afeb647d352179bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bouc=CC=8Cek?= Date: Sat, 28 Oct 2023 21:35:24 +0200 Subject: [PATCH 2/4] Composer: Remove composer-runtime-api dependency --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 41d6712..a30494b 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,6 @@ ], "require": { "php": ">=7.2", - "composer-runtime-api": "^2.0", "ext-sockets": "*", "ext-iconv": "*" }, From 95a3896e030189cb2b9a52b5d9d491fec89a507d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bouc=CC=8Cek?= Date: Sat, 28 Oct 2023 21:36:11 +0200 Subject: [PATCH 3/4] Composer: Normalize & sort --- composer.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index a30494b..f41f89d 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "name": "jakubboucek/esc-pos", "description": "Native ESC-POS drivers", - "type": "library", "license": "MIT", + "type": "library", "authors": [ { "name": "Jakub Bouček", @@ -11,8 +11,8 @@ ], "require": { "php": ">=7.2", - "ext-sockets": "*", - "ext-iconv": "*" + "ext-iconv": "*", + "ext-sockets": "*" }, "require-dev": { "phpstan/phpstan": "^1.10" @@ -22,6 +22,9 @@ "JakubBoucek\\EscPos\\": "src/" } }, + "config": { + "sort-packages": true + }, "scripts": { "phpstan": "phpstan analyze src -c phpstan.neon --level 6" } From cc6f0ad2728d5dc2101ed2a5081bf3837ad6f2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bouc=CC=8Cek?= Date: Sat, 28 Oct 2023 21:45:16 +0200 Subject: [PATCH 4/4] CI: Update new GH env, add PHP versions up to 8.3 --- .gitattributes | 4 ++ .github/workflows/code-analysis.yaml | 54 ++++++++++++++++++++++++ .github/workflows/code_analysis.yaml | 62 ---------------------------- 3 files changed, 58 insertions(+), 62 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/code-analysis.yaml delete mode 100644 .github/workflows/code_analysis.yaml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..91becc0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +.gitattributes export-ignore +.gitignore export-ignore +.github export-ignore +phpstan.neon export-ignore diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml new file mode 100644 index 0000000..0f758a8 --- /dev/null +++ b/.github/workflows/code-analysis.yaml @@ -0,0 +1,54 @@ +name: Code analysis + +on: + push: + pull_request: + +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + static-analysis: + strategy: + fail-fast: false + matrix: + php: + - "7.2" + - "7.3" + - "7.4" + - "8.0" + - "8.1" + - "8.2" + - "8.3" + name: PHPStan at PHP ${{ matrix.php }} + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer update --no-progress + + - name: Statically analyze code (PHPStan) + run: composer run phpstan -- --ansi diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml deleted file mode 100644 index a43e1e2..0000000 --- a/.github/workflows/code_analysis.yaml +++ /dev/null @@ -1,62 +0,0 @@ -name: Code Analysis - -on: - pull_request: - push: - branches: - - master - -jobs: - code_analysis: - strategy: - fail-fast: false - matrix: - actions: - - name: PHPStan - run: composer phpstan - - php: - - name: PHP 7.3 - version: 7.3 - - - name: PHP 7.4 - version: 7.4 - - - name: PHP 8.0 - version: 8.0 - - name: ${{ matrix.actions.name }} on ${{ matrix.php.name }} - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - # see https://github.com/shivammathur/setup-php - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php.version }} - coverage: none - - - # see https://github.com/actions/cache/blob/main/examples.md#php---composer - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 - with: - path: | - ${{ steps.composer-cache.outputs.dir }} - **/composer.lock - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-composer- - - - - name: Install Composer - run: composer install --no-progress - - - run: ${{ matrix.actions.run }}