Skip to content

Commit

Permalink
Add unittest to Conda CUDA build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mthrok committed Sep 4, 2024
1 parent 2af8444 commit bb3f415
Show file tree
Hide file tree
Showing 12 changed files with 501 additions and 240 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/build_conda.yml

This file was deleted.

57 changes: 0 additions & 57 deletions .github/workflows/build_wheel_cuda.yml

This file was deleted.

85 changes: 0 additions & 85 deletions .github/workflows/conda_build.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/conda_cpu_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build Conda Package

on:
workflow_call:
inputs:
os:
required: true
type: string
python-version:
required: true
type: string
artifact:
required: true
type: string

jobs:
build:
runs-on: ${{ inputs.os }}
defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ inputs.python-version }}

- name: Install conda-build
run: conda install conda-build

- name: Build SPDL
run: |
mkdir ~/package
conda build \
./packaging/conda \
--python=${{ inputs.python-version }} \
--output-folder ~/package
- uses: actions/upload-artifact@v4
name: Upload build artifact
with:
name: "${{ inputs.artifact }}"
path: ~/package
if-no-files-found: error
retention-days: 1
overwrite: true
48 changes: 48 additions & 0 deletions .github/workflows/conda_cpu_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test Conda Package

on:
workflow_call:
inputs:
os:
required: true
type: string
python-version:
required: true
type: string
artifact:
required: true
type: string

jobs:
unit-test:
name: "Unit test (ffmpeg ${{ matrix.ffmpeg-version }})"
strategy:
fail-fast: false
matrix:
ffmpeg-version: ["5", "6", "7" ]
runs-on: ${{ inputs.os }}
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: actions/download-artifact@v4
with:
name: "${{ inputs.artifact }}"
path: ~/package

- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ inputs.python-version }}

- name: Unit test
run: |
conda install -c file://${HOME}/package/ spdl
conda install -c conda-forge "ffmpeg==${{ matrix.ffmpeg-version}}"
conda install -c pytorch numpy pytest pytorch numba
pytest -v \
tests/spdl_unittest/io/ \
tests/spdl_unittest/dataloader/
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
name: "Build Conda: CUDA"
name: Build Conda Package

on:
workflow_dispatch:
pull_request:
paths-ignore:
- "docs/**"
- "examples/**"
- "README.md"
branches:
- main
push:
paths-ignore:
- "docs/**"
- "examples/**"
- "README.md"
branches:
- main
workflow_call:
inputs:
os:
type: string
default: "32-core-ubuntu"
python-version:
required: true
type: string
cu-version:
required: true
type: string
artifact:
required: true
type: string

jobs:
conda-build-cuda:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
cu_version: [ "11.8.0", "12.1.0" ]
runs-on: ${{ matrix.os }}
build:
runs-on: ${{ inputs.os }}
defaults:
run:
shell: bash -el {0}
Expand All @@ -46,13 +39,14 @@ jobs:
run: |
mkdir ~/package
conda build \
-c nvidia/label/cuda-${{ matrix.cu_version }} \
-c nvidia/label/cuda-${{ inputs.cu-version }} \
./packaging/conda \
--python=${{ matrix.python-version }} \
--python=${{ inputs.python-version }} \
--output-folder ~/package
env:
CU_VERSION: ${{ matrix.cu_version }}
CONDA_CUDATOOLKIT_CONSTRAINT: "- nvidia/label/cuda-${{ matrix.cu_version }}::cuda-toolkit"
CU_VERSION: ${{ inputs.cu-version }}
CONDA_CUDATOOLKIT_CONSTRAINT: "- nvidia/label/cuda-${{ inputs.cu-version }}::cuda-toolkit"
CONDA_CUDARUNTIME_CONSTRAINT: "- nvidia/label/cuda-${{ inputs.cu-version }}::cuda-runtime"
SPDL_USE_CUDA: "1"
SPDL_USE_NVCODEC: "1"
SPDL_USE_NVJPEG: "1"
Expand All @@ -62,8 +56,9 @@ jobs:
SPDL_BUILD_STUB: "0"

- uses: actions/upload-artifact@v4
name: Upload build artifact
with:
name: spdl.${{ matrix.os }}.${{ matrix.python-version }}.${{ matrix.cu_version }}
name: "${{ inputs.artifact }}"
path: ~/package
if-no-files-found: error
retention-days: 1
Expand Down
Loading

0 comments on commit bb3f415

Please sign in to comment.