jurplel / install-qt-action

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

Docker support #91

Closed firewave closed 2 years ago

firewave commented 3 years ago

If you try to use this in an action which will be run inside a container

    container:
      image: "ubuntu:21.04"

it will fail since sudo is not available

Run jurplel/install-qt-action@v2
  with:
    modules: qtcharts
    version: 5.15.2
    target: desktop
    install-deps: true
    cached: false
    setup-python: true
    set-env: true
    tools-only: false
    aqtversion: ==1.1.3
    py7zrversion: ==0.14.0
/usr/bin/docker exec  f448ac4ce4ccb3756862341c12dd51458dce4d7849d6343c22875989be917835 sh -c "cat /etc/*release | grep ^ID"
Successfully setup CPython (3.9.4)
sudo apt-get update
Error: There was an error when attempting to execute the process 'sudo'. This may indicate the process failed to start. Error: spawn sudo ENOENT

sudo is not necessary here since it will be executed with a user that has all privileges.

jurplel commented 3 years ago

After wrestling with some random bug for an hour, you can now use nosudo with install-deps for this behavior

firewave commented 3 years ago

Thanks a lot for the amazingly fast reply. I will apply the change tomorrow.

Unfortunately the change broke the default behavior because of a copy-and-paste error. :(

jurplel commented 3 years ago

Okay that was pretty bad, sorry about that. Should be fixed now.

firewave commented 3 years ago
python3 -m aqt install 5.15.2 linux desktop -m qtcharts -O /__w/cppcheck/Qt
Traceback (most recent call last):
  File "/__t/Python/3.9.4/x64/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/__t/Python/3.9.4/x64/lib/python3.9/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/__t/Python/3.9.4/x64/lib/python3.9/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/aqt/__init__.py", line 25, in <module>
    from aqt.installer import Cli
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/aqt/installer.py", line 37, in <module>
    import py7zr
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/py7zr/__init__.py", line 30, in <module>
    from py7zr.py7zr import ArchiveInfo, FileInfo, SevenZipFile, is_7zfile, pack_7zarchive, unpack_7zarchive
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/py7zr/py7zr.py", line 40, in <module>
    from py7zr.archiveinfo import Folder, Header, SignatureHeader
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/py7zr/archiveinfo.py", line 35, in <module>
    from py7zr.compressor import SevenZipCompressor, SevenZipDecompressor
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/py7zr/compressor.py", line 33, in <module>
    from Crypto.Cipher import AES
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/Crypto/Cipher/__init__.py", line 27, in <module>
    from Crypto.Cipher._mode_ecb import _create_ecb_cipher
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/Crypto/Cipher/_mode_ecb.py", line 35, in <module>
    raw_ecb_lib = load_pycryptodome_raw_lib("Crypto.Cipher._raw_ecb", """
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/Crypto/Util/_raw_api.py", line 293, in load_pycryptodome_raw_lib
    return load_lib(pycryptodome_filename(dir_comps, filename),
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/Crypto/Util/_raw_api.py", line 95, in load_lib
    lib = ffi.dlopen(name)
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "/__t/Python/3.9.4/x64/lib/python3.9/site-packages/cffi/api.py", line 817, in _load_backend_lib
    import ctypes.util
  File "/__t/Python/3.9.4/x64/lib/python3.9/ctypes/__init__.py", line 8, in <module>
    from _ctypes import Union, Structure, Array
ImportError: libffi.so.7: cannot open shared object file: No such file or directory
Error: The process 'python3' failed with exit code 1

Seems like there is a missing dependency. Not sure where the error is located.

dpkg -S libffi.so.7
libffi7:amd64: /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
libffi7:amd64: /usr/lib/x86_64-linux-gnu/libffi.so.7

Installing the package manually fixes it.

I would change the ticket name to reflect this is actually about docker support.

jurplel commented 3 years ago

apt-get installing libffi-dev should fix this, yes?

firewave commented 3 years ago

libffi7 is the package in question - as seen in the dpkg output.

jurplel commented 3 years ago

I think it is out of scope for this action to install that, because that package is only for ubuntu 20.04 and 21.04. Maybe try passing setup-python: false to install-qt-action and install python with the apt command beforehand.

firewave commented 3 years ago

That package probably changed in-between distros. I think the problem stems from the package being installed by pip instead by the system package python3-cffi (or whatever it is called) and it being a minimized docker image. I might take a look into it but I am really pressed for time at the moment.

If this is not done within the action it should probably be mentioned somewhere in the documentation that you are required to install that package when using docker or downsized distros.

jurplel commented 3 years ago

Well, depending on what the user is doing, there are all sorts of packages that need to be installed, and of course these are all different between distros. Documenting edge cases like this would be an exercise in futility. The only thing that I can guarantee works out of the box is using Github's runners

firewave commented 3 years ago

I didn't expect that the packages are mentioned in detail - just that there might be such cases - to avoid bug reports...hopefully :-)