[llvm] [GitHub] Add basic CI for libclang Python binding unit tests (PR #76784)
Craig Hesling via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 2 22:55:39 PST 2024
https://github.com/linux4life798 created https://github.com/llvm/llvm-project/pull/76784
This is important to aid development on Python Type Annotations - https://github.com/llvm/llvm-project/issues/76664.
* Run on all pull requests and direct pushes.
* This makes use of the existing llvm-project-tests.yml recipe, which will preload ccache from previous runs.
* Building libclang currently takes about 9mins when ccache is warm and about an 1hr 20mins if it is cold using the standard GitHub ubuntu runner.
* In the future, this could be broken into the following
discrete steps for clarity:
1. Build libclang dependency.
ninja -C build libclang
2. Run Python unit tests.
ninja -C build check-clang-python
* Additional changes will bring testing on older python versions and static type checkers.
Issue https://github.com/llvm/llvm-project/issues/76601.
>From accefb4635b038015ec348d633fc9ca666fed81e Mon Sep 17 00:00:00 2001
From: Craig Hesling <craig at hesling.com>
Date: Fri, 29 Dec 2023 23:03:41 -0500
Subject: [PATCH 1/2] [GitHub] Add CI for libclang Python unit tests
* Run on all pull requests and direct pushes.
* This makes use of the existing llvm-project-tests.yml
recipe, which will preload ccache from previous runs.
* Building libclang currently takes about 9mins when
ccache is warm and about an 1hr 20mins if it is cold
using the standard GitHub ubuntu runner.
* This could be broken into the following two steps:
- # Build libclang dependency.
ninja -C build libclang
- # Run Python unit tests.
ninja -C build check-clang-python
Issue #76601.
---
.github/workflows/libclang-python-tests.yml | 42 +++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 .github/workflows/libclang-python-tests.yml
diff --git a/.github/workflows/libclang-python-tests.yml b/.github/workflows/libclang-python-tests.yml
new file mode 100644
index 00000000000000..50a9354c892af2
--- /dev/null
+++ b/.github/workflows/libclang-python-tests.yml
@@ -0,0 +1,42 @@
+name: Libclang Python Binding Tests
+
+permissions:
+ contents: read
+
+on:
+ workflow_dispatch:
+ push:
+ paths:
+ - 'clang/bindings/python/**'
+ - 'clang/tools/libclang/**'
+ - 'clang/CMakeList.txt'
+ - 'cmake/**'
+ - '.github/workflows/libclang-python-tests.yml'
+ - '.github/workflows/llvm-project-tests.yml'
+ pull_request:
+ paths:
+ - 'clang/bindings/python/**'
+ - 'clang/tools/libclang/**'
+ - 'clang/CMakeList.txt'
+ - 'cmake/**'
+ - '.github/workflows/libclang-python-tests.yml'
+ - '.github/workflows/llvm-project-tests.yml'
+
+concurrency:
+ # Skip intermediate builds: always.
+ # Cancel intermediate builds: only if it is a pull request build.
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+jobs:
+ check-clang-python:
+ if: github.repository_owner == 'llvm'
+ # Build libclang and then run the libclang Python binding's unit tests.
+ name: Build and run Python unit tests
+ uses: ./.github/workflows/llvm-project-tests.yml
+ with:
+ build_target: check-clang-python
+ projects: clang
+ # There is an issue running on "windows-2019".
+ # See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
+ os_list: '["ubuntu-latest", "macOS-11"]'
>From 98b65728c5affc8cd1b91505e441e1753ca9407b Mon Sep 17 00:00:00 2001
From: Craig Hesling <craig at hesling.com>
Date: Tue, 2 Jan 2024 19:14:25 -0500
Subject: [PATCH 2/2] [GitHub] Remove libclang Python actions fork protection
Remove the check that only allows the action to run if
it is running from the parent llvm organization repo.
This is meant to protect contributors that fork the
project from automatically launching actions with their
account quota.
This shouldn't be necessary, since GitHub Actions are
disabled automatically on forks. The following docs says
"When a public repository is forked, scheduled workflows
are disabled by default.".
https://docs.github.com/en/actions/using-workflows/disabling-and-enabling-a-workflow
Issue #76601.
---
.github/workflows/libclang-python-tests.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.github/workflows/libclang-python-tests.yml b/.github/workflows/libclang-python-tests.yml
index 50a9354c892af2..da5bd696063c24 100644
--- a/.github/workflows/libclang-python-tests.yml
+++ b/.github/workflows/libclang-python-tests.yml
@@ -30,7 +30,6 @@ concurrency:
jobs:
check-clang-python:
- if: github.repository_owner == 'llvm'
# Build libclang and then run the libclang Python binding's unit tests.
name: Build and run Python unit tests
uses: ./.github/workflows/llvm-project-tests.yml
More information about the llvm-commits
mailing list