Skip to content

GHA/windows: msys/mingw improvements - #16429

Closed
vszakats wants to merge 10 commits into
curl:masterfrom
vszakats:msys2def
Closed

vszakats wants to merge 10 commits into
curl:masterfrom
vszakats:msys2def

Conversation

@vszakats

@vszakats vszakats commented Feb 21, 2025 •

Copy link
Copy Markdown
Member
  • enable zstd in Cygwin and MSYS jobs.
  • dl-mingw: use Ninja in the 9.5.0 (winlibs-mingw) job.
    The download package is shipping with it. Saves 15s build time.
    Keep testing GNU Makefiles with the two mingw-builds jobs.
  • dl-mingw: split env prop to env and ver to aid integrating with
    MSYS2.
  • dl-mingw: install MSYS2 with options to make it quick (<20s).
    It allows to use MSYS2 dependency packages with the downloaded
    toolchains. It also makes configuration cleaner. Install libpsl.
  • dl-mingw: enable mbedTLS in the 7.3.0 job.
    (OpenSSL took a long time to install, wolfSSL misses features.)

Assisted-by: Jeremy Drake


  • rebase on vtls: fix compiler warnings seen with gcc 7.3.0 and mbedTLS #16614
  • perhaps merge dl-mingw jobs into standard msys/mingw ones?
    The difference is that they'd keep using the downloaded toolchain,
    instead of the built-in one. [FUTURE maybe]
  • try new msys2 installer by bumping the action pin.
  • enable cache again. [Went with OFF, I'm not sure this is okay, but it's fast (below 20s) with the few packages installed on top of the pre-installed MSYS2]
  • decide if the extra build/test time is useful for these jobs. → Yes, it's useful to combine these builds with MSYS2 package to improve coverage.

@vszakats
vszakats marked this pull request as draft February 21, 2025 18:52
@github-actions github-actions Bot added Windows Windows-specific CI Continuous Integration labels Feb 21, 2025
@jeremyd2019

jeremyd2019 commented Feb 21, 2025 •

Copy link
Copy Markdown
Contributor

That's probably not what you want to do. it's likely to be slower, and adding path-type: inherit is more likely to cause issues than help.

What I meant was to use setup-msys2 that way in the actions where you are using c:\msys64\usr\bin\bash as the shell, and use msys2 {0} as the shell instead

@vszakats

vszakats commented Feb 21, 2025 •

Copy link
Copy Markdown
Member Author

That's probably not what you want to do. it's likely to be slower, and adding path-type: inherit is more likely to cause issues than help.

What I meant was to use setup-msys2 that way in the actions where you are using c:\msys64\usr\bin\bash as the shell, and use msys {0} as the shell instead

Ah okay, got it. I indeed could not readily see an obvious speed-up
even though the initial Downloading/Extracting steps are skipped
this way. It also made the MSYS2 runtime bumped to 3.5.7-2644508f
from 3.5.4-0bc1222b with no adverse effect for the pure MSYS jobs.
The runtime shown for MinGW jobs remained 3.5.4-0bc1222b. (I'm
looking at the uname -a value shown from Perl, in test run steps.)

edit 3: my mistake, missed to add the over-install options for mingw.

Before: https://github.com/curl/curl/actions/runs/13460225789
After: https://github.com/curl/curl/actions/runs/13464241825?pr=16429

For the other jobs (dl-mingw and msvc), I understand it'd make PATH
and shell spec nicer, but isn't the cost of running the MSYS2 action
and installing stuff very high? This takes time, and I'm not sure it's
worth it. After all we don't need any custom package in these jobs.

edit: actually... for dl-mingw, installing extra package may be useful,
if we wanted to beef up them up with extra curl dependency options.
But I'm not sure I want to do this, they are mainly there to ensure
compatibility with older GCC and mingw-w64 releases.

edit 2: for installing ninja it'd be useful too, but installing MSYS2 may
take more time than ninja would save for the build steps. That may
be worth a test run though.

@jeremyd2019

jeremyd2019 commented Feb 21, 2025 •

Copy link
Copy Markdown
Contributor

That's probably not what you want to do. it's likely to be slower, and adding path-type: inherit is more likely to cause issues than help.
What I meant was to use setup-msys2 that way in the actions where you are using c:\msys64\usr\bin\bash as the shell, and use msys {0} as the shell instead

Ah okay, got it. I indeed could not readily see an obvious speed-up even though the initial Downloading/Extracting steps are skipped this way. It also made the MSYS2 runtime bumped to 3.5.7-2644508f from 3.5.4-0bc1222b with no adverse effect for the pure MSYS jobs.

The pipe patch only dealt with pipes where the other end was a non-Cygwin (native) process.

The runtime shown for MinGW jobs remained 3.5.4-0bc1222b. (I'm looking at the uname -a value shown from Perl, in test run steps.)

You had two setup-msys2 actions with different if conditions on them, you only updated one of them. BTW, I'm expecting that setup-msys2 will be updated soon with a new installer, which will contain the 3.5.7 runtime. You pin setup-msys2 by commit hash, I don't know if you'd rather keep that back or downgrade the runtime...

For the other jobs (dl-mingw and msvc), I understand it'd make PATH and shell spec nicer, but isn't the cost of running the MSYS2 action and installing stuff very high? This takes time, and I'm not sure it's worth it. After all we don't need any custom package in these jobs.

With release: false, update: false (the default), and no install:, it should be very cheap.

@vszakats
vszakats force-pushed the msys2def branch 2 times, most recently from 7e724ff to 47464be Compare February 21, 2025 21:23
Comment thread .github/workflows/windows.yml Outdated
[ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
[ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
cmake -B bld -G ${{ contains(matrix.url, '/winlibs_mingw/') && 'Ninja' || 'MSYS Makefiles' }} ${options} \
cmake -B bld -G ${{ contains(matrix.url, '/winlibs_mingw/') && 'Ninja' || "'MSYS Makefiles'" }} ${options} \

@jeremyd2019 jeremyd2019 Feb 21, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cmake -B bld -G ${{ contains(matrix.url, '/winlibs_mingw/') && 'Ninja' || "'MSYS Makefiles'" }} ${options} \
cmake -B bld -G "${{ contains(matrix.url, '/winlibs_mingw/') && 'Ninja' || 'MSYS Makefiles' }}" ${options} \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your way will probably work too

@vszakats vszakats Feb 21, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nicer, pushed an update.

Best not to think about the man-years saved if those -G args were just continuous strings with no spaces in them!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least you're dealing with quoting in bash, and not cmd. Its quoting rules are really arcane

@vszakats

vszakats commented Feb 21, 2025 •

Copy link
Copy Markdown
Member Author

The runtime shown for MinGW jobs remained 3.5.4-0bc1222b. (I'm looking at the uname -a value shown from Perl, in test run steps.)

You had two setup-msys2 actions with different if conditions on them, you only updated one of them. BTW, I'm expecting that setup-msys2 will be updated soon with a new installer, which will contain the 3.5.7 runtime. You pin setup-msys2 by commit hash, I don't know if you'd rather keep that back or downgrade the runtime...

Yes, missed it initially, edited when realized :) It looks best to leave those jobs
alone for now. And probably keep/restore a pin on MSYS2 there to avoid the
bad commit when/if it lands.

For the other jobs (dl-mingw and msvc), I understand it'd make PATH and shell spec nicer, but isn't the cost of running the MSYS2 action and installing stuff very high? This takes time, and I'm not sure it's worth it. After all we don't need any custom package in these jobs.

With release: false, update: false (the default), and no install:, it should be very cheap.

Tried it; it came out around 16-17 seconds with no-install, which makes it not
worth it for these jobs IMO. With Ninja it hovered on/above 20, which was about
the time Ninja then saved. I figure it's nice to have a couple of bare GNU Makefile
jobs on Windows for variation.

no-install: https://github.com/curl/curl/actions/runs/13465193475/job/37629411220
with-ninja: https://github.com/curl/curl/actions/runs/13464892290/job/37628469272

A surprise takeaway discovery is that one standalone mingw toolchain does come
with Ninja, which is a free ~15 seconds gain right there. With the cost of kind of
weird GHA expression (CMake -G arguments with spaces never stop to be fun!).

@jeremyd2019

Copy link
Copy Markdown
Contributor

I was seeing that... It was wasting time messing with the cache that other jobs had made. Maybe cache: false too?

@vszakats vszakats changed the title [TESTS] GHA/windows: MSYS2 experiments GHA/windows: use Ninja in the dl-mingw 9.5.0 job Feb 21, 2025
@jeremyd2019

jeremyd2019 commented Feb 21, 2025 •

Copy link
Copy Markdown
Contributor

yeah, cache: false got setup-msys2 installing ninja in 6 seconds. https://github.com/jeremyd2019/curl/actions/runs/13466221291/job/37632506461 (that was 55bfd12 on top of 4e2b789)

@vszakats
vszakats marked this pull request as ready for review February 21, 2025 22:28
@testclutch

Copy link
Copy Markdown

Analysis of PR #16429 at 216ff80e:

Test 2033 failed, which has NOT been flaky recently, so there could be a real issue in this PR.

Generated by Testclutch

@jeremyd2019

Copy link
Copy Markdown
Contributor

If you're going to install a bunch of packages, it might turn out to be faster to get rid of release:false and cache:false (though not the first time, as the cache is established)

@jeremyd2019

Copy link
Copy Markdown
Contributor

You had two setup-msys2 actions with different if conditions on them, you only updated one of them. BTW, I'm expecting that setup-msys2 will be updated soon with a new installer, which will contain the 3.5.7 runtime. You pin setup-msys2 by commit hash, I don't know if you'd rather keep that back or downgrade the runtime...

Yes, missed it initially, edited when realized :) It looks best to leave those jobs alone for now. And probably keep/restore a pin on MSYS2 there to avoid the bad commit when/if it lands.

setup-msys2 update was released today with new installer

@vszakats
vszakats marked this pull request as draft February 24, 2025 02:49
@vszakats vszakats changed the title GHA/windows: use Ninja in the dl-mingw 9.5.0 job GHA/windows: improvements Mar 7, 2025
@vszakats vszakats changed the title GHA/windows: improvements GHA/windows: msys/mingw improvements Mar 7, 2025
@vszakats
vszakats marked this pull request as ready for review March 7, 2025 14:29
vszakats added a commit that referenced this pull request Mar 7, 2025
Seen with downloaded mingw 7.3.0 when built against MSYS2 mbedTLS 3.6.2:
```
lib/vtls/cipher_suite.c: In function 'cs_zip_to_str':
lib/vtls/cipher_suite.c:789:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[1] = ((zip[0] << 4) & 0x3F) | zip[1] >> 4;
                ^
lib/vtls/cipher_suite.c:790:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[2] = ((zip[1] << 2) & 0x3F) | zip[2] >> 6;
                ^
lib/vtls/cipher_suite.c:793:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[5] = ((zip[3] << 4) & 0x3F) | zip[4] >> 4;
                ^
lib/vtls/cipher_suite.c:794:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[6] = ((zip[4] << 2) & 0x3F) | zip[5] >> 6;
                ^
```
Ref: https://github.com/curl/curl/actions/runs/13719756989/job/38372409927?pr=16429#step:10:21

Cherry-picked from #16429
Closes #16614
vszakats added 7 commits March 7, 2025 15:43
https://packages.msys2.org/base/mingw-w64-mbedtls

```
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'wssl_vtls_new_session_cb':
D:/a/curl/curl/lib/vtls/wolfssl.c:483:30: error: implicit declaration of function 'wolfSSL_get_app_data'; did you mean 'wolfSSL_get_ex_data'? [-Wimplicit-function-declaration]
   cf = (struct Curl_cfilter*)wolfSSL_get_app_data(ssl);
                              ^~~~~~~~~~~~~~~~~~~~
                              wolfSSL_get_ex_data
D:/a/curl/curl/lib/vtls/wolfssl.c:483:30: error: nested extern declaration of 'wolfSSL_get_app_data' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:483:8: error: cast from function call of type 'int' to non-matching type 'struct Curl_cfilter *' [-Werror=bad-function-cast]
   cf = (struct Curl_cfilter*)wolfSSL_get_app_data(ssl);
        ^
D:/a/curl/curl/lib/vtls/wolfssl.c:483:8: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'wssl_x509_share_free':
D:/a/curl/curl/lib/vtls/wolfssl.c:706:5: error: implicit declaration of function 'wolfSSL_X509_STORE_free'; did you mean 'wolfSSL_X509_STORE_CTX_free'? [-Wimplicit-function-declaration]
     wolfSSL_X509_STORE_free(share->store);
     ^~~~~~~~~~~~~~~~~~~~~~~
     wolfSSL_X509_STORE_CTX_free
D:/a/curl/curl/lib/vtls/wolfssl.c:706:5: error: nested extern declaration of 'wolfSSL_X509_STORE_free' [-Werror=nested-externs]
[ 33%] Generating CURLOPT_XFERINFOFUNCTION.3, CURLOPT_XOAUTH2_BEARER.3, CURLSHOPT_LOCKFUNC.3, CURLSHOPT_SHARE.3, CURLSHOPT_UNLOCKFUNC.3, CURLSHOPT_UNSHARE.3, CURLSHOPT_USERDATA.3
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'wssl_set_cached_x509_store':
D:/a/curl/curl/lib/vtls/wolfssl.c:786:6: error: implicit declaration of function 'wolfSSL_X509_STORE_up_ref'; did you mean 'wolfSSL_X509_STORE_CTX_free'? [-Wimplicit-function-declaration]
   if(wolfSSL_X509_STORE_up_ref(store)) {
      ^~~~~~~~~~~~~~~~~~~~~~~~~
      wolfSSL_X509_STORE_CTX_free
D:/a/curl/curl/lib/vtls/wolfssl.c:786:6: error: nested extern declaration of 'wolfSSL_X509_STORE_up_ref' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'Curl_wssl_setup_x509_store':
D:/a/curl/curl/lib/vtls/wolfssl.c:831:6: error: implicit declaration of function 'wolfSSL_CTX_get_cert_store'; did you mean 'wolfSSL_CTX_get_mode'? [-Wimplicit-function-declaration]
      wolfSSL_CTX_get_cert_store(wssl->ssl_ctx) == cached_store) {
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      wolfSSL_CTX_get_mode
D:/a/curl/curl/lib/vtls/wolfssl.c:831:6: error: nested extern declaration of 'wolfSSL_CTX_get_cert_store' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:831:48: error: comparison between pointer and integer
      wolfSSL_CTX_get_cert_store(wssl->ssl_ctx) == cached_store) {
                                                ^~
D:/a/curl/curl/lib/vtls/wolfssl.c:835:5: error: implicit declaration of function 'wolfSSL_CTX_set_cert_store'; did you mean 'wolfSSL_CTX_save_cert_cache'? [-Wimplicit-function-declaration]
     wolfSSL_CTX_set_cert_store(wssl->ssl_ctx, cached_store);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
     wolfSSL_CTX_save_cert_cache
D:/a/curl/curl/lib/vtls/wolfssl.c:835:5: error: nested extern declaration of 'wolfSSL_CTX_set_cert_store' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:840:33: error: implicit declaration of function 'wolfSSL_X509_STORE_new'; did you mean 'wolfSSL_X509_STORE_CTX_new'? [-Wimplicit-function-declaration]
     WOLFSSL_X509_STORE *store = wolfSSL_X509_STORE_new();
                                 ^~~~~~~~~~~~~~~~~~~~~~
                                 wolfSSL_X509_STORE_CTX_new
D:/a/curl/curl/lib/vtls/wolfssl.c:840:33: error: nested extern declaration of 'wolfSSL_X509_STORE_new' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:840:33: error: initialization makes pointer from integer without a cast [-Wint-conversion]
[ 33%] Built target generate-curl.1
D:/a/curl/curl/lib/vtls/wolfssl.c:854:32: error: initialization makes pointer from integer without a cast [-Wint-conversion]
    WOLFSSL_X509_STORE *store = wolfSSL_CTX_get_cert_store(wssl->ssl_ctx);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'Curl_wssl_ctx_init':
D:/a/curl/curl/lib/vtls/wolfssl.c:1117:11: error: implicit declaration of function 'wolfSSL_CTX_set1_curves_list'; did you mean 'wolfSSL_CTX_set_cipher_list'? [-Wimplicit-function-declaration]
       if(!wolfSSL_CTX_set1_curves_list(wctx->ssl_ctx, curves)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
           wolfSSL_CTX_set_cipher_list
D:/a/curl/curl/lib/vtls/wolfssl.c:1117:11: error: nested extern declaration of 'wolfSSL_CTX_set1_curves_list' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:1288:3: error: implicit declaration of function 'wolfSSL_set_app_data'; did you mean 'wolfSSL_set_ex_data'? [-Wimplicit-function-declaration]
   wolfSSL_set_app_data(wctx->ssl, ssl_user_data);
   ^~~~~~~~~~~~~~~~~~~~
   wolfSSL_set_ex_data
D:/a/curl/curl/lib/vtls/wolfssl.c:1288:3: error: nested extern declaration of 'wolfSSL_set_app_data' [-Werror=nested-externs]
```
https://github.com/curl/curl/actions/runs/13713131802/job/38353245932#step:10:20
@vszakats

vszakats commented Mar 7, 2025

Copy link
Copy Markdown
Member Author

Thanks @jeremyd2019 for your help, much appreciated! This is merged now.

@vszakats
vszakats deleted the msys2def branch March 7, 2025 14:57
@jeremyd2019

Copy link
Copy Markdown
Contributor

Cool. If you end up installing a lot of packages, it may end up being faster to take out the release: false/cache: false. This is counterintuitive (without release:false you are installing the entire msys2 from scratch rather than using the one already installed on the runner), but setup-msys2 by default installs it in the runner temp dir, which is on the D: drive which is faster than the C:. And in that case the cache might be more of a help than a hindrance. But it looks like you have a pretty good sweet spot now.

pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Seen with downloaded mingw 7.3.0 when built against MSYS2 mbedTLS 3.6.2:
```
lib/vtls/cipher_suite.c: In function 'cs_zip_to_str':
lib/vtls/cipher_suite.c:789:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[1] = ((zip[0] << 4) & 0x3F) | zip[1] >> 4;
                ^
lib/vtls/cipher_suite.c:790:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[2] = ((zip[1] << 2) & 0x3F) | zip[2] >> 6;
                ^
lib/vtls/cipher_suite.c:793:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[5] = ((zip[3] << 4) & 0x3F) | zip[4] >> 4;
                ^
lib/vtls/cipher_suite.c:794:16: error: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Werror=conversion]
   indexes[6] = ((zip[4] << 2) & 0x3F) | zip[5] >> 6;
                ^
```
Ref: https://github.com/curl/curl/actions/runs/13719756989/job/38372409927?pr=16429#step:10:21

Cherry-picked from curl#16429
Closes curl#16614
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
- enable zstd in Cygwin and MSYS jobs.
- dl-mingw: use Ninja in the 9.5.0 (winlibs-mingw) job.
  The download package is shipping with it. Saves 15s build time.
  Keep testing GNU Makefiles with the two mingw-builds jobs.
- dl-mingw: split `env` prop to `env` and `ver` to aid integrating with
  MSYS2.
- dl-mingw: install MSYS2 with options to make it quick (<20s).
  It allows to use MSYS2 dependency packages with the downloaded
  toolchains. It also makes configuration cleaner. Install libpsl.
- dl-mingw: enable mbedTLS in the 7.3.0 job.
  (OpenSSL took a long time to install, wolfSSL misses features.)

Assisted-by: Jeremy Drake

Closes curl#16429
vszakats added a commit that referenced this pull request Sep 30, 2026
To inherit MSYS2 environment, which is now pre-installed on Windows
ARM64 runners.

Saving ~30s in the MSYS2 install step.

Ref: https://github.com/actions/runner-images/blob/main/images/windows/Windows11-Arm64-Readme.md
Follow-up to be718da #17067
Follow-up to 27d2469 #16429

Closes #23190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration performance Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

3 participants