GHA/windows: install Win32::Process* perl modules

To make the CI jobs use native Win32 API calls instead of calling
external tools to look up and kill PIDs of native Windows test server
processes.

Follow-up to 2388b0e587 #18308
Closes #18296
This commit is contained in:
Viktor Szakats 2025-08-15 19:46:28 +02:00
parent b48997ba7b
commit 52775a7fb4
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201

View file

@ -41,6 +41,60 @@ env:
CURL_CI: github
jobs:
build-cache:
name: 'Build caches'
runs-on: ${{ matrix.image }}
timeout-minutes: 15
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
image: [windows-2022, windows-11-arm]
steps:
- name: 'cache perl packages'
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
id: cache-perl-win32-pkgs
env:
cache-name: cache-perl-win32-pkgs
with:
path: C:\perl-win32-pkgs
key: ${{ runner.os }}-${{ runner.arch }}-build-${{ env.cache-name }}
- name: 'install build prereqs'
if: ${{ steps.cache-perl-win32-pkgs.outputs.cache-hit != 'true' }}
uses: msys2/setup-msys2@40677d36a502eb2cf0fb808cc9dec31bf6152638 # v2
with:
msystem: msys
install: gcc make
- name: 'build perl packages'
if: ${{ steps.cache-perl-win32-pkgs.outputs.cache-hit != 'true' }}
run: |
cd /c
mkdir perl-win32-pkgs
cd perl-win32-pkgs
sed -i.bak 's/#define I_CRYPT//g' /usr/lib/perl5/core_perl/CORE/config.h
# https://metacpan.org/pod/Win32::Process
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 6 --retry-connrefused \
--location "https://cpan.metacpan.org/authors/id/J/JD/JDB/Win32-Process-0.17.tar.gz" | tar -xz
cd Win32-Process-0.17
perl Makefile.PL
sed -i.bak 's/-lcrypt//g' Makefile
make
cd ..
# https://metacpan.org/pod/Win32::Process::List
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 6 --retry-connrefused \
--location "https://cpan.metacpan.org/authors/id/R/RP/RPAGITSCH/Win32-Process-List-0.09.tar.gz" | tar -xz
cd Win32-Process-List-0.09
perl Makefile.PL
sed -i.bak 's/-lcrypt//g' Makefile
make
cd ..
cygwin:
name: "cygwin, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.platform }} ${{ matrix.name }}"
runs-on: windows-2022
@ -187,6 +241,8 @@ jobs:
msys2: # both msys and mingw-w64
name: "${{ matrix.sys == 'msys' && 'msys2' || 'mingw' }}, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.env }} ${{ matrix.name }} ${{ matrix.test }}"
needs:
- build-cache
runs-on: ${{ matrix.image || 'windows-2022' }}
timeout-minutes: 15
defaults:
@ -366,6 +422,35 @@ jobs:
mv bld/tests/unit/.libs/*.exe bld/tests/unit || true
fi
- name: 'cache perl packages'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' && matrix.sys != 'msys' }}
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
id: cache-perl-win32-pkgs
env:
cache-name: cache-perl-win32-pkgs
with:
path: C:\perl-win32-pkgs
key: ${{ runner.os }}-${{ runner.arch }}-build-${{ env.cache-name }}
- name: 'install test prereqs perl'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 5
run: &perl-win32-pkgs-install |
if [ -d /c/perl-win32-pkgs ]; then
cd /c/perl-win32-pkgs
cd Win32-Process-0.17
install -D blib/arch/auto/Win32/Process/Process.dll /usr/lib/perl5/site_perl/auto/Win32/Process/Process.dll
install -D blib/lib/Win32/Process.pm /usr/lib/perl5/site_perl/Win32/Process.pm
cd ..
cd Win32-Process-List-0.09
install -D blib/arch/auto/Win32/Process/List/List.dll /usr/lib/perl5/site_perl/auto/Win32/Process/List/List.dll
install -D blib/lib/auto/Win32/Process/List/autosplit.ix /usr/lib/perl5/site_perl/auto/Win32/Process/List/autosplit.ix
install -D blib/lib/Win32/Process/List.pm /usr/lib/perl5/site_perl/Win32/Process/List.pm
install -D blib/lib/Win32/Process/processes.pl /usr/lib/perl5/site_perl/Win32/Process/processes.pl
cd ..
cd ..
fi
- name: 'install test prereqs'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 5
@ -414,6 +499,8 @@ jobs:
mingw-w64-standalone-downloads:
name: 'dl-mingw, CM ${{ matrix.ver }}-${{ matrix.env }} ${{ matrix.name }}'
needs:
- build-cache
runs-on: windows-2022
timeout-minutes: 15
defaults:
@ -562,6 +649,21 @@ jobs:
PATH="/d/my-cache/${MATRIX_DIR}/bin:$PATH"
cmake --build bld --target testdeps
- name: 'cache perl packages'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
id: cache-perl-win32-pkgs
env:
cache-name: cache-perl-win32-pkgs
with:
path: C:\perl-win32-pkgs
key: ${{ runner.os }}-${{ runner.arch }}-build-${{ env.cache-name }}
- name: 'install test prereqs perl'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 5
run: *perl-win32-pkgs-install
- name: 'install test prereqs'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 5
@ -697,6 +799,8 @@ jobs:
msvc:
name: 'msvc, CM ${{ matrix.arch }}-${{ matrix.plat }} ${{ matrix.name }}'
needs:
- build-cache
runs-on: ${{ matrix.image || 'windows-2022' }}
timeout-minutes: 15
defaults:
@ -924,6 +1028,21 @@ jobs:
timeout-minutes: 10
run: cmake --build bld --config "${MATRIX_TYPE}" --parallel 5 --target testdeps
- name: 'cache perl packages'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
id: cache-perl-win32-pkgs
env:
cache-name: cache-perl-win32-pkgs
with:
path: C:\perl-win32-pkgs
key: ${{ runner.os }}-${{ runner.arch }}-build-${{ env.cache-name }}
- name: 'install test prereqs perl'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 5
run: *perl-win32-pkgs-install
- name: 'install test prereqs'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 5