From a13d6bef4fac677871170bf35dfcb18e11b89cb6 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 6 Jan 2025 12:26:44 -0500 Subject: [PATCH] Enable Cython tests for `cuda.bindings` (#323) * enable Cython tests for cuda.bindings * build Cython test modules * Update gh-build-and-test.yml * Install system gcc * No sudo * also set CUDA_HOME * Try to find Python include * nit: add a skip condition and comments * simplify --- .github/actions/fetch_ctk/action.yml | 1 + .github/workflows/build-and-test.yml | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/actions/fetch_ctk/action.yml b/.github/actions/fetch_ctk/action.yml index 8365b3f2..18750c2d 100644 --- a/.github/actions/fetch_ctk/action.yml +++ b/.github/actions/fetch_ctk/action.yml @@ -146,5 +146,6 @@ runs: run: | CUDA_PATH=$(realpath "./cuda_toolkit") echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV + echo "CUDA_HOME=${CUDA_PATH}" >> $GITHUB_ENV echo "${CUDA_PATH}/bin" >> $GITHUB_PATH echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:${CUDA_PATH}/lib" >> $GITHUB_ENV diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ff5041c8..a42955a8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -234,6 +234,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + env: + # we use self-hosted runners on which setup-python behaves weirdly... + AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache" - name: Set up mini CTK uses: ./.github/actions/fetch_ctk @@ -255,6 +258,13 @@ jobs: pushd ./cuda_bindings pip install -r requirements.txt pytest -rxXs tests/ - # TODO: enable cython tests - #pytest tests/cython + if [[ "${{ matrix.host-platform }}" == linux* ]]; then + # cython tests require gcc + apt install -y build-essential + bash tests/cython/build_tests.sh + elif [[ "${{ matrix.host-platform }}" == win* ]]; then + # TODO: enable this once win-64 runners are up + exit 1 + fi + pytest -rxXs tests/cython popd