-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (119 loc) · 4.67 KB
/
Copy pathtests.yml
File metadata and controls
140 lines (119 loc) · 4.67 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
unit:
if: ${{ !startsWith(github.event.head_commit.message, '[DOC]') }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
php-version: [ '8.2', '8.3', '8.4', '8.5' ]
name: Unit — PHP ${{ matrix.php-version }} (${{ matrix.os }})
steps:
- name: Checkout extension
uses: actions/checkout@v6
with:
path: opcua-client-ext-transport-https
- name: Checkout core (sibling path dependency)
uses: actions/checkout@v6
with:
repository: php-opcua/opcua-client
ref: master
path: opcua-client
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: openssl, curl
coverage: none
- name: Install Composer dependencies
working-directory: opcua-client-ext-transport-https
run: composer install --no-interaction --prefer-dist
- name: Check code style
if: matrix.os == 'ubuntu-latest' && matrix.php-version == '8.5'
working-directory: opcua-client-ext-transport-https
run: composer format:check
- name: Run unit tests
working-directory: opcua-client-ext-transport-https
run: vendor/bin/pest --exclude-group=integration
integration:
if: ${{ !startsWith(github.event.head_commit.message, '[DOC]') }}
runs-on: ubuntu-latest
needs: unit
strategy:
fail-fast: false
matrix:
php-version: [ '8.2', '8.3', '8.4', '8.5' ]
name: Integration — PHP ${{ matrix.php-version }}
steps:
- name: Checkout extension
uses: actions/checkout@v6
with:
path: opcua-client-ext-transport-https
- name: Checkout core (sibling path dependency)
uses: actions/checkout@v6
with:
repository: php-opcua/opcua-client
ref: master
path: opcua-client
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: openssl, curl
coverage: ${{ matrix.php-version == '8.5' && 'xdebug' || 'none' }}
- name: Install Composer dependencies
working-directory: opcua-client-ext-transport-https
run: composer install --no-interaction --prefer-dist
- name: Start OPC UA test servers (uanetstandard-test-suite v1.5.0+)
id: opcua
uses: php-opcua/uanetstandard-test-suite@master
with:
services: opcua-https-binary
- name: Wait for opcua-https-binary to accept requests
run: |
set -e
for i in $(seq 1 60); do
code=$(curl -sk -o /dev/null -w '%{http_code}' -X POST \
-H 'Content-Type: application/octet-stream' \
--data-binary '' \
https://localhost:4852/UA/TestServer || echo "000")
if [ "$code" != "000" ] && [ "$code" != "503" ]; then
echo "opcua-https-binary is ready (HTTP $code after $i attempts)"
exit 0
fi
echo "attempt $i: opcua-https-binary not reachable yet (got '$code'), retrying in 2s..."
sleep 2
done
echo "opcua-https-binary did not become reachable within 120s — capturing server logs"
docker compose -f .uanetstandard-test-suite/docker-compose.yml logs --tail=200 opcua-https-binary || true
exit 1
- name: Run integration tests
working-directory: opcua-client-ext-transport-https
env:
OPCUA_CERTS_DIR: ${{ steps.opcua.outputs.certs-dir }}
run: vendor/bin/pest --group=integration --log-junit=results/junit.xml ${{ matrix.php-version == '8.5' && '--coverage-clover=coverage/clover.xml' || '' }}
- name: Upload coverage to Codecov
if: matrix.php-version == '8.5'
uses: codecov/codecov-action@v6
with:
files: opcua-client-ext-transport-https/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v6
with:
files: opcua-client-ext-transport-https/results/junit.xml
token: ${{ secrets.CODECOV_TOKEN }}
flags: test-results
disable_search: true
- name: Server logs (on failure)
if: failure()
working-directory: .uanetstandard-test-suite
run: docker compose logs --tail=100