Files
tinygrad/.github/workflows/test.yml
George Hotz ef1100fdff touchups
2022-07-19 09:30:06 -07:00

144 lines
4.3 KiB
YAML

name: Unit Tests
on: [push, pull_request]
jobs:
lines:
name: Less than 1000 lines
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install SLOCCount
run: sudo apt-get install sloccount
- name: Check <1000 lines
run: sloccount tinygrad test examples extra; if [ $(sloccount tinygrad | sed -n 's/.*Total Physical Source Lines of Code (SLOC)[ ]*= \([^ ]*\).*/\1/p' | tr -d ',') -gt 1000 ]; then exit 1; fi
linter:
name: Indentation Linter
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pylint
# pip install -r requirements.txt
- name: Lint with pylint
run: |
python -m pylint --disable=all -e W0311 --jobs=0 --indent-string=' ' **/*.py
testcpu:
name: CPU Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Update packages
run: sudo apt-get update
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies
run: pip install -e '.[testing]'
- name: Run Pytest
run: LAZY=0 python -m pytest -s -v
- name: Run Pytest (lazy)
run: LAZY=1 python -m pytest -s -v
testtorch:
name: Torch Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Update packages
run: sudo apt-get update
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies
run: pip install -e '.[testing]'
- name: Run Pytest
run: LAZY=0 TORCH=1 python -m pytest -s -v
- name: Run Pytest (lazy)
run: LAZY=1 TORCH=1 python -m pytest -s -v
testgpu:
name: GPU Tests
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Update packages
run: |
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
- name: Install OpenCL
#run: sudo apt-get install -y pocl-opencl-icd
run: sudo apt-get install -y intel-oneapi-runtime-compilers intel-oneapi-runtime-opencl
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies
run: pip install -e '.[gpu,testing]'
- name: Run Pytest (default)
run: OPT=1 GPU=1 python -m pytest -s -v
testopencl:
name: OpenCL Tests
runs-on: ubuntu-20.04
if: ${{ false }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Update packages
run: |
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
- name: Install OpenCL
#run: sudo apt-get install -y pocl-opencl-icd
run: sudo apt-get install -y intel-oneapi-runtime-compilers intel-oneapi-runtime-opencl
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies
run: pip install -e '.[gpu,testing]'
- name: Run Pytest (default)
run: OPENCL=1 python -m pytest -s -v
testmypy:
name: Mypy Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Update packages
run: sudo apt-get update
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies
run: pip install -e '.[testing]'
- name: Run mypy
run: mypy tinygrad/