Simplify _verify_rules() and reduce max-complexity=10 #1015
Workflow file for this run
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: test nornir | |
on: [push,pull_request] | |
jobs: | |
linters: | |
name: linters | |
strategy: | |
matrix: | |
python-version: [ '3.9' ] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.3.2 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Cache Poetry virtualenv | |
uses: actions/cache@v4 | |
id: cached-poetry-dependencies | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install Dependencies | |
run: poetry install | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Run ruff | |
run: make ruff | |
- name: Run mypy | |
run: make mypy | |
- name: Run sphinx | |
run: | | |
sudo apt-get install pandoc | |
make docs | |
pytest: | |
name: Testing on Python ${{ matrix.python-version }} (${{ matrix.platform}}) | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] | |
platform: [ubuntu-latest, macos-13, windows-2019] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.3.2 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Cache Poetry virtualenv | |
uses: actions/cache@v4 | |
id: cached-poetry-dependencies | |
with: | |
path: .venv | |
key: venv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
if: ${{ matrix.platform != 'windows-2019' }} # windows hangs if using a cached venv | |
- name: Install Dependencies | |
run: poetry install | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Run pytest | |
run: make pytest | |
if: ${{ matrix.platform != 'windows-2019' }} | |
- name: Run pytest | |
run: poetry run pytest --cov=nornir --cov-report=term-missing | |
if: ${{ matrix.platform == 'windows-2019' }} | |
- name: Run nbval | |
run: make nbval | |
if: ${{ matrix.platform != 'windows-2019' }} | |
- name: Report coverage | |
uses: coverallsapp/github-action@v2 | |
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.11' }} | |
# release: | |
# name: Releasing to pypi | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@master | |
# - name: Build | |
# uses: abatilo/[email protected] | |
# with: | |
# python_version: 3.8.0 | |
# poetry_version: 1.3.2 | |
# working_directory: . | |
# args: build | |
# - name: Publish package | |
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
# uses: pypa/gh-action-pypi-publish@master | |
# with: | |
# user: __token__ | |
# password: ${{ secrets.pypi_password }} |