Skip to content

Commit

Permalink
ref: docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bernard-ng committed Mar 6, 2025
1 parent 55c99f5 commit fbe2bec
Show file tree
Hide file tree
Showing 43 changed files with 1,190 additions and 331 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,32 @@ name: Lint
on: [push, pull_request]
jobs:
lint:
name: PHP Lint
name: Code Style
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.3', '8.4' ]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
php-version: ${{ matrix.php }}

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}

- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- uses: actions/checkout@v4
- name: lint
run: make lint
- name: Run code quality analysis
run: composer app:cs
24 changes: 18 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
name: Test
on: [push, pull_request]
jobs:
lint:
name: PHP Test
test:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.3', '8.4' ]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
php-version: {{ matrix.php }}

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}

- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- uses: actions/checkout@v4
- name: test
run: make test
run: composer app:test
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@
"rector/rector": "^1.2"
},
"scripts": {
"lint": "vendor/bin/ecs check --ansi",
"lint-fix": "vendor/bin/ecs check --fix --ansi",
"test": "vendor/bin/phpunit"
"app:cs": [
"vendor/bin/ecs check --ansi",
"vendor/bin/phpstan analyse --ansi",
"vendor/bin/rector --dry-run --ansi"
],
"app:test": "vendor/bin/phpunit"
}
}
Loading

0 comments on commit fbe2bec

Please sign in to comment.