Skip to content

Commit

Permalink
GHA/windows: replace GfW with MSYS2 runtime downgrade
Browse files Browse the repository at this point in the history
We recently switched to a known good version of Git for Windows to avoid
the MSYS2/Cygwin runtime performance regression.

MSYS2 is closer to the source of the MSYS2/Cygwin projects. Its known
good version is newer. Installing the downgrade is faster and safer. It
also allows to restore the scripts to their original iteration, making
the workaround easier to drop once the perf issue is fixed upstream.

Therefore, switch back to using MSYS2, and install the runtime downgrade
before running curl tests.

Also disable `pacman`'s `CheckSpace` for best performance.

Jeremy identified to the root cause of the perf regression in this
Cygwin commit (from 2024-09-17):
https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=c7fe29f5cb85242ae2607945762f7e0b9af02513

Co-authored-by: Jeremy Drake
Patch: jeremyd2019@95a404e
Ref: curl#16217 (comment)
Ref: curl#16217 (comment)

Follow-up to 116950a curl#16265
Follow-up to 1bf774d curl#16217
Follow-up to 5f9411f curl#15380

Closes curl#16424
  • Loading branch information
vszakats committed Feb 21, 2025
1 parent f261c8d commit d4896d9
Showing 1 changed file with 25 additions and 42 deletions.
67 changes: 25 additions & 42 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ jobs:
timeout-minutes: 20
defaults:
run:
shell: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' && 'C:\_gfw\usr\bin\bash.exe {0}' || 'C:\msys64\usr\bin\bash.exe {0}' }}
shell: C:\msys64\usr\bin\bash.exe {0}
strategy:
matrix:
include:
Expand All @@ -396,21 +396,6 @@ jobs:
tflags: 'skiprun'
fail-fast: false
steps:
- name: 'install Git for Windows'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
shell: bash
timeout-minutes: 5
run: |
mkdir /c/_gfw
cd /c/_gfw || exit 1
# The last known good Perl version (as of v2.47.1.windows.2) without pipe/signal MSYS2
# runtime (?) regressions that cause runtests.pl to run at 2.5x reduced speed, is this:
# https://github.com/git-for-windows/git/releases/tag/v2.46.2.windows.1
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 \
--location https://github.com/git-for-windows/git/releases/download/v2.46.2.windows.1/PortableGit-2.46.2-64-bit.7z.exe --output bin.7z
7z x -bd -y bin.7z
rm -f bin.7z
- name: 'cache compiler (gcc ${{ matrix.env }})'
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
id: cache-compiler
Expand Down Expand Up @@ -441,7 +426,6 @@ jobs:
timeout-minutes: 5
run: |
PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
[ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
[ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
cmake -B bld -G 'MSYS Makefiles' ${options} \
Expand All @@ -465,7 +449,6 @@ jobs:
timeout-minutes: 5
run: |
PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --parallel 5
- name: 'curl version'
Expand All @@ -480,7 +463,6 @@ jobs:
timeout-minutes: 10
run: |
PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
- name: 'install test prereqs'
Expand All @@ -491,6 +473,15 @@ jobs:
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket
- name: 'downgrade msys2-runtime'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 2
# Downgrade to a known good MSYS2 runtime version to avoid the performance regression
# causing runtests.pl to run at 2-3x reduced speed.
run: |
/usr/bin/sed -i 's/^CheckSpace/#CheckSpace/' /etc/pacman.conf
exec /usr/bin/pacman --noconfirm --noprogressbar --upgrade https://mirror.msys2.org/msys/x86_64/msys2-runtime-3.5.4-8-x86_64.pkg.tar.zst
- name: 'run tests'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 10
Expand All @@ -501,14 +492,12 @@ jobs:
TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
fi
PATH="$PWD/bld/lib:$PATH:/c/Program Files (x86)/stunnel/bin"
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --target test-ci
- name: 'build examples'
timeout-minutes: 5
run: |
PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples
linux-cross-mingw-w64:
Expand Down Expand Up @@ -701,7 +690,7 @@ jobs:
timeout-minutes: 55
defaults:
run:
shell: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' && 'C:\_gfw\usr\bin\bash.exe {0}' || 'C:\msys64\usr\bin\bash.exe {0}' }}
shell: C:\msys64\usr\bin\bash.exe {0}
env:
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
VCPKG_DISABLE_METRICS: '1'
Expand Down Expand Up @@ -793,21 +782,6 @@ jobs:
fail-fast: false
steps:
- name: 'install Git for Windows'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
shell: bash
timeout-minutes: 5
run: |
mkdir /c/_gfw
cd /c/_gfw || exit 1
# The last known good Perl version (as of v2.47.1.windows.2) without pipe/signal MSYS2
# runtime (?) regressions that cause runtests.pl to run at 2.5x reduced speed, is this:
# https://github.com/git-for-windows/git/releases/tag/v2.46.2.windows.1
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 \
--location https://github.com/git-for-windows/git/releases/download/v2.46.2.windows.1/PortableGit-2.46.2-64-bit.7z.exe --output bin.7z
7z x -bd -y bin.7z
rm -f bin.7z
- name: 'vcpkg cache setup'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
Expand All @@ -832,7 +806,7 @@ jobs:
- name: 'configure'
timeout-minutes: 5
run: |
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
PATH="/c/msys64/usr/bin:$PATH"
for _chkprefill in '' ${{ matrix.chkprefill }}; do
options=''
if [ '${{ matrix.plat }}' = 'uwp' ]; then
Expand Down Expand Up @@ -878,7 +852,7 @@ jobs:
- name: 'build'
timeout-minutes: 5
run: |
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
PATH="/c/msys64/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --parallel 5
- name: 'curl version'
Expand All @@ -894,7 +868,7 @@ jobs:
if: ${{ matrix.tflags != 'skipall' }}
timeout-minutes: 10
run: |
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
PATH="/c/msys64/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
- name: 'install test prereqs'
Expand All @@ -909,6 +883,15 @@ jobs:
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket
- name: 'downgrade msys2-runtime'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 2
# Downgrade to a known good MSYS2 runtime version to avoid the performance regression
# causing runtests.pl to run at 2-3x reduced speed.
run: |
/usr/bin/sed -i 's/^CheckSpace/#CheckSpace/' /etc/pacman.conf
exec /usr/bin/pacman --noconfirm --noprogressbar --upgrade https://mirror.msys2.org/msys/x86_64/msys2-runtime-3.5.4-8-x86_64.pkg.tar.zst
- name: 'run tests'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 10
Expand All @@ -920,11 +903,11 @@ jobs:
TFLAGS+=' ~614' # 'SFTP pre-quote chmod' SFTP, pre-quote, directory
fi
PATH="$PWD/bld/lib:$PATH:/c/Program Files (x86)/stunnel/bin:/c/Program Files/OpenSSH-Win64"
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
PATH="/c/msys64/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --target test-ci
- name: 'build examples'
timeout-minutes: 5
run: |
[ -d /c/_gfw ] && PATH="/c/_gfw/usr/bin:$PATH"
PATH="/c/msys64/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples

0 comments on commit d4896d9

Please sign in to comment.