Skip to content

Commit

Permalink
Updated the testing strategies to larastan, rector and pint and added…
Browse files Browse the repository at this point in the history
… scripts to composer for ease of access [i got the insperation from the pinkary project].
  • Loading branch information
abdelhamiderrahmouni committed Sep 12, 2024
1 parent 915601b commit 615bf29
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 76 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/larastan.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/pint.yml

This file was deleted.

50 changes: 16 additions & 34 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,37 @@
name: run-tests
name: Tests

on:
push:
paths:
- '**.php'
- '.github/workflows/run-tests.yml'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
on: ['push', 'pull_request']

jobs:
test:
ci:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.3, 8.2]
laravel: [11.*]
stability: [prefer-stable]
include:
- laravel: 11.*
testbench: 9.*
carbon: ^2.63
os: [ubuntu-latest] # (macos-latest, windows-latest) 3.x-dev is under development
php: ['8.3']
dependency-version: [prefer-lowest, prefer-stable]
parallel: ['', '--parallel']

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }} - ${{ matrix.parallel }}

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
tools: composer:v2
coverage: none

- name: Setup problem matchers
- name: Setup Problem Matches
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 }}" "nesbot/carbon:${{ matrix.os == 'windows-latest' && '^^^' || '' }}${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List Installed Dependencies
run: composer show -D
- name: Install PHP dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --no-progress --ansi

- name: Execute tests
run: vendor/bin/pest --ci
- name: Unit Tests
run: composer test:unit
32 changes: 32 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Static Analysis

on: ['push', 'pull_request']

jobs:
static:
name: Static Tests

runs-on: ubuntu-latest
strategy:
matrix:
dependency-version: [prefer-lowest, prefer-stable]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer:v2
coverage: none

- name: Install Dependencies
run: composer update --prefer-stable --no-interaction --no-progress --ansi

- name: Types
run: composer test:types

- name: Style
run: composer test:lint
19 changes: 18 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
"pestphp/pest": "^2.35",
"pestphp/pest-plugin-arch": "^2.7",
"pestphp/pest-plugin-laravel": "^2.4",
"pestphp/pest-plugin-type-coverage": "^3.0.0",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan-phpunit": "^1.4"
"phpstan/phpstan-phpunit": "^1.4",
"rector/rector": "^1.2.5"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -87,6 +89,21 @@
],
"pint": [
"pint"
],
"lint": "pint",
"refactor": "rector",
"test:lint": "pint --test",
"test:refactor": "rector --dry-run",
"test:types": "phpstan analyse",
"test:arch": "pest --filter=arch",
"test:type-coverage": "pest --type-coverage --min=100",
"test:unit": "pest --parallel --coverage --min=100",
"test": [
"@test:lint",
"@test:refactor",
"@test:types",
"@test:type-coverage",
"@test:unit"
]
},
"extra": {
Expand Down

0 comments on commit 615bf29

Please sign in to comment.