39 lines
817 B
YAML
39 lines
817 B
YAML
name: CI/CD Pipeline for PHP
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: 8.3
|
|
tools: composer
|
|
|
|
- name: Install dependencies
|
|
run: composer install
|
|
|
|
- name: Lint PHP files
|
|
run: |
|
|
composer require --dev squizlabs/php_codesniffer
|
|
./vendor/bin/phpcs --standard=PSR12 src/
|
|
|
|
- name: Run tests
|
|
run: |
|
|
if [ -f vendor/bin/phpunit ]; then
|
|
vendor/bin/phpunit --verbose
|
|
else
|
|
echo "PHPUnit no está instalado o no hay pruebas configuradas."
|
|
fi
|