[llvm] [clang] [GitHub] Add python 3.7 to libclang python test (PR #77219)

Craig Hesling via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 14 16:44:46 PST 2024


https://github.com/linux4life798 updated https://github.com/llvm/llvm-project/pull/77219

>From 34492a5aea953be59cf84450862143cbcf53ea6e Mon Sep 17 00:00:00 2001
From: Craig Hesling <craig at hesling.com>
Date: Sat, 30 Dec 2023 01:17:57 -0500
Subject: [PATCH 1/3] [GitHub] Add python_version input to
 llvm-project-test.yml

This will be used for testing the libclang Python binding
against different versions of Python.

Issue #76664.
Issue #76601.
---
 .github/workflows/llvm-project-tests.yml | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml
index fadaea129e5088..a1404e1f1efa95 100644
--- a/.github/workflows/llvm-project-tests.yml
+++ b/.github/workflows/llvm-project-tests.yml
@@ -15,6 +15,10 @@ on:
       os_list:
         required: false
         default: '["ubuntu-latest", "windows-2019", "macOS-11"]'
+      python_version:
+        required: false
+        type: string
+        default: '3.11'
   workflow_call:
     inputs:
       build_target:
@@ -38,6 +42,11 @@ on:
         # https://github.com/actions/virtual-environments/issues/5900
         default: '["ubuntu-latest", "windows-2019", "macOS-11"]'
 
+      python_version:
+        required: false
+        type: string
+        default: '3.11'
+
 concurrency:
   # Skip intermediate builds: always.
   # Cancel intermediate builds: only if it is a pull request build.
@@ -67,7 +76,7 @@ jobs:
       - name: Setup Python
         uses: actions/setup-python at v4
         with:
-          python-version: '3.11'
+          python-version: ${{ inputs.python_version }}
       - name: Install Ninja
         uses: llvm/actions/install-ninja at main
       # actions/checkout deletes any existing files in the new git directory,

>From 58bb2caa0fc4f3bc6b2cd187e524b9cc791355dd Mon Sep 17 00:00:00 2001
From: Craig Hesling <craig at hesling.com>
Date: Sun, 14 Jan 2024 16:42:53 -0800
Subject: [PATCH 2/3] [libclang/python] Add note about min python version

Issue #76664.
Issue #76601.
---
 clang/bindings/python/README.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/bindings/python/README.txt b/clang/bindings/python/README.txt
index 44c715e5de56f7..57994418af1e1e 100644
--- a/clang/bindings/python/README.txt
+++ b/clang/bindings/python/README.txt
@@ -4,6 +4,8 @@
 
 This directory implements Python bindings for Clang.
 
+The bindings library requires at least Python version 3.7.
+
 You may need to set CLANG_LIBRARY_PATH so that the Clang library can be
 found. The unit tests are designed to be run with any standard test
 runner. For example:

>From b34f420bcbcb18a41eedb5b3f761048d7bc2f2a1 Mon Sep 17 00:00:00 2001
From: Craig Hesling <craig at hesling.com>
Date: Tue, 2 Jan 2024 19:01:49 -0500
Subject: [PATCH 3/3] [GitHub] Add python 3.7 to libclang python test

This enables the libclang python binding test to check
the oldest version of Python supported in addition
to the normal python version.

It is important to check this for issue #76664, since
many new mainstream python type annotation features
and best practices are not compatible with older
versions of python.

Additionally, frustration around ever increasing
platform dependencies and versions has been raised.
This will help ensure that python maintains reasonable
backwards compatibility.

Adding this additional build step will increase the
run time, but this should always be minimal, since
the additional libclang compilation should see 100%
cache hit rate.

Issue #76664.
Fixes #76601.
---
 .github/workflows/libclang-python-tests.yml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.github/workflows/libclang-python-tests.yml b/.github/workflows/libclang-python-tests.yml
index 73edb6cf3bad26..e12acbc0f6ce8c 100644
--- a/.github/workflows/libclang-python-tests.yml
+++ b/.github/workflows/libclang-python-tests.yml
@@ -30,6 +30,10 @@ jobs:
   check-clang-python:
     # Build libclang and then run the libclang Python binding's unit tests.
     name: Build and run Python unit tests
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version: ["3.7", "3.11"]
     uses: ./.github/workflows/llvm-project-tests.yml
     with:
       build_target: check-clang-python
@@ -37,3 +41,4 @@ jobs:
       # There is an issue running on "windows-2019".
       # See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
       os_list: '["ubuntu-latest"]'
+      python_version: ${{ matrix.python-version }}



More information about the cfe-commits mailing list