Repository navigation
125 lines (118 loc) · 4.56 KB
/
Copy pathcheck.yml
File metadata and controls
125 lines (118 loc) · 4.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
118
119
120
121
122
123
124
125
name: check
permissions:
contents: read
# Cancel superseded pull-request runs instead of letting them finish.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
workflow_dispatch:
jobs:
test-php:
name: Test on php ${{ matrix.php-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php-version: ["8.2", "8.3", "8.4", "8.5"]
os: [ubuntu-latest]
coverage-extension: [pcov]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Use php ${{ matrix.php-version }}
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php-version }}
coverage: ${{ matrix.coverage-extension }}
extensions: pcre
ini-values: display_errors=on, error_reporting=-1, zend.assertions=1
- name: List php modules
run: php -m
- name: List php modules using "no php ini" mode
run: php -m -n
- name: Cache module
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.composer/cache/
key: composer-${{ matrix.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.json') }}
restore-keys: composer-${{ matrix.os }}-${{ matrix.php-version }}-
- name: Install dependencies
env:
GH_TOKEN: ${{ github.token }}
run: make deps
- name: Validate composer.json
run: composer validate --strict --no-check-lock
- name: Audit dependencies for known advisories
run: composer audit
- name: Run all tests
run: make qa-coverage
- name: Run the example
run: php example/index.php > /dev/null
# make install, resources/autoload.php and the packaging descriptors are
# what reaches RPM/DEB users; nothing else in CI touches them. Install into
# a throwaway prefix and load the library through the shipped autoloader,
# which only resolves in the installed layout.
- name: Packaging smoke test
if: matrix.os == 'ubuntu-latest'
run: |
DESTDIR="$(mktemp -d)"
make install DESTDIR="$DESTDIR"
cat > "$DESTDIR/smoke.php" <<'SMOKE'
<?php
require \getenv('DESTDIR') . '/usr/share/php/Com/Tecnick/Pdf/Parser/autoload.php';
foreach ([
'Com\Tecnick\Pdf\Parser\Exception',
'Com\Tecnick\Pdf\Parser\Parser',
] as $class) {
if (!\class_exists($class)) {
\fwrite(\STDERR, 'the installed autoloader cannot load ' . $class . \PHP_EOL);
exit(1);
}
}
echo 'installed layout loads every class', \PHP_EOL;
SMOKE
DESTDIR="$DESTDIR" php "$DESTDIR/smoke.php"
- name: Send coverage
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
flags: php-${{ matrix.php-version }}-${{ matrix.os }}
name: php-${{ matrix.php-version }}-${{ matrix.os }}
test-lowest:
name: Test lowest supported dependencies on php 8.2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Use php 8.2
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: "8.2"
coverage: none
extensions: pcre
ini-values: display_errors=on, error_reporting=-1, zend.assertions=1
- name: Cache module
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.composer/cache/
key: composer-lowest-${{ hashFiles('composer.json') }}
restore-keys: composer-lowest-
# composer.lock is not committed, so the default install always resolves
# to the top of every declared range. Pin the bottom of the ranges here.
- name: Install lowest supported dependencies
env:
GH_TOKEN: ${{ github.token }}
run: composer update --prefer-lowest --prefer-stable --no-interaction
- name: Run unit tests
run: composer run test