From fffedc05dcd10f71180d8baf339978ff1234659f Mon Sep 17 00:00:00 2001 From: Craig Hesling 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 | 40 +++++++++++++++++++++ 1 file changed, 40 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 0000000000000..fdd797f61438f --- /dev/null +++ b/.github/workflows/libclang-python-tests.yml @@ -0,0 +1,40 @@ +name: Libclang Python Binding Tests + +permissions: + contents: read + +on: + workflow_dispatch: + push: + paths: + - 'clang/bindings/python/**' + - 'clang/tools/libclang/**' + - 'clang/CMakeList.txt' + - '.github/workflows/libclang-python-tests.yml' + - '.github/workflows/llvm-project-tests.yml' + pull_request: + paths: + - 'clang/bindings/python/**' + - 'clang/tools/libclang/**' + - 'clang/CMakeList.txt' + - '.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"]' From 8fd0cac97dc03a00044b63e407da9b39f4a5bac4 Mon Sep 17 00:00:00 2001 From: Craig Hesling 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 fdd797f61438f..73edb6cf3bad2 100644 --- a/.github/workflows/libclang-python-tests.yml +++ b/.github/workflows/libclang-python-tests.yml @@ -28,7 +28,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