7373 - php : ' 8.4'
7474 skip_tests : true
7575
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+
7687 # Extra builds running only the unit tests with different PHP ini settings.
7788 - php : ' 5.5'
7889 os : ' ubuntu-latest'
8293 custom_ini : true
8394
8495 # 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' }})"
8697
8798 continue-on-error : ${{ matrix.php == '8.5' }}
8899
@@ -93,6 +104,70 @@ jobs:
93104 - name : Checkout code
94105 uses : actions/checkout@v4
95106
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+
96171 - name : Setup ini config
97172 id : set_ini
98173 shell : bash
@@ -115,6 +190,9 @@ jobs:
115190 coverage : none
116191 tools : cs2pr
117192
193+ - name : " DEBUG: show libxml loaded version (php)"
194+ run : php -r 'echo "libxml loaded version = ", LIBXML_LOADED_VERSION, PHP_EOL;'
195+
118196 # This action also handles the caching of the dependencies.
119197 - name : Set up node
120198 if : ${{ matrix.custom_ini == false }}
0 commit comments