jurplel / install-qt-action

Install Qt on your Github Actions workflows with just one simple action
MIT License
455 stars 78 forks source link

Make action fail if the specified Qt version/module is unknown #172

Closed firewave closed 1 year ago

firewave commented 1 year ago

If you specify a unknown version the action succeeds and there is simply a message in the output indicating it (the version is obviously now):

Specified Qt version is unknown: 6.4.1.

This might lead to unexpected results. It also installs an unspecified version which is even more troubling since. The install folder even uses the version you specified instead of the one which was installed.

In this case it even reported the following:

Some of specified modules are unknown.

Although I see nothing specified which is unknown. It might be a side effect of the unknown version though.

The action can be found here: https://github.com/danmar/cppcheck/blob/main/.github/workflows/CI-windows.yml

Note it still uses jurplel/install-qt-action@v2 (will be updated soon).

Here's the full information from the failing job in question:

https://github.com/danmar/cppcheck/actions/runs/3507754081/jobs/5875671584

python -m aqt install 6.4.1 windows desktop win64_msvc2019_64 -m qtcharts -O D:\a\cppcheck/Qt
aqtinstall(aqt) v2.0.6 on Python 3.11.0 [CPython MSC v.[193](https://github.com/danmar/cppcheck/actions/runs/3901551309/jobs/6663536509#step:5:194)3 64 bit (AMD64)]
Warning: The command 'install' is deprecated and marked for removal in a future version of aqt.
In the future, please use the command 'install-qt' instead.
Specified Qt version is unknown: 6.4.1.
Some of specified modules are unknown.
Downloading qtcharts...
Downloading qtbase...
Downloading qtdeclarative...
Downloading qtsvg...
Redirected: qt.mirror.constant.com
Redirected: qt.mirror.constant.com
Redirected: qt.mirror.constant.com
Redirected: qt.mirror.constant.com
Finished installation of qtsvg-Windows-Windows_10_21H2-MSVC[201](https://github.com/danmar/cppcheck/actions/runs/3901551309/jobs/6663536509#step:5:202)9-Windows-Windows_10_21H2-X86_64.7z in 1.68070510
Finished installation of qtcharts-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z in 2.09267490
Downloading qttools...
Downloading qttranslations...
Redirected: qt.mirror.constant.com
Redirected: qt.mirror.constant.com
Finished installation of qttranslations-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z in 4.66596370
Downloading d3dcompiler_47...
Redirected: qt.mirror.constant.com
Finished installation of d3dcompiler_47-x64.7z in 2.96178230
Finished installation of qttools-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z in 9.78359510
Finished installation of qtbase-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z in 12.61138100
Downloading opengl32sw...
Redirected: qt.mirror.constant.com
Finished installation of opengl32sw-64-mesa_11_2_2-signed.7z in 2.78579060
Finished installation of qtdeclarative-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z in 18.34803830
Patching D:\a\cppcheck\Qt\6.4.1\msvc2019_64\bin\qmake.exe
Finished installation
Time elapsed: 20.14693490 second
pzhlkj6612 commented 1 year ago

Hi. The backend of this action is miurahr/aqtinstall and all output you post is from aqtinstall, so I think you'd better to file an issue in that repository.

firewave commented 1 year ago

I am aware of that. But this action invokes it and if e.g. it needs to pass some option (I am not familiar with aqtinstall) so it fails on unknown versions that needs to be handled in the action.

It seems the behavior changed (at least for modules) when using v3 since I now get an error when specifying an unknown module:

Some of specified modules are unknown.
The packages ['qthelp'] were not found while parsing XML of package information!
ddalcino commented 1 year ago

FYI, the following two messages are warnings:

...and this message is an error:

The warnings mean that at the time this version of aqtinstall was released, this version of Qt did not exist, so aqtinstall cannot predict whether or not it's going to install properly. There have been multiple instances where older versions of aqtinstall was unable to patch new versions of Qt properly; the most recent is https://github.com/miurahr/aqtinstall/issues/626. If you want these messages to go away, you need to specify a newer version of aqtinstall.

It would be wrong to make this action fail in the case of these warnings; users often want to use old versions of aqtinstall that predate the version of Qt they want to install, and they already know that it will work properly.

Please note that the README tells you how to avoid this error with qthelp:

Possible values:

You can find a full list of architectures easily by using this awesome website.

I know it says 'architectures', but that website will help you with Qt versions, modules, archives, and tools as well.

You should be thinking, "Wouldn't it be nice if this action would show me which messages were actual warnings and which messages are actual errors?" Indeed, it would be nice! If you use a newer version of aqtinstall, for example version 3.1.0, this information should be printed in your CI logs (I'm not sure when this changed).

firewave commented 1 year ago

FYI, the following two messages are warnings:

  • Specified Qt version is unknown: 6.4.1.
  • Some of specified modules are unknown.

This appeared with older versions of aqtinstall if you specify an unknown module...

...and this message is an error:

  • The packages ['qthelp'] were not found while parsing XML of package information!

...and this happens with the latest version of aqtinstall.

You should be thinking, "Wouldn't it be nice if this action would show me which messages were actual warnings and which messages are actual errors?" Indeed, it would be nice! If you use a newer version of aqtinstall, for example version 3.1.0, this information should be printed in your CI logs (I'm not sure when this changed).

Like I mentioned in my previous comment and above in this the module part was even made an error.

I haven't tested the latest version with an unknown Qt version yet so it is quite possible that will now also result in a failure.

It would be wrong to make this action fail in the case of these warnings; users often want to use old versions of aqtinstall that predate the version of Qt they want to install, and they already know that it will work properly.

The problem is that there is no information at all what version you are actually using in the CI log. The version detection in CMake is broken with Qt 6 (or with an aqtinstall) so no luck there either. I haven't looked into this yet aside from adding a local workaround.

Please note that the README tells you how to avoid this error with qthelp:

Possible values: You can find a full list of architectures easily by using this awesome website.

I know it says 'architectures', but that website will help you with Qt versions, modules, archives, and tools as well.

The qthelp usage in that project actually predates any of my changes to the actions in that project. So that had been working fine for years before we went to the latest version. Had to do some digging through the aqt commands to actually find out it never ever existed.

ddalcino commented 1 year ago

It would be wrong to make this action fail in the case of these warnings; users often want to use old versions of aqtinstall that predate the version of Qt they want to install, and they already know that it will work properly.

The problem is that there is no information at all what version you are actually using in the CI log. The version detection in CMake is broken with Qt 6 (or with an aqtinstall) so no luck there either. I haven't looked into this yet aside from adding a local workaround.

I do not understand what you mean by "no information at all what version you are actually using in the CI log". Which version are you asking about? The CI log shows these versions:

If the Qt installation had failed, the whole workflow would have failed. If you don't believe this to be the case, you are welcome to show us evidence that something else happened.

pzhlkj6612 commented 1 year ago

Well, maybe @firewave can directly use aqtinstall locally with the same parameters as this action and see what will happens? aqt will not change system settings, but download and extract files.


You should be thinking, "Wouldn't it be nice if this action would show me which messages were actual warnings and which messages are actual errors?" Indeed, it would be nice! If you use a newer version of aqtinstall, for example version 3.1.0, this information should be printed in your CI logs (I'm not sure when this changed).

Since v2.2.0 (miurahr/aqtinstall@60889b729600a2595699c49a64e2212c00d67a4b).

firewave commented 1 year ago

Sorry for the late reply.

  • Qt: this log shows a successful installation of Qt 6.4.1

The log shows a successful installation and the version 6.4.1 in the path but earlier it says Specified Qt version is unknown: 6.4.1.. So what version did it actually install? It seems like it just puts the version you specified in the output path regardless of what was actually installed.

But as I suspected that is irrelevant now since the latest version of aqt bails out with an unknown version just as it does for unknown modules.

aqtinstall(aqt) v2.1.0 on Python 3.11.1 [CPython MSC v.1934 64 bit (AMD64)]
Specified Qt version is unknown: 6.4.5.
Some of specified modules are unknown.
Failed to locate XML data for Qt version '6.4.5'.
==============================Suggested follow-up:==============================
* Please use 'aqt list-qt windows desktop' to show versions available.

So this can be closed as fixed.

ddalcino commented 1 year ago
  • Qt: this log shows a successful installation of Qt 6.4.1

The log shows a successful installation and the version 6.4.1 in the path but earlier it says Specified Qt version is unknown: 6.4.1.. So what version did it actually install?

Aqtinstall is not capable of choosing a different version. If you disagree, please show proof.

The warning means it cannot find that version in a json file packaged with the program. It has nothing to do with its actual behavior.

pzhlkj6612 commented 1 year ago

To be more detailed, the "Specified Qt version is unknown" warning message is from:

The code about "Some of specified modules are unknown." is not far away and it has the almost the same logic, you can try to find it.


So what version did it actually install? It seems like it just puts the version you specified in the output path regardless of what was actually installed.

No, there is no need to do so. Installing an arbitrary version of Qt would make nothing but chaos. If you really has less trust in aqtinstall and its contributors, as I said previously, you can run the program locally, in a virtual machine, to see what will happen.


So this can be closed as fixed.

Well, nothing got fixed.

firewave commented 1 year ago

Well, nothing got fixed.

It was fixed before I even opened the ticket.

The problem was that I was using an fixed, older aqt version in the action as well as not running the latest install-qt-action version. With that unknown packages and versions just produced a message but the action was still installing something and succeeding.

Now with the latest versions I get an error when I specify unknown versions or modules. Which is exactly the behavior I was expecting.

pzhlkj6612 commented 1 year ago

It was fixed before I even opened the ticket.

Really? you tried to install version 6.4.1 last month and tried to install 6.4.5 two hours ago with the same version of aqtinstall. Something keeps unchanged and something has been changed, right? See Control variable - Wikipedia.

I've searched on Qt blog, there is no release note about version 6.4.5 (for now the latest one is 6.4.2), so aqtinstall failed as expected.

Since you are using aqtinstall 2.1.0 (via install-qt-action), here is the "combinations.json" file used by aqtinstall 2.1.0 and you are now having a chance to review its content: https://github.com/miurahr/aqtinstall/blob/v2.1.0/aqt/combinations.json

With that unknown packages and versions just produced a message but the action was still installing something and succeeding.

So... the previous explanation from contributors is ignored?

pzhlkj6612 commented 1 year ago

It was fixed before I even opened the ticket.

Really? you tried to install version 6.4.1 last month and tried to install 6.4.5 two hours ago with the same version of aqtinstall. Something keeps unchanged and something has been changed, right? See Control variable - Wikipedia.

I'm sorry, you tried to install version 6.4.1 last month with aqtinstall v2.0.6 and tried to install 6.4.5 two hours ago with aqtinstall v2.1.0.

firewave commented 1 year ago

It was fixed before I even opened the ticket.

Really? you tried to install version 6.4.1 last month and tried to install 6.4.5 two hours ago with the same version of aqtinstall. Something keeps unchanged and something has been changed, right? See Control variable - Wikipedia.

I used aqtinstall(aqt) v2.0.6 on Python 3.11.0 on Nov 20, 2022 when I got the 6.4.1. That did not bailout on either unknown versions or modules.

Today I tried the definitely non-existent version 6.4.5 with ``aqtinstall(aqt) v2.1.0 on Python 3.11.1 to enforce the error. That bails out on unknow versions and modules.

I've searched on Qt blog, there is no release note about version 6.4.5 (for now the latest one is 6.4.2), so aqtinstall failed as expected.

I used a version which does not exist to make sure it cannot be found.

pzhlkj6612 commented 1 year ago

I used aqtinstall(aqt) v2.0.6 on Python 3.11.0 on Nov 20, 2022 when I got the 6.4.1. ...

Yes, I misread the version number. I'm sorry for that.


Today I tried the definitely non-existent version 6.4.5 with ``aqtinstall(aqt) v2.1.0 on Python 3.11.1 to enforce the error. That bails out on unknow versions and modules.

I've searched on Qt blog, there is no release note about version 6.4.5 (for now the latest one is 6.4.2), so aqtinstall failed as expected.

I used a version which does not exist to make sure it cannot be found.

OK, now I get your intention. However, to get valid experimental results, you may need to control the variable (Control variable - Wikipedia).


Well, nothing got fixed.

It was fixed before I even opened the ticket. ...

You said something got fixed, but actually, the logic about the "unknown Qt versions and modules" message has not been changed recently:

name aqtinstall v2.0.6 aqtinstall v2.1.0
run_install_qt() v2.0.6/aqt/installer.py#L294-L302 v2.1.0/aqt/installer.py#L300-L308
_check_qt_arg_versions(version) == false v2.0.6/aqt/installer.py#L135-L136 v2.1.0/aqt/installer.py#L141-L142
_check_modules_arg(version, modules) == false v2.0.6/aqt/installer.py#L185-L191 v2.1.0/aqt/installer.py#L191-L197
version not in self._combinations["versions"] v2.0.6/aqt/helper.py#L288-L311 v2.1.0/aqt/helper.py#L361-L384
version not in aqt/combinations.json v2.0.6/aqt/helper.py#L255-L260 v2.1.0/aqt/helper.py#L328-L333

Only the "combinations.json" file has been updated:


Talking is cheap and I'm showing you the code in a public place. If you have some free time, please review the code.