Files
Peter BiermaandKay Hayen e5597b3c64 Python3.5: Use "PyImport_CreateModuleFromInitfunc" for the meta path loader and other fixes
* Experimental implementation of the meta path importer based on new 3.15 funtion.

* Fix Python 3.15 support issues

* Fixed isBuiltinModuleName to recognize submodules of builtin packages
  (e.g. math.integer) via recursive parent check, using ModuleName API
  consistently. Adapted plugin context to convert string arguments.

* Defined Py_BUILD_CORE_MODULE for 3.15+ to avoid linker errors with
  unexported TLS symbols _Py_tss_tstate/_Py_tss_interp, making
  _PyThreadState_GET() use exported function calls instead.

* Define perf trampoline struct for Python 3.15 (trampoline_api changed size)

---------

Co-authored-by: Kay Hayen <kay.hayen@gmail.com>
2026-07-06 16:13:45 +02:00

525 lines
18 KiB
YAML

name: Nuitka tests
# makes little sense, spell-checker: disable
on:
pull_request:
branches:
- develop
- integration
push:
branches:
- main
- develop
- integration
- factory
- release/**
- hotfix/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
NUITKA_UPDATE_CHECK: "never"
jobs:
checks:
runs-on: ubuntu-24.04
name: Checks
steps:
- name: 🛎️ Checkout (Attempt 1)
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout
- name: ⏳ Wait for checkout retry 1
if: steps.checkout.outcome == 'failure'
run: sleep 120s
shell: bash
- name: 🛎️ Checkout (Attempt 2)
if: steps.checkout.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout_retry_1
- name: ⏳ Wait for checkout retry 2
if: steps.checkout_retry_1.outcome == 'failure'
run: sleep 300s
shell: bash
- name: 🛎️ Checkout (Attempt 3)
if: steps.checkout_retry_1.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
id: checkout_retry_2
- name: 🐍 Use Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: 🧳 Install Nuitka and dependencies
run: |
sudo apt-get update
sudo apt-get install patchelf gdb ccache libfuse2
python -m pip install --no-python-version-warning --disable-pip-version-check .
- name: 🔎 PyLint on Nuitka source code
run: |
python ./bin/check-nuitka-with-pylint --assume-yes-for-downloads
- name: 🔎 RestLint on Nuitka source code
run: |
python ./bin/check-nuitka-with-restlint --assume-yes-for-downloads
- name: 🔎 YamlLint on Nuitka source code
run: |
python ./bin/check-nuitka-with-yamllint --assume-yes-for-downloads
- name: 🔎 Codespell on Nuitka source code
run: |
python ./bin/check-nuitka-with-codespell --assume-yes-for-downloads
- name: 🔎 Auto-format check on Nuitka source code
run: |
python ./bin/autoformat-nuitka-source --check-only --assume-yes-for-downloads
- name: 🔎 Specialized C code check
run: |
python ./bin/generate-specialized-c-code --check
- name: 🔎 Specialized Python code check
run: |
python ./bin/generate-specialized-python-code --check
linux:
needs: checks
runs-on: ubuntu-24.04
strategy:
matrix:
python_version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "3.15"
name: Ubuntu Python ${{ matrix.python_version }}
steps:
- name: 🛎️ Checkout (Attempt 1)
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout
- name: ⏳ Wait for checkout retry 1
if: steps.checkout.outcome == 'failure'
run: sleep 120s
shell: bash
- name: 🛎️ Checkout (Attempt 2)
if: steps.checkout.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout_retry_1
- name: ⏳ Wait for checkout retry 2
if: steps.checkout_retry_1.outcome == 'failure'
run: sleep 300s
shell: bash
- name: 🛎️ Checkout (Attempt 3)
if: steps.checkout_retry_1.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
id: checkout_retry_2
- name: 🐍 Use Python ${{ matrix.python_version }}
if: matrix.python_version != '3.15'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: 🎒 Install system packages
run: |
sudo apt-get update
sudo apt-get install -y patchelf gdb ccache libfuse2
- name: 🐍 Install Python 3.15 (deadsnakes)
if: matrix.python_version == '3.15'
run: |
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install -y python3.15 python3.15-dev python3.15-venv
python3.15 -m venv .venv-3.15
echo "VIRTUAL_ENV=$PWD/.venv-3.15" >> $GITHUB_ENV
echo "$PWD/.venv-3.15/bin" >> $GITHUB_PATH
- name: 🧳 Install Nuitka
run: |
python -m pip install --upgrade --no-python-version-warning --disable-pip-version-check pip setuptools wheel
python -m pip install --no-python-version-warning --disable-pip-version-check .
- name: ⚙️ Verbose scons output in compilation
run: |
set -x
${PYTHON:-python} -m nuitka --mode=module --show-scons --run --report=compilation-report-module.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
${PYTHON:-python} -m nuitka --mode=accelerated --show-scons --run --report=compilation-report-accelerated.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
${PYTHON:-python} -m nuitka --mode=standalone --show-scons --run --report=compilation-report-standalone.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
readelf -d EmptyModuleTest.dist/EmptyModuleTest.bin | tee standalone-binary-readelf.txt
ldd EmptyModuleTest.dist/EmptyModuleTest.bin | tee standalone-binary-ldd.txt
${PYTHON:-python} -m nuitka --mode=onefile --show-scons --run --report=compilation-report-onefile.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
shell: bash
- name: 📤 Archive compilation reports for empty modules
if: always()
uses: actions/upload-artifact@v4
with:
name: compilation-reports-${{ runner.os }}-${{ matrix.python_version }}
path: |
*.xml
standalone-binary-readelf.txt
standalone-binary-ldd.txt
# This can be used to ssh into GitHub actions if debugging is needed.
# - uses: actions/checkout@v4
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public keys of the listed GitHub users
# limit-access-to-users: kayhayen
- name: 🧪 Run Nuitka test suite
run: |
${PYTHON:-python} -m nuitka --version
env | sort
${PYTHON:-python} ./tests/run-tests --no-other-python --skip-reflection-test --skip-all-cpython-tests --assume-yes-for-downloads
mac-python3:
needs: linux
runs-on: macos-latest
strategy:
matrix:
python_version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
name: macOS Python ${{ matrix.python_version }}
steps:
- name: 🛎️ Checkout (Attempt 1)
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout
- name: ⏳ Wait for checkout retry 1
if: steps.checkout.outcome == 'failure'
run: sleep 120s
shell: bash
- name: 🛎️ Checkout (Attempt 2)
if: steps.checkout.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout_retry_1
- name: ⏳ Wait for checkout retry 2
if: steps.checkout_retry_1.outcome == 'failure'
run: sleep 300s
shell: bash
- name: 🛎️ Checkout (Attempt 3)
if: steps.checkout_retry_1.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
id: checkout_retry_2
- name: 🐍 Use Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: ⚙️ Verbose installation output for Python
run: |
set -x
which python
otool -L $(which python)
otool -l $(which python)
ls -lR $(dirname $(dirname $(which python)))
- name: 🧳 Install Nuitka and dependencies
run: |
pip install --no-python-version-warning --disable-pip-version-check .
- name: Verbose scons output in compilation
run: |
set -x
cleanupEmptyModuleOutputs() {
rm -rf EmptyModuleTest EmptyModuleTest.*
}
retryMacCompileCommand() {
cleanupEmptyModuleOutputs
if "$@"; then
return 0
fi
echo "Retrying once after 30 seconds to tolerate a transient macOS runner failure."
sleep 30
cleanupEmptyModuleOutputs
"$@"
return $?
}
retryMacCompileCommand python -m nuitka --mode=module --show-scons --run --report=compilation-report-module.xml --assume-yes-for-downloads tests/basics/EmptyModuleTest.py
retryMacCompileCommand python -m nuitka --mode=accelerated --show-scons --run --report=compilation-report-accelerated.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
retryMacCompileCommand python -m nuitka --mode=standalone --show-scons --run --report=compilation-report-standalone.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
retryMacCompileCommand python -m nuitka --mode=onefile --show-scons --run --report=compilation-report-onefile.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
# DLL mode has no run ability at this time.
retryMacCompileCommand python -m nuitka --mode=dll --show-scons --report=compilation-report-dll.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
shell: bash
- name: Archive compilation reports for empty modules
if: always()
uses: actions/upload-artifact@v4
with:
name: compilation-reports-${{ runner.os }}-${{ matrix.python_version }}
path: |
*.xml
- name: 🐞 Check all modes for debug output
run: |
set -x
python -m nuitka --mode=module --run --report=compilation-report-module.xml --debug --assume-yes-for-downloads tests/basics/EmptyModuleTest.py
python -m nuitka --mode=accelerated --run --report=compilation-report-accelerated.xml --debug --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
python -m nuitka --mode=standalone --run --report=compilation-report-standalone.xml --debug --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
python -m nuitka --mode=onefile --run --report=compilation-report-onefile.xml --debug --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
# DLL mode has no run ability at this time.
python -m nuitka --mode=dll --report=compilation-report-onefile.xml --debug --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
shell: bash
- name: Run Nuitka test suite
run: |
python -m nuitka --version
env | sort
python ./tests/run-tests --no-other-python --skip-reflection-test --skip-all-cpython-tests --assume-yes-for-downloads
windows:
needs: linux
runs-on: windows-latest
strategy:
matrix:
python_version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
name: Windows Python ${{ matrix.python_version }}
steps:
- name: 🛎️ Checkout (Attempt 1)
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout
- name: ⏳ Wait for checkout retry 1
if: steps.checkout.outcome == 'failure'
run: sleep 120s
shell: bash
- name: 🛎️ Checkout (Attempt 2)
if: steps.checkout.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout_retry_1
- name: ⏳ Wait for checkout retry 2
if: steps.checkout_retry_1.outcome == 'failure'
run: sleep 300s
shell: bash
- name: 🛎️ Checkout (Attempt 3)
if: steps.checkout_retry_1.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
id: checkout_retry_2
- name: 🐍 Use Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- uses: ilammy/msvc-dev-cmd@v1
- name: 🧳 Install Nuitka and dependencies
run: |
pip install --no-python-version-warning --disable-pip-version-check .
- name: Verbose scons output in compilation
run: |
set -x
python -m nuitka --mode=module --show-scons --run --report=compilation-report-module.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
python -m nuitka --mode=accelerated --show-scons --run --report=compilation-report-accelerated.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
python -m nuitka --mode=standalone --show-scons --run --report=compilation-report-standalone.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
python -m nuitka --mode=onefile --show-scons --run --report=compilation-report-onefile.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
shell: bash
- name: Archive compilation reports for empty modules
if: always()
uses: actions/upload-artifact@v4
with:
name: compilation-reports-${{ runner.os }}-${{ matrix.python_version }}
path: |
*.xml
- name: Run Nuitka test suite
run: |
Get-ChildItem env:
python -m nuitka --version
python .\tests\run-tests --no-other-python --no-debug --skip-reflection-test --skip-all-cpython-tests --assume-yes-for-downloads
windows-arm:
needs: linux
runs-on: windows-11-arm
strategy:
matrix:
python_version:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
name: Windows ARM Python ${{ matrix.python_version }}
steps:
- name: 🛎️ Checkout (Attempt 1)
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout
- name: ⏳ Wait for checkout retry 1
if: steps.checkout.outcome == 'failure'
run: sleep 120s
shell: bash
- name: 🛎️ Checkout (Attempt 2)
if: steps.checkout.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
continue-on-error: true
id: checkout_retry_1
- name: ⏳ Wait for checkout retry 2
if: steps.checkout_retry_1.outcome == 'failure'
run: sleep 300s
shell: bash
- name: 🛎️ Checkout (Attempt 3)
if: steps.checkout_retry_1.outcome == 'failure'
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: false
filter: blob:none
id: checkout_retry_2
- name: 🐍 Use Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: arm64
- name: 🧳 Install Nuitka and dependencies
run: |
pip install --no-python-version-warning --disable-pip-version-check .
- name: Verbose scons output in compilation
run: |
set -x
python -m nuitka --mode=module --show-scons --run --report=compilation-report-module.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
python -m nuitka --mode=accelerated --show-scons --run --report=compilation-report-accelerated.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
python -m nuitka --mode=standalone --show-scons --run --report=compilation-report-standalone.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
python -m nuitka --mode=onefile --show-scons --run --report=compilation-report-onefile.xml --assume-yes-for-downloads --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
shell: bash
- name: Archive compilation reports for empty modules
if: always()
uses: actions/upload-artifact@v4
with:
name: compilation-reports-${{ runner.os }}-arm64-${{ matrix.python_version }}
path: |
*.xml
- name: Run Nuitka test suite
run: |
Get-ChildItem env:
python -m nuitka --version
python .\tests\run-tests --no-other-python --no-debug --skip-reflection-test --skip-all-cpython-tests --assume-yes-for-downloads