73
73
- php : ' 8.4'
74
74
skip_tests : true
75
75
76
+ # The default libxml library on Ubuntu images is a little out of date.
77
+ # To safeguard support for the latest libxml we need to update the library on the fly.
78
+ # This only needs to be tested with one PHP version for each libxml minor to verify support.
79
+ # Testing against multiple PHP versions would not yield a difference in results.
80
+ - php : ' 8.0'
81
+ os : ' ubuntu-latest'
82
+ libxml_minor : ' 2.11'
83
+ - php : ' 8.3'
84
+ os : ' ubuntu-latest'
85
+ libxml_minor : ' 2.13'
86
+
76
87
# Extra builds running only the unit tests with different PHP ini settings.
77
88
- php : ' 5.5'
78
89
os : ' ubuntu-latest'
82
93
custom_ini : true
83
94
84
95
# yamllint disable-line rule:line-length
85
- name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
96
+ name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}${{ matrix.libxml_minor && format( ' with libxml {0}', matrix.libxml_minor ) || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
86
97
87
98
continue-on-error : ${{ matrix.php == '8.5' }}
88
99
@@ -93,6 +104,70 @@ jobs:
93
104
- name : Checkout code
94
105
uses : actions/checkout@v4
95
106
107
+ - name : " libxml2: find the latest relevant tag"
108
+ if : ${{ matrix.libxml_minor }}
109
+ id : libxml_version
110
+ uses : oprypin/find-latest-tag@v1
111
+ with :
112
+ repository : GNOME/libxml2
113
+ releases-only : false # The libxml2 repository doesn't use GitHub's "release" feature.
114
+ prefix : ' v${{ matrix.libxml_minor }}.' # Limit the result to the minor we're interested in.
115
+ sort-tags : true # Find the "greatest" version for that minor based on semver.
116
+
117
+ # To put it simply: we need to remove the 'v' prefix from the version number.
118
+ - name : " libxml2: parse the version to a patch version"
119
+ if : ${{ matrix.libxml_minor }}
120
+ id : libxml_patch_version
121
+ shell : bash
122
+ env :
123
+ TAG : ${{ steps.libxml_version.outputs.tag }}
124
+ run : echo "PATCH=$( echo "$TAG" | cut -b 2- )" >> "$GITHUB_OUTPUT"
125
+
126
+ - name : " libxml2: restore cache"
127
+ if : ${{ matrix.libxml_minor }}
128
+ id : libxml_cache_restore
129
+ uses : actions/cache/restore@v4
130
+ with :
131
+ path : " libxml2-${{ steps.libxml_patch_version.outputs.PATCH }}"
132
+ key : " ${{ matrix.os }}-libxml-${{ matrix.libxml_minor }}-${{ steps.libxml_patch_version.outputs.PATCH }}"
133
+
134
+ # Updating the lists can fail intermittently, typically after Microsoft has released a new package.
135
+ # This should not be blocking for this job, so ignore any errors from this step.
136
+ # Ref: https://github.com/dotnet/core/issues/4167
137
+ - name : " libxml2: Update the available packages list"
138
+ if : ${{ matrix.libxml_minor && steps.libxml_cache_restore.outputs.cache-hit != 'true' }}
139
+ continue-on-error : true
140
+ run : sudo apt-get update
141
+
142
+ - name : " libxml2: Download and build package (linux only)"
143
+ if : ${{ matrix.libxml_minor && steps.libxml_cache_restore.outputs.cache-hit != 'true' }}
144
+ env :
145
+ PATCH : ${{ steps.libxml_patch_version.outputs.PATCH }}
146
+ run : |
147
+ sudo apt-get install -y wget build-essential
148
+ wget "https://download.gnome.org/sources/libxml2/${{ matrix.libxml_minor }}/libxml2-$PATCH.tar.xz"
149
+ tar -xf "libxml2-$PATCH.tar.xz"
150
+ cd "libxml2-$PATCH"
151
+ ./configure --prefix=/usr/local
152
+ make
153
+
154
+ - name : " libxml2: save cache"
155
+ if : ${{ matrix.libxml_minor && steps.libxml_cache_restore.outputs.cache-hit != 'true' }}
156
+ id : libxml_cache_save
157
+ uses : actions/cache/save@v4
158
+ with :
159
+ path : " libxml2-${{ steps.libxml_patch_version.outputs.PATCH }}"
160
+ key : ${{ steps.libxml_cache_restore.outputs.cache-primary-key }}
161
+
162
+ - name : " libxml2: Install package (linux only)"
163
+ if : ${{ matrix.libxml_minor }}
164
+ env :
165
+ PATCH : ${{ steps.libxml_patch_version.outputs.PATCH }}
166
+ run : |
167
+ cd "libxml2-$PATCH"
168
+ sudo make install
169
+ sudo ldconfig
170
+
96
171
- name : Setup ini config
97
172
id : set_ini
98
173
shell : bash
@@ -115,6 +190,9 @@ jobs:
115
190
coverage : none
116
191
tools : cs2pr
117
192
193
+ - name : " DEBUG: show libxml loaded version (php)"
194
+ run : php -r 'echo "libxml loaded version = ", LIBXML_LOADED_VERSION, PHP_EOL;'
195
+
118
196
# This action also handles the caching of the dependencies.
119
197
- name : Set up node
120
198
if : ${{ matrix.custom_ini == false }}
0 commit comments