-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (88 loc) · 3.8 KB
/
Copy pathinterop.yml
File metadata and controls
98 lines (88 loc) · 3.8 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
name: interop
# Reusable cross-stack interop workflow. A middleware repo calls this from its own PR CI to run the
# php-soap interop suite (PHP middleware against a Dockerised WSS4J oracle) on the exact commit under
# review. Nothing about the branch or repository is hardcoded: the caller is checked out by the standard
# action, which for a pull request resolves the originating commit (forks included). That checkout is the
# package source, so the workflow works on whatever branch is being tested.
on:
workflow_call:
inputs:
package:
description: 'Composer package name of the calling middleware, e.g. php-soap/psr18-wsse-middleware.'
required: true
type: string
suites:
description: 'PHPUnit testsuite(s) to run, e.g. wsse or attachments.'
required: true
type: string
php-versions:
description: 'JSON array of PHP versions to run the matrix on.'
required: false
type: string
default: '["8.4", "8.5"]'
jobs:
interop:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ${{ fromJSON(inputs.php-versions) }}
name: ${{ inputs.suites }} on PHP ${{ matrix.php }}
steps:
# The calling middleware at the commit under review. A plain checkout in a reusable workflow pulls
# the caller; for a pull request it resolves the originating repository and ref (forks included).
- name: Checkout the middleware under test
uses: actions/checkout@v7
with:
path: middleware
- name: Checkout the interop harness
uses: actions/checkout@v7
with:
repository: php-soap/java-interop
path: harness
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, openssl, intl, gmp, bcmath
coverage: none
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
- name: Cache Maven repository
uses: actions/cache@v6
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('harness/oracle/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-
- name: Build and start the oracle
run: |
mvn -B -f harness/oracle/pom.xml -DskipTests package
docker build -t java-interop-oracle harness
bash harness/certs/generate.sh
docker run -d --name oracle -p 8080:8080 -v "$PWD/harness/certs:/certs" java-interop-oracle
for i in $(seq 1 30); do
if curl -fsS http://127.0.0.1:8080/health >/dev/null 2>&1; then echo "oracle healthy"; break; fi
sleep 1
done
# Point the harness at the checked-out middleware. The checkout above is the code under test for whatever
# ref triggered the run: a branch, a tag, or a pull request merge. Put it on a fixed local branch so the
# path repository always presents it as dev-interop-ref, independent of the ref name. This is what makes
# tags work: a tag like 0.10.0 would otherwise normalise to 0.10.0.x-dev and not match a dev constraint.
- name: Resolve the middleware from the checkout
working-directory: harness
env:
PACKAGE: ${{ inputs.package }}
run: |
git -C ../middleware checkout -B interop-ref
composer config repositories.middleware path ../middleware
composer require "$PACKAGE:dev-interop-ref" --no-update
composer update --with-all-dependencies --no-interaction --no-progress
- name: Run interop tests
working-directory: harness
run: vendor/bin/phpunit --testsuite ${{ inputs.suites }}
- name: Oracle logs (on failure)
if: failure()
run: docker logs oracle || true