blob: fcf2ce7c4fcf75484ca5905825a93af3c8bf3f5f [file] [log] [blame]
name: Test
on: [push, pull_request]
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: ["3.6", "3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-latest, ubuntu-18.04, macos-latest, windows-latest]
steps:
- name: Check out the repository
uses: actions/checkout@v3
# Clean poisoned cache
# - name: Ubuntu cache
# uses: actions/cache@v2
# if: startsWith(matrix.os, 'ubuntu')
# with:
# path: ~/.cache/pip
# key:
# ${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('**/pyproject.toml') }}
# restore-keys: |
# ${{ matrix.os }}-${{ matrix.python }}-
# - name: macOS cache
# uses: actions/cache@v2
# if: startsWith(matrix.os, 'macOS')
# with:
# path: ~/Library/Caches/pip
# key:
# ${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('**/pyproject.toml') }}
# restore-keys: |
# ${{ matrix.os }}-${{ matrix.python }}-
# - name: Windows cache
# uses: actions/cache@v2
# if: startsWith(matrix.os, 'windows')
# with:
# path: c:\users\runneradmin\appdata\local\pip\cache
# key:
# ${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('**/pyproject.toml') }}
# restore-keys: |
# ${{ matrix.os }}-${{ matrix.python }}-
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
poetry --version
- name: Install dependencies
run: poetry install
- name: Test
shell: bash
run: |
poetry run pytest tests/unit/ -s --cov=isort/ --cov-report=term-missing ${@-}
poetry run coverage xml
- name: Report Coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
uses: codecov/codecov-action@v1