This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
[pre-commit.ci] pre-commit suggestions #342
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: Unittests | |
on: [push, pull_request] # Trigger the workflow on push or pull request | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
max-parallel: 10 | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.8", "3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get pip cache dir | |
if: runner.os != 'Windows' | |
id: pip-cache | |
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: pip cache | |
uses: actions/cache@v3 | |
if: runner.os != 'Windows' | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }} | |
restore-keys: ${{ runner.os }}-pip-py${{ matrix.python-version }}- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U pip wheel | |
pip install -r requirements/install.txt -r requirements/install_async.txt -r requirements/unittests.txt --extra-index-url https://download.pytorch.org/whl/cpu | |
pip install --no-deps . | |
- name: Run Tests | |
run: coverage run -m unittest | |
- name: Statistics | |
run: | | |
coverage report | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
# see: https://github.com/actions/toolkit/issues/399 | |
continue-on-error: true | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
flags: cpu,python${{ matrix.python-version }} | |
name: CPU-coverage | |
fail_ci_if_error: false |