Merge pull request #61 from oytundemirbilek/dev/coverage-badge #122
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
--- | |
# This workflow will install Python dependencies and run tests with a single version of Python | |
# For more information see: | |
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Run unit-tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
permissions: | |
contents: read | |
jobs: | |
run-unittests-python: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Restore cache venv | |
uses: actions/cache/restore@v4 | |
id: restore-cache-venv | |
with: | |
path: ${{ env.pythonLocation }} | |
key: cache-venv-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: cache-venv- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cpu | |
pip install .[test] | |
- name: Test with pytest | |
run: pytest --tb=native | |
run-unittests-os: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macOS-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Cache venv | |
uses: actions/cache@v4 | |
id: cache-venv | |
with: | |
path: ${{ env.pythonLocation }} | |
key: cache-venv-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: cache-venv- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cpu | |
pip install .[test] | |
- name: Test with pytest | |
run: pytest --tb=native | |
run-unittests-pytorch: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
torch-vers: ['1.11.0', '1.12.1', '1.13.1', '2.0.1', '2.1.2', 'latest'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Restore cache venv | |
uses: actions/cache/restore@v4 | |
id: restore-cache-venv | |
with: | |
path: ${{ env.pythonLocation }} | |
key: cache-venv-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: cache-venv- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ ${{ matrix.torch-vers }} == "latest" ]; then | |
python -m pip install torch --upgrade --extra-index-url https://download.pytorch.org/whl/cpu | |
else | |
python -m pip install torch==${{ matrix.torch-vers }} --extra-index-url https://download.pytorch.org/whl/cpu | |
fi | |
pip install .[test] | |
- name: Test with pytest | |
run: pytest --tb=native |