feat: add action workflow for torch2.2 #8
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
pytest: | |
name: Run tests | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
operating-system: [ubuntu-latest, windows-latest, macos-13] | |
python-version: ["3.10", "3.11", "3.12"] # 3.8, 3.9 | |
include: | |
- operating-system: ubuntu-latest | |
path: ~/.cache/pip | |
- operating-system: windows-latest | |
path: ~\AppData\Local\pip\Cache | |
- operating-system: macos-13 | |
path: ~/Library/Caches/pip | |
fail-fast: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Python packages | |
uses: actions/cache@v4 | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}- | |
${{ runner.os }}-pip- | |
- name: Update pip | |
run: | | |
python -m pip install --upgrade pip | |
pip cache purge | |
- name: Install wheel | |
run: python -m pip install --upgrade wheel | |
- name: Install PyTorch on Linux and Windows | |
if: > | |
matrix.operating-system == 'ubuntu-latest' || | |
matrix.operating-system == 'windows-latest' | |
run: > | |
pip install torch==2.2.0 | |
--extra-index-url https://download.pytorch.org/whl/cpu | |
- name: Install PyTorch on MacOS | |
if: matrix.operating-system == 'macos-13' | |
run: pip install torch==2.2.0 # torchvision==0.17.0 | |
- name: Install dev requirements | |
run: pip install -r requirements.dev.txt | |
- name: Install moai | |
run: | | |
pip install . | |
# - name: Cleanup the build directory | |
# uses: JesseTG/rm@v1.0.3 | |
# with: | |
# path: build | |
- name: Run PyTest | |
run: pytest --cov . | |
# - name: Upload coverage reports to Codecov | |
# if: matrix.operating-system == 'ubuntu-latest' && matrix.python-version == '3.8' | |
# uses: codecov/codecov-action@v4.3.0 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# slug: moverseai/moai | |
mypy_check: | |
name: Check code w/ mypy | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# - name: check validity of codecov.yaml | |
# run: cat codecov.yaml | curl --data-binary @- https://codecov.io/validate | |
- name: Install moai | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
- name: Install dev requirements | |
run: pip install -r requirements.dev.txt | |
- name: Run all pre-commit hooks / checks | |
run: pre-commit run --all-files |