android13/external/python/pyfakefs/.github/workflows/pythonpackage.yml

163 lines
4.9 KiB
YAML

name: Testsuite
on:
[push, pull_request]
jobs:
linter:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install linter
run: |
uname -a
python -m pip install flake8 mypy
- name: Check syntax and style
run: flake8 . --exclude get-pip.py --max-complexity=13 --statistics
mypy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -r requirements.txt -r extra_requirements.txt
python -m pip install mypy==0.812
- name: Run typing checks
run: python -m mypy .
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
include:
- python-version: pypy3
os: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install --upgrade pip
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache dependencies
id: cache-dep
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/extra_requirements.txt') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-pip-
- name: Install dependencies
run: |
pip install wheel
pip install -r requirements.txt
pip install .
- name: Run unit tests without extra packages as non-root user
run: |
export TEST_REAL_FS=1
python -bb -m pyfakefs.tests.all_tests_without_extra_packages
shell: bash
- name: Run setup.py test (uses pytest)
run: |
python setup.py test
shell: bash
- name: Run unit tests without extra packages as root
run: |
if [[ '${{ matrix.os }}' != 'windows-latest' ]]; then
# provide the same path as non-root to get the correct virtualenv
sudo env "PATH=$PATH" python -m pyfakefs.tests.all_tests_without_extra_packages
fi
shell: bash
- name: Install extra dependencies
run: |
pip install -r extra_requirements.txt
shell: bash
- name: Run unit tests with extra packages as non-root user
run: |
python -m pyfakefs.tests.all_tests
shell: bash
- name: Run performance tests
run: |
if [[ '${{ matrix.os }}' != 'macOS-latest' ]]; then
export TEST_PERFORMANCE=1
python -m pyfakefs.tests.performance_test
fi
shell: bash
pytest-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.9]
pytest-version: [3.0.0, 3.5.1, 4.0.2, 4.5.0, 5.0.1, 5.4.3, 6.0.2, 6.2.5, 7.0.1, 7.1.0]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -U pytest==${{ matrix.pytest-version }}
if [[ '${{ matrix.pytest-version }}' == '4.0.2' ]]; then
pip install -U attrs==19.1.0
fi
shell: bash
- name: Run pytest tests
run: |
export PY_VERSION=${{ matrix.python-version }}
$GITHUB_WORKSPACE/.github/workflows/run_pytest.sh
shell: bash
dependency-check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r extra_requirements.txt
pip install pytest-find-dependencies
- name: Check dependencies
run: python -m pytest --find-dependencies pyfakefs/tests
shell: bash