Skip to content

Commit

Permalink
Adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekmig committed Sep 4, 2023
1 parent ccec8a1 commit 5f137f2
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 2 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Unit-tests for Pip install

on:
pull_request:
push:
branches:
- nightly
- main
- release/*

workflow_dispatch:

env:
CHANNEL: "nightly"

jobs:
tests:
strategy:
matrix:
python_version: ["3.6"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
runner: linux.12xlarge
repository: pytorch/captum
script: |
# Set up Environment Variables
export PYTHON_VERSION="${{ matrix.python_version }}"
export VERSION="cpu"
export CUDATOOLKIT="cpuonly"
# Set CHANNEL
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
export CHANNEL=test
else
export CHANNEL=nightly
fi
# Create Conda Env
conda create -yp ci_env python="${PYTHON_VERSION}"
conda activate /pytorch/captum/ci_env
./scripts/install_via_pip.sh
# Check formatting with ufmt
ufmt check .
# Lint with flake8
flake8
# Run sphinx
sphinx-build -WT --keep-going sphinx/source sphinx/build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unit-tests on Linux CPU
name: Unit-tests for Conda install

on:
pull_request:
Expand All @@ -17,7 +17,7 @@ jobs:
tests:
strategy:
matrix:
python_version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python_version: ["3.7", "3.8", "3.9", "3.10"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/test-pip-cpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Unit-tests for Pip install

on:
pull_request:
push:
branches:
- nightly
- main
- release/*

workflow_dispatch:

env:
CHANNEL: "nightly"

jobs:
tests:
strategy:
matrix:
python_version: ["3.6"]
pytorch_args: ["", "-n", "-v 1.6", "-v 1.7", " -v 1.8", "-v 1.9"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
runner: linux.12xlarge
repository: pytorch/captum
script: |
# Set up Environment Variables
export PYTHON_VERSION="${{ matrix.python_version }}"
export VERSION="cpu"
export CUDATOOLKIT="cpuonly"
# Set CHANNEL
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
export CHANNEL=test
else
export CHANNEL=nightly
fi
# Create Conda Env
conda create -yp ci_env python="${PYTHON_VERSION}"
conda activate /pytorch/captum/ci_env
./scripts/install_via_pip.sh ${{ matrix.pytorch_args }}
# Run Tests
python3 -m pytest -ra --cov=. --cov-report term-missing

0 comments on commit 5f137f2

Please sign in to comment.