Skip to content

Package Testing

Package Testing #466

name: Package Testing
on:
schedule:
- cron: '0 0 * * *' # Runs at 00:00 UTC every day
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.9, "3.10"]
torch-version: [1.13.1, 2.5.1]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Restore Ubuntu cache
uses: actions/cache@v4
if: matrix.os == 'ubuntu-latest'
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-
- name: Restore MacOS cache
uses: actions/cache@v4
if: matrix.os == 'macos-latest'
with:
path: ~/Library/Caches/pip
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-
- name: Restore Windows cache
uses: actions/cache@v4
if: matrix.os == 'windows-latest'
with:
path: ~\AppData\Local\pip\Cache
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}}
restore-keys: ${{ matrix.os }}-${{ matrix.python-version }}-
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install Numpy
run: >
pip install numpy
- name: Install PyTorch==1.13.1 on Linux and Windows
if: >
(matrix.os == 'ubuntu-latest' ||
matrix.os == 'windows-latest') &&
matrix.torch-version == '1.13.1'
run: >
pip install torch==${{ matrix.torch-version }}+cpu
-f https://download.pytorch.org/whl/torch_stable.html
- name: Install PyTorch==2.5.1 on Linux and Windows
if: >
(matrix.os == 'ubuntu-latest' ||
matrix.os == 'windows-latest') &&
matrix.torch-version == '2.5.1'
run: >
pip install torch==${{ matrix.torch-version }}
-f https://download.pytorch.org/whl/torch_stable.html
- name: Install PyTorch on MacOS
if: matrix.os == 'macos-latest'
run: pip install torch==${{ matrix.torch-version }}
- name: Install latest balanced-loss package
run: >
pip install --upgrade --force-reinstall balanced-loss
- name: Unittest balanced-loss
run: |
python -m unittest