Skip to content

Commit bb7637f

Browse files
committed
Add CI/CD and code quality tools
- Add GitHub Actions workflows for tests and code style - Configure PHPStan for static analysis - Configure Pint for code formatting - Add issue templates for bug reports and features
1 parent cb7e43f commit bb7637f

7 files changed

Lines changed: 275 additions & 0 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Bug Report
2+
description: Report an issue with Nova Dependency Container
3+
body:
4+
- type: markdown
5+
attributes:
6+
value: |
7+
Thanks for taking the time to fill out this bug report!
8+
- type: textarea
9+
id: bug-description
10+
attributes:
11+
label: Bug description
12+
description: A clear and concise description of what the bug is.
13+
validations:
14+
required: true
15+
- type: textarea
16+
id: steps-to-reproduce
17+
attributes:
18+
label: Steps to reproduce
19+
description: Steps to reproduce the behavior.
20+
placeholder: |
21+
1. Install the package
22+
2. Add dependency container to resource
23+
3. Set dependency on field
24+
4. See error
25+
validations:
26+
required: true
27+
- type: textarea
28+
id: expected-behavior
29+
attributes:
30+
label: Expected behavior
31+
description: A clear and concise description of what you expected to happen.
32+
validations:
33+
required: true
34+
- type: dropdown
35+
id: nova-version
36+
attributes:
37+
label: Nova version
38+
options:
39+
- Nova 5.x
40+
- Nova 4.x
41+
- Other
42+
validations:
43+
required: true
44+
- type: dropdown
45+
id: laravel-version
46+
attributes:
47+
label: Laravel version
48+
options:
49+
- Laravel 12.x
50+
- Laravel 11.x
51+
- Laravel 10.x
52+
- Other
53+
validations:
54+
required: true
55+
- type: dropdown
56+
id: php-version
57+
attributes:
58+
label: PHP version
59+
options:
60+
- PHP 8.3
61+
- PHP 8.2
62+
- PHP 8.1
63+
- Other
64+
validations:
65+
required: true
66+
- type: textarea
67+
id: additional-context
68+
attributes:
69+
label: Additional context
70+
description: Add any other context about the problem here.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Feature Request
2+
description: Suggest an idea for Nova Dependency Container
3+
body:
4+
- type: markdown
5+
attributes:
6+
value: |
7+
Thanks for taking the time to suggest a new feature!
8+
- type: textarea
9+
id: feature-description
10+
attributes:
11+
label: Feature description
12+
description: A clear and concise description of what you want to happen.
13+
validations:
14+
required: true
15+
- type: textarea
16+
id: problem-solving
17+
attributes:
18+
label: Problem it solves
19+
description: Is your feature request related to a problem? Please describe.
20+
placeholder: I'm always frustrated when...
21+
validations:
22+
required: false
23+
- type: textarea
24+
id: alternatives
25+
attributes:
26+
label: Alternatives considered
27+
description: Describe alternatives you've considered.
28+
validations:
29+
required: false
30+
- type: textarea
31+
id: additional-context
32+
attributes:
33+
label: Additional context
34+
description: Add any other context or screenshots about the feature request here.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Fix PHP code style issues
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
php-code-style:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.head_ref }}
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: 8.3
26+
extensions: dom, curl, libxml, mbstring, zip
27+
coverage: none
28+
29+
- name: Install Pint
30+
run: composer global require laravel/pint
31+
32+
- name: Run Pint
33+
run: pint
34+
35+
- name: Commit changes
36+
uses: stefanzweifel/git-auto-commit-action@v5
37+
with:
38+
commit_message: Fix styling

.github/workflows/phpstan.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: PHPStan
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'phpstan.neon.dist'
8+
pull_request:
9+
paths:
10+
- '**.php'
11+
- 'phpstan.neon.dist'
12+
13+
jobs:
14+
phpstan:
15+
name: phpstan
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 5
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: '8.3'
25+
extensions: dom, curl, libxml, mbstring, zip
26+
coverage: none
27+
28+
- name: Install composer dependencies
29+
uses: ramsey/composer-install@v3
30+
31+
- name: Run PHPStan
32+
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/run-tests.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: run-tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
timeout-minutes: 5
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
os: [ubuntu-latest]
17+
php: [8.3]
18+
laravel: [11.*, 12.*]
19+
stability: [prefer-stable]
20+
include:
21+
- laravel: 11.*
22+
testbench: ^9.0
23+
- laravel: 12.*
24+
testbench: ^9.0
25+
26+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Setup PHP
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php }}
36+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
37+
coverage: none
38+
39+
- name: Setup problem matchers
40+
run: |
41+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
42+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
43+
44+
- name: Install dependencies
45+
run: |
46+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
47+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
48+
49+
- name: List Installed Dependencies
50+
run: composer show -D
51+
52+
- name: Execute tests
53+
run: vendor/bin/pest --ci

phpstan.neon.dist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
parameters:
2+
paths:
3+
- src
4+
5+
level: 5
6+
7+
excludePaths:
8+
- src/Stubs
9+
- src/NovaDependencyContainer.php
10+
11+
ignoreErrors:
12+
- '#Trait.*is used zero times#'
13+
- '#Call to static method.*on an unknown class Laravel\\Nova\\Nova#'

pint.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"preset": "laravel",
3+
"rules": {
4+
"blank_line_after_namespace": true,
5+
"blank_line_after_opening_tag": true,
6+
"blank_line_before_statement": {
7+
"statements": ["break", "continue", "declare", "return", "throw", "try"]
8+
},
9+
"braces": {
10+
"allow_single_line_anonymous_class_with_empty_body": true,
11+
"allow_single_line_closure": true,
12+
"position_after_anonymous_constructs": "next",
13+
"position_after_control_structures": "same",
14+
"position_after_functions_and_oop_constructs": "next"
15+
},
16+
"class_attributes_separation": {
17+
"elements": {
18+
"method": "one"
19+
}
20+
},
21+
"concat_space": {
22+
"spacing": "one"
23+
},
24+
"declare_strict_types": true,
25+
"no_unused_imports": true,
26+
"not_operator_with_successor_space": true,
27+
"ordered_imports": {
28+
"sort_algorithm": "alpha"
29+
},
30+
"phpdoc_scalar": true,
31+
"phpdoc_single_line_var_spacing": true,
32+
"phpdoc_var_without_name": true,
33+
"single_trait_insert_per_statement": true
34+
}
35+
}

0 commit comments

Comments
 (0)