EnricoMi / publish-unit-test-result-action

GitHub Action to publish unit test results on GitHub
Apache License 2.0
615 stars 184 forks source link

Add support for python 3.12 #584

Closed jedian closed 7 months ago

jedian commented 7 months ago

I have a private repository that uses this action and when we tried to upgrade the python version to 3.12, we use it like this in our yaml file:

      - name: Publish Unit Test Results
        uses: EnricoMi/publish-unit-test-result-action/linux@v2
        if: github.actor != 'dependabot[bot]'
        with:
          event_name: Integration Tests
          check_name: Integration Tests After Approval
          report_individual_runs: true

But after trying to upgrade the python version from 3.10.13 (on which it works well) to 3.12.0, this is the log:

> Install Python dependencies
...
  Collecting cffi==1.15.1 (from -r /home/ubuntu/.../_actions/EnricoMi/publish-unit-test-result-action/v2/linux/../python/requirements.txt (line 12))
    Using cached cffi-1.15.1.tar.gz (508 kB)
...
Building wheels for collected packages: cffi
    Building wheel for cffi (pyproject.toml): started
    Building wheel for cffi (pyproject.toml): finished with status 'error'
    error: subprocess-exited-with-error

    × Building wheel for cffi (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [36 lines of output]
        running bdist_wheel
        running build
        running build_py
        creating build
        creating build/lib.linux-x86_64-cpython-312
        creating build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/__init__.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/pkgconfig.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/recompiler.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/model.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/api.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/commontypes.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/ffiplatform.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/error.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/lock.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/vengine_gen.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/verifier.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/cparser.py -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/_cffi_include.h -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/parse_c_type.h -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/_embedding.h -> build/lib.linux-x86_64-cpython-312/cffi
        copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-cpython-312/cffi
        running build_ext
        building '_cffi_backend' extension
        creating build/temp.linux-x86_64-cpython-312
        creating build/temp.linux-x86_64-cpython-312/c
        gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -DFFI_BUILDING=1 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/home/ubuntu/.../enricomi-publish-action-venv/include -I/opt/hostedtoolcache/Python/3.12.0/x64/include/python3.12 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-312/c/_cffi_backend.o
        c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
           15 | #include <ffi.h>
              |          ^~~~~~~
        compilation terminated.
        error: command '/usr/bin/gcc' failed with exit code 1
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for cffi
  ERROR: Could not build wheels for cffi, which is required to install pyproject.toml-based projects
  Failed to build cffi
  Error: Process completed with exit code 1.

I guess this error makes sense since this action pins cffi to 1.15.1. According to the official changelog (https://cffi.readthedocs.io/en/latest/whatsnew.html#v1-16-0rc1) support for python 3.12 was added in 1.16.0rc1.

EnricoMi commented 7 months ago

Interesting, Python 3.12 works just fine in the CI: https://github.com/EnricoMi/publish-unit-test-result-action/actions/runs/8077203766/job/22067042868

Looks like a caching issue. I'll investigate.

EnricoMi commented 7 months ago

Please test my fix:

uses: EnricoMi/publish-unit-test-result-action/linux@py-3.12
jedian commented 7 months ago

@EnricoMi This worked successfully! Thanks a lot!

EnricoMi commented 7 months ago

The fix has been released.