Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/actions/check-analysis/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: check-analysis
description: Verify static analysis results and provide a summary report

inputs:
phpstan_exit_code:
description: "Exit code from PHPStan analysis"
required: true
pint_exit_code:
description: "Exit code from Laravel Pint analysis"
required: true

runs:
using: "composite"
steps:
- name: Check analysis results
shell: bash
run: |
echo "### Static Analysis Results 🔍" >> $GITHUB_STEP_SUMMARY

# Handle empty values with defaults
PHPSTAN_CODE="${{ inputs.phpstan_exit_code }}"
PINT_CODE="${{ inputs.pint_exit_code }}"

# Set default values if empty
[ -z "$PHPSTAN_CODE" ] && PHPSTAN_CODE="1" && echo "Warning: PHPStan exit code was empty, using default 1"
[ -z "$PINT_CODE" ] && PINT_CODE="1" && echo "Warning: Laravel Pint exit code was empty, using default 1"

echo "Using PHPStan exit code: $PHPSTAN_CODE"
echo "Using Laravel Pint exit code: $PINT_CODE"

FAIL=0

if [ "$PHPSTAN_CODE" = "0" ]; then
echo "✅ PHPStan: PASSED" >> $GITHUB_STEP_SUMMARY
else
echo "❌ PHPStan: FAILED (exit code: $PHPSTAN_CODE)" >> $GITHUB_STEP_SUMMARY
FAIL=1
fi

if [ "$PINT_CODE" = "0" ]; then
echo "✅ Laravel Pint: PASSED" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Laravel Pint: FAILED (exit code: $PINT_CODE)" >> $GITHUB_STEP_SUMMARY
FAIL=1
fi

if [ "$FAIL" = "1" ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "⚠️ One or more analyses have failed. Please review the errors above." >> $GITHUB_STEP_SUMMARY
exit 1
else
echo "" >> $GITHUB_STEP_SUMMARY
echo "🎉 All static analysis checks passed successfully!" >> $GITHUB_STEP_SUMMARY
fi
40 changes: 40 additions & 0 deletions .github/actions/composer-setup-dev/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# .github/actions/composer-setup-dev/action.yml
name: composer-setup-dev
description: Setup PHP and install dependencies with Composer (development environment)

runs:
using: "composite"

steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer

- name: Cache vendor directory
id: cache-vendor
uses: actions/cache@v4
with:
path: vendor
key: vendor-dev-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Cache Composer packages
if: steps.cache-vendor.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: composer-cache-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-cache-${{ runner.os }}-

- name: Install Composer dependencies
if: steps.cache-vendor.outputs.cache-hit != 'true'
run: composer install --ignore-platform-reqs
shell: bash

- name: Verify Composer dependencies integrity
if: steps.cache-vendor.outputs.cache-hit == 'true'
run: composer dump-autoload --no-interaction
shell: bash

38 changes: 38 additions & 0 deletions .github/actions/composer-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# .github/actions/composer-setup/action.yml
name: composer-setup
description: Setup PHP and install dependencies with Composer
runs:
using: "composite"

steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer

- name: Cache vendor directory
id: cache-vendor
uses: actions/cache@v4
with:
path: vendor
key: vendor-prod-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Cache Composer packages
if: steps.cache-vendor.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: composer-cache-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-cache-${{ runner.os }}-

- name: Install Composer dependencies
if: steps.cache-vendor.outputs.cache-hit != 'true'
run: composer install --ignore-platform-reqs --no-dev --optimize-autoloader
shell: bash

- name: Verify Composer dependencies integrity
if: steps.cache-vendor.outputs.cache-hit == 'true'
run: composer dump-autoload --optimize --no-dev --no-interaction
shell: bash
19 changes: 19 additions & 0 deletions .github/actions/laravel-pint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# .github/actions/laravel-pint/action.yml
name: laravel-pint
description: Run Laravel Pint static analysis.
outputs:
exit_code:
description: "Exit code from Laravel Pint execution"
value: ${{ steps.run_pint.outputs.exit_code }}

runs:
using: "composite"
steps:
- name: Run Laravel Pint
id: run_pint
shell: bash
run: |-
php devops/laravel-pint/analyzer.php
PINT_EXIT_CODE=$?
echo "Laravel Pint completed with exit code: $PINT_EXIT_CODE"
echo "exit_code=$PINT_EXIT_CODE" >> $GITHUB_OUTPUT
42 changes: 42 additions & 0 deletions .github/actions/npm-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# .github/actions/npm-build/action.yml
name: npm-build
description: Setup Node.js, install dependencies, and build project with optimized caching

runs:
using: "composite"
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Cache npm
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-${{ runner.os }}-

- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
shell: bash

- name: Verify dependencies integrity
if: steps.cache-node-modules.outputs.cache-hit == 'true'
run: npm ls --depth=0 || true
shell: bash

- name: Build project
run: npm run build
shell: bash

19 changes: 19 additions & 0 deletions .github/actions/phpstan/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# .github/actions/phpstan/action.yml
name: phpstan
description: Run PHPStan static analysis.
outputs:
exit_code:
description: "Exit code from PHPStan execution"
value: ${{ steps.run_phpstan.outputs.exit_code }}

runs:
using: "composite"
steps:
- name: Run PHPStan
id: run_phpstan
shell: bash
run: |-
php devops/phpstan/analyzer.php
PHPSTAN_EXIT_CODE=$?
echo "PHPStan completed with exit code: $PHPSTAN_EXIT_CODE"
echo "exit_code=$PHPSTAN_EXIT_CODE" >> $GITHUB_OUTPUT
16 changes: 16 additions & 0 deletions .github/actions/prepare-analysis-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: prepare-analysis-env
description: Prepare environment for static analysis

runs:
using: "composite"
steps:
- name: Prepare environment
shell: bash
run: |-
chmod +x vendor/bin/*
git config --global --add safe.directory $GITHUB_WORKSPACE
git fetch origin development
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
echo "HEAD commit: $(git rev-parse HEAD)"
echo "PR commits between development and HEAD:"
git log --oneline origin/development..HEAD
45 changes: 0 additions & 45 deletions .github/workflows/phpmd.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/phpstan.yml

This file was deleted.

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

This file was deleted.

Loading