Skip to content

Actualizar CI

Actualizar CI #231

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
# Cancela el run anterior cuando se hace push de nuevo al mismo PR/rama.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# --------------------------------------------------------------------------
# Tests deterministas (sin red).
# --------------------------------------------------------------------------
unit:
name: Unit · PHP ${{ matrix.php }}
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
php: [ '7.4', '8.2', '8.4' ]
include:
- php: '7.4'
coverage: true
steps:
- uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, curl, soap, dom, xsl, zip, :fileinfo
# pcov solo donde se reporta cobertura; en el resto 'none' (más rápido)
coverage: ${{ matrix.coverage && 'pcov' || 'none' }}
tools: composer:v2, psalm:5
- name: Validate composer.json
run: composer validate --strict
- name: Install dependencies (con caché)
uses: ramsey/composer-install@v4
with:
composer-options: --prefer-dist --no-progress
- name: PHPStan
run: composer run-script lint:ci
- name: Psalm
if: ${{ matrix.coverage }}
run: psalm --shepherd --no-progress
- name: Unit tests
if: ${{ !matrix.coverage }}
run: vendor/bin/phpunit --exclude-group integration,manual
- name: Unit tests + coverage
if: ${{ matrix.coverage }}
run: vendor/bin/phpunit --exclude-group integration,manual --coverage-clover clover.xml
- name: Upload coverage
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v7
with:
files: ./clover.xml
flags: unittests
name: codecov-greenter
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
# --------------------------------------------------------------------------
# Tests de integración contra SUNAT beta / GRE (nubefact). Dependen de
# servicios externos: se ejecutan aparte.
# --------------------------------------------------------------------------
integration:
name: Integración SUNAT beta (informativo)
runs-on: ubuntu-24.04
timeout-minutes: 20
continue-on-error: true
# En PRs de forks no hay secrets ni sentido de golpear SUNAT; correr solo
# en push a master, PRs internos o manualmente.
if: >-
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, curl, soap, dom, xsl, zip, :fileinfo
coverage: none
tools: composer:v2
- name: Install dependencies (con caché)
uses: ramsey/composer-install@v4
- name: Integration tests
run: vendor/bin/phpunit --group integration --exclude-group manual