-
Notifications
You must be signed in to change notification settings - Fork 164
109 lines (92 loc) · 3.65 KB
/
Copy pathphp.yml
File metadata and controls
109 lines (92 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: CI
on:
push:
branches: [ master ]
# Sin filtro de ramas: un PR hacia una rama feature (como #275 -> feat/...)
# también debe correr los tests antes de mergearse.
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). Esto es lo que bloquea el merge.
# --------------------------------------------------------------------------
unit:
name: Unit · PHP ${{ matrix.php }}
runs-on: ubuntu-24.04 # ubuntu-22.04 entra en deprecación el 17-09-2026
timeout-minutes: 15
strategy:
fail-fast: false # que el job 7.4 no se cancele si falla el 8.x
matrix:
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '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' }}
# psalm como PHAR: vimeo/psalm ~5.10 en require-dev exige PHP <= 8.2
# e impide instalar dependencias (y probar) en 8.3/8.4.
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 y NO bloquean el merge.
# --------------------------------------------------------------------------
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