Skip to content

Commit f06100b

Browse files
Add CI testing for slangpy-samples
Implements testing of slangpy-samples as requested in issue #8186. The implementation follows the original issue's preferred solution: clone the slangpy-samples repository, install dependencies, and run pytest tests. Changes: - Added slangpy-samples testing to test-slangpy job - Runs 'pytest -n 4 slangpy-samples/tests' for parallel execution - Combined with slangpy pytest tests to reuse setup and reduce CI overhead The tests run alongside slangpy's own pytest tests when full-gpu-tests is enabled on pull requests or release builds.
1 parent 4ab3063 commit f06100b

File tree

3 files changed

+8
-297
lines changed

3 files changed

+8
-297
lines changed

.github/workflows/ci-slang-test.yml

Lines changed: 8 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,11 @@ jobs:
155155
run: |
156156
"$bin_dir/slang-rhi-tests" -check-devices -optix-version=80100 -tc="ray-tracing-*.cuda"
157157
158-
# Run slangpy tests when:
158+
# Run slangpy tests and examples when:
159159
# 1. full-gpu-tests is enabled AND
160160
# 2. Either it's a pull request OR config is release
161161
# This is to reduce the CI load but do some check on pull requests.
162+
# Includes both slangpy pytest tests and slangpy-samples examples.
162163
test-slangpy:
163164
runs-on: ${{ fromJSON(inputs.runs-on) }}
164165
timeout-minutes: 30
@@ -210,6 +211,9 @@ jobs:
210211
echo "Listing files in slangpy directory..."
211212
ls -la "$SITE_PACKAGES/slangpy/"
212213
214+
# Export SITE_PACKAGES for use in slangpy-samples step
215+
echo "SITE_PACKAGES=$SITE_PACKAGES" >> $GITHUB_ENV
216+
213217
# Skip package installation on self-hosted runners to avoid permission issues
214218
if [[ ! "${{ inputs.runs-on }}" =~ self-hosted ]]; then
215219
echo "Installing python packages..."
@@ -223,82 +227,17 @@ jobs:
223227
export PYTHONPATH="$SITE_PACKAGES"
224228
python -m pytest "$SITE_PACKAGES/slangpy/tests" -ra -n auto --maxprocesses=3
225229
226-
# Run slangpy examples tests when:
227-
# 1. full-gpu-tests is enabled AND
228-
# 2. Either it's a pull request OR config is release
229-
# This provides integration testing with real-world slangpy examples.
230-
test-slangpy-examples:
231-
runs-on: ${{ fromJSON(inputs.runs-on) }}
232-
timeout-minutes: 30
233-
if: inputs.full-gpu-tests && (github.event_name == 'pull_request' || inputs.config == 'release')
234-
defaults:
235-
run:
236-
shell: bash
237-
238-
steps:
239-
- uses: actions/checkout@v4
240-
241-
- name: Common Test Setup
242-
uses: ./.github/actions/common-test-setup
243-
with:
244-
os: ${{ inputs.os }}
245-
compiler: ${{ inputs.compiler }}
246-
platform: ${{ inputs.platform }}
247-
config: ${{ inputs.config }}
248-
249-
- name: Setup Python
250-
if: ${{ runner.environment != 'self-hosted' }}
251-
uses: actions/setup-python@v5
252-
with:
253-
python-version: "3.10"
254-
255-
- name: Install slangpy
256-
run: |
257-
python --version
258-
echo "Cleaning up existing installations and installing slangpy..."
259-
260-
# Try to uninstall existing slangpy
261-
python -m pip uninstall -y slangpy || echo "slangpy not found or already removed"
262-
263-
# Install slangpy
264-
python -m pip install --verbose slangpy --user
265-
266-
# Get site packages directory
267-
SITE_PACKAGES=$(python -c "import slangpy; import os; print(os.path.dirname(os.path.dirname(slangpy.__file__)))" | tail -n 1)
268-
echo "Site packages directory: $SITE_PACKAGES"
269-
echo "bin_dir location: $bin_dir"
270-
echo "lib_dir location: $lib_dir"
271-
272-
# Copy library files
273-
if [[ "${{ inputs.os }}" == "windows" ]]; then
274-
cp "$bin_dir"/slang*.dll "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
275-
else
276-
cp "$lib_dir"/libslang*.* "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; }
277-
fi
278-
279-
echo "Listing files in slangpy directory..."
280-
ls -la "$SITE_PACKAGES/slangpy/"
281-
282-
# Export SITE_PACKAGES for use in next steps
283-
echo "SITE_PACKAGES=$SITE_PACKAGES" >> $GITHUB_ENV
284-
285230
- name: Clone slangpy-samples
286231
run: |
287232
echo "Cloning slangpy-samples repository..."
288233
git clone --depth 1 https://github.com/shader-slang/slangpy-samples.git
289234
290-
echo "Contents of slangpy-samples:"
291-
ls -la slangpy-samples/
292-
293235
- name: Install slangpy-samples dependencies
294236
run: |
295237
echo "Installing slangpy-samples dependencies..."
296238
python -m pip install -r slangpy-samples/requirements.txt --user
297239
298-
# Install pytest dependencies if not already present
299-
python -m pip install pytest-github-actions-annotate-failures --user
300-
python -m pip install pytest-xdist --user
301-
302-
- name: Run slangpy-samples examples
240+
- name: Run slangpy-samples tests
303241
run: |
304-
bash extras/run-slangpy-examples.sh "${{ inputs.os }}" slangpy-samples "$SITE_PACKAGES"
242+
echo "Running slangpy-samples tests..."
243+
python -m pytest -n 4 slangpy-samples/tests

extras/expected-slangpy-example-failure.txt

Lines changed: 0 additions & 37 deletions
This file was deleted.

extras/run-slangpy-examples.sh

Lines changed: 0 additions & 191 deletions
This file was deleted.

0 commit comments

Comments
 (0)