Use if constexpr for a few PY_VERSION_HEX checks (#49)
#1067
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: [push, pull_request] | |
| jobs: | |
| run_tests: | |
| name: Run Tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| # Don't let test failures on one platform block other platforms. | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] | |
| # Test against multiple patch versions as CinderX references internal | |
| # CPython functions and structures which can lead to ABI problems. See | |
| # cinderx/UpstreamBorrow for more details. | |
| python-version: ['3.14.0', '3.14.1', '3.14.2', '3.14.3', '3.14.4'] | |
| steps: | |
| - name: Checkout CinderX | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Create venv | |
| run: uv venv --python ${{ matrix.python-version }} | |
| - name: Build CinderX | |
| run: uv build --wheel --python ${{ matrix.python-version }} | |
| - name: Install CinderX | |
| run: uv pip install cinderx --find-links dist --no-index | |
| - name: Check CinderX loads successfully (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| uv run python -c 'import cinderx ; print(cinderx.get_import_error()) ; assert cinderx.is_initialized()' | |
| # On macOS the _cinderx native extension currently fails to load, so the | |
| # cinderx Python package falls back to its pure-Python stubs. We only | |
| # verify that `import cinderx` succeeds. | |
| - name: Check CinderX loads successfully (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| uv run python -c 'import cinderx ; print("import_error:", cinderx.get_import_error()) ; print("initialized:", cinderx.is_initialized())' | |
| - name: Install pytest | |
| if: runner.os == 'Linux' | |
| run: uv pip install pytest | |
| - name: Run Tests | |
| if: runner.os == 'Linux' | |
| run: uv run pytest cinderx/PythonLib/test_cinderx/ --ignore=cinderx/PythonLib/test_cinderx/test_cpython_overrides/test__opcode.py | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| # Don't let build failures on one platform block other platforms. | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm] | |
| steps: | |
| - name: Checkout CinderX | |
| uses: actions/checkout@v6 | |
| # cibuildwheel uses Python from a docker container. The Python version is | |
| # controlled by selecting the docker image version in pyproject.toml. | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| - name: Install cibuildwheel | |
| run: python -m pip install cibuildwheel | |
| - name: Build wheels | |
| run: python -m cibuildwheel --output-dir wheelhouse | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout CinderX | |
| uses: actions/checkout@v6 | |
| # An sdist is just source code and doesn't contain compiled artifacts, it | |
| # doesn't need to be built per patch version. | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| - name: Install build tools | |
| run: python -m pip install build | |
| - name: Build sdist | |
| run: python -m build --sdist |