[MRG] Switch docs to main and workflows to poetry #277
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: pull-request-linter | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
linter: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.10'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root --extras dev | |
- name: Get file diff | |
id: diff-files | |
uses: markgilbert-git/[email protected] | |
with: | |
output: '\n' | |
fileOutput: '\n' | |
- name: Get Python file diff | |
id: pydiff | |
run: > | |
echo "pyfiles=$(echo -e | |
'${{ steps.diff-files.outputs.files_added }}\n${{ steps.diff-files.outputs.files_modified }}' | |
| grep '\.py' | tr '\n' ' ' | |
)" >> $GITHUB_OUTPUT | |
- name: Check code formatting | |
run: | | |
source .venv/bin/activate && | |
black . --check | |
- name: Check spelling | |
run: | | |
source .venv/bin/activate && | |
codespell -L ddress,halp,ot,pres,requestor,requestors -d pynetdicom | |
- name: Check for syntax errors | |
run: | | |
source .venv/bin/activate && | |
python -m flake8 --select=E901,E999,F822,F823 ${{ steps.pydiff.outputs.pyfiles }} --ignore F821 | |
- name: Check for style warnings | |
run: | | |
source .venv/bin/activate && | |
python -m flake8 --exit-zero ${{ steps.pydiff.outputs.pyfiles }} |