Skip to content

Commit

Permalink
Apply code style, add psalm (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk authored Oct 24, 2024
2 parents 40eec53 + 1532590 commit e7289b8
Show file tree
Hide file tree
Showing 43 changed files with 686 additions and 261 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/cs-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---

on: # yamllint disable-line rule:truthy
push:
branches:
- '*'

name: Fix Code Style

jobs:
cs-fix:
permissions:
contents: write
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master

...
71 changes: 71 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---

on:
push:
branches:
- '4.*'
paths:
- 'src/**'
- '.php-cs-fixer.dist.php'
- 'psalm*'
- 'composer.*'
pull_request:
paths:
- 'src/**'
- '.php-cs-fixer.dist.php'
- 'psalm*'
- 'composer.*'

name: Static analysis

jobs:
psalm:
timeout-minutes: 4
runs-on: ${{ matrix.os }}
concurrency:
cancel-in-progress: true
group: psalm-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
php-version:
- '8.2'
dependencies:
- locked
steps:
- name: 📦 Check out the codebase
uses: actions/[email protected]

- name: 🛠️ Setup PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php-version }}
extensions: none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, sockets, opcache, pcntl, posix, pdo
ini-values: error_reporting=E_ALL
coverage: none

- name: 🛠️ Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: 🤖 Validate composer.json and composer.lock
run: composer validate --ansi --strict

- name: 🔍 Get composer cache directory
uses: wayofdev/gh-actions/actions/composer/[email protected]

- name: ♻️ Restore cached dependencies installed with composer
uses: actions/[email protected]
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-

- name: 📥 Install "${{ matrix.dependencies }}" dependencies
uses: wayofdev/gh-actions/actions/composer/[email protected]
with:
dependencies: ${{ matrix.dependencies }}

- name: 🔍 Run static analysis using vimeo/psalm
run: composer psalm:ci
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"cs:fix": "php-cs-fixer fix -v",
"psalm": "psalm",
"psalm:baseline": "psalm --set-baseline=psalm-baseline.xml",
"psalm:ci": "psalm --output-format=github --shepherd --show-info=false --stats --threads=4",
"test": "phpunit --color=always"
},
"minimum-stability": "dev",
Expand Down
Loading

0 comments on commit e7289b8

Please sign in to comment.