Pytest automated tests #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runs all the Python SDK tests within the `tests/` directory to check our code | |
name: CI Tests with GPU/CUDA build | |
permissions: read-all | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- master | |
- dev** | |
pull_request: | |
branches: | |
- main | |
- master | |
- dev** | |
concurrency: | |
# github.workflow: name of the workflow | |
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
# Cancel in-progress runs when a new workflow with the same group name is triggered | |
cancel-in-progress: true | |
jobs: | |
pytest-gpu: | |
name: pytest (${{ matrix.python-version }}, ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] | |
python-version: ["3.10", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
environment-file: environment-gpu.yml | |
activate-environment: ptens | |
- name: Install Missing Developper packages | |
# We use pip here, since conda isn't very happy with the total env, but it works... | |
run: pip install pytest | |
- name: Install cnine | |
run: | | |
git clone https://github.com/risi-kondor/cnine.git | |
cd cnine | |
git checkout dev | |
# pip install python/ | |
cd .. | |
- name: Install and build | |
run: | | |
export CNINE_FOLDER="/../cnine/" | |
export WITH_CUDA=True | |
export CUDA_HOME=$CONDA_PREFIX | |
# Pretending we have a CUDA capable card on the runner | |
export TORCH_CUDA_ARCH_LIST="7.5" | |
pip install python/ | |
# TODO activate pytests when ready | |
- name: Test with pytest | |
run: | | |
# pytest python/tests | |
mkdir ./tmp-run/ | |
cd ./tmp-run/ | |
# This fails due to actually missing CUDA driver, but that's OK | |
# Testing for build alone is nice already | |
# python -c "import ptens" |