Repository navigation
118 lines (99 loc) · 3.56 KB
/
Copy pathphpunit.yml
File metadata and controls
118 lines (99 loc) · 3.56 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
110
111
112
113
114
115
116
117
# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: PHPUnit
on: pull_request
permissions:
contents: read
concurrency:
group: phpunit-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
php-policy:
name: PHP versions from root Composer
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.policy.outputs.matrix }}
primary: ${{ steps.policy.outputs.primary }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Read CI PHP matrix and primary from composer.json
id: policy
run: |
php tools/bin/ci-php.php validate
echo "matrix=$(php tools/bin/ci-php.php matrix)" >> "$GITHUB_OUTPUT"
echo "primary=$(php tools/bin/ci-php.php primary)" >> "$GITHUB_OUTPUT"
compatibility:
name: PHP ${{ matrix.php-version }}
runs-on: ubuntu-latest
needs: php-policy
strategy:
matrix:
php-version: ${{ fromJSON(needs.php-policy.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up PHP from Composer matrix
uses: ./.github/actions/setup-project-php
with:
php-version: ${{ matrix.php-version }}
extensions: openssl, dom, soap
ini-file: development
ini-values: disable_functions=
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run unit tests
env:
NFS_TEST_CNPJ: "11222333000181"
NFS_SANDBOX: "true"
run: composer run test:unit
- name: Run integration tests when certificate secrets are present
if: ${{ matrix.php-version == needs.php-policy.outputs.primary }}
env:
NFSE_CLIENT_CERT_B64: ${{ secrets.NFSE_CLIENT_CERT_B64 }}
NFSE_CLIENT_KEY_B64: ${{ secrets.NFSE_CLIENT_KEY_B64 }}
NFS_TEST_CNPJ: "11222333000181"
NFS_SANDBOX: "true"
run: |
if [ -z "$NFSE_CLIENT_CERT_B64" ]; then
echo "NFS-e integration certificate is not configured; skipping."
exit 0
fi
composer run test:integration
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: php-policy
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up PHP from Composer primary
uses: ./.github/actions/setup-project-php
with:
php-version: ${{ needs.php-policy.outputs.primary }}
extensions: openssl, dom, soap
coverage: xdebug
ini-file: development
ini-values: disable_functions=
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Generate coverage
env:
XDEBUG_MODE: coverage
NFS_TEST_CNPJ: "11222333000181"
NFS_SANDBOX: "true"
run: composer run test:coverage
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml --json_path=build/logs/coveralls-upload.json -v