-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Migrate to pyproject.toml * Migrate to pyproject.toml * Migrate to pyproject.toml * Migrate to pyproject.toml * Migrate to pyproject.toml * Migrate to pyproject.toml * Migrate to ruff * Migrate to ruff * Correct delta and improve type hints * Fix validate flow * Formatting * more typing * pylint * pylint * pytest * Update dev requirements * Update build action and poetry --------- Co-authored-by: jbouwh <[email protected]>
- Loading branch information
Showing
20 changed files
with
2,223 additions
and
251 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
--- | ||
name: Linting | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
DEFAULT_PYTHON: "3.9" | ||
|
||
jobs: | ||
codespell: | ||
name: codespell | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
- name: 🏗 Set up Poetry | ||
run: pipx install poetry | ||
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} | ||
id: python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
cache: "poetry" | ||
- name: 🏗 Install workflow dependencies | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
- name: 🏗 Install Python dependencies | ||
run: poetry install --no-interaction | ||
- name: 🚀 Check code for common misspellings | ||
run: poetry run pre-commit run codespell --all-files | ||
|
||
ruff: | ||
name: Ruff | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
- name: 🏗 Set up Poetry | ||
run: pipx install poetry | ||
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} | ||
id: python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
cache: "poetry" | ||
- name: 🏗 Install workflow dependencies | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
- name: 🏗 Install Python dependencies | ||
run: poetry install --no-interaction | ||
- name: 🚀 Run ruff linter | ||
run: poetry run ruff check --output-format=github . | ||
- name: 🚀 Run ruff formatter | ||
run: poetry run ruff format --check . | ||
|
||
pre-commit-hooks: | ||
name: pre-commit-hooks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
- name: 🏗 Set up Poetry | ||
run: pipx install poetry | ||
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} | ||
id: python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
cache: "poetry" | ||
- name: 🏗 Install workflow dependencies | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
- name: 🏗 Install Python dependencies | ||
run: poetry install --no-interaction | ||
- name: 🚀 Check Python AST | ||
run: poetry run pre-commit run check-ast --all-files | ||
- name: 🚀 Check for case conflicts | ||
run: poetry run pre-commit run check-case-conflict --all-files | ||
- name: 🚀 Check docstring is first | ||
run: poetry run pre-commit run check-docstring-first --all-files | ||
- name: 🚀 Check that executables have shebangs | ||
run: poetry run pre-commit run check-executables-have-shebangs --all-files | ||
- name: 🚀 Check JSON files | ||
run: poetry run pre-commit run check-json --all-files | ||
- name: 🚀 Check for merge conflicts | ||
run: poetry run pre-commit run check-merge-conflict --all-files | ||
- name: 🚀 Check for broken symlinks | ||
run: poetry run pre-commit run check-symlinks --all-files | ||
- name: 🚀 Check TOML files | ||
run: poetry run pre-commit run check-toml --all-files | ||
- name: 🚀 Check XML files | ||
run: poetry run pre-commit run check-xml --all-files | ||
- name: 🚀 Check YAML files | ||
run: poetry run pre-commit run check-yaml --all-files | ||
- name: 🚀 Detect Private Keys | ||
run: poetry run pre-commit run detect-private-key --all-files | ||
- name: 🚀 Check End of Files | ||
run: poetry run pre-commit run end-of-file-fixer --all-files | ||
- name: 🚀 Trim Trailing Whitespace | ||
run: poetry run pre-commit run trailing-whitespace --all-files | ||
|
||
pylint: | ||
name: pylint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
- name: 🏗 Set up Poetry | ||
run: pipx install poetry | ||
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} | ||
id: python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
cache: "poetry" | ||
- name: 🏗 Install workflow dependencies | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
- name: 🏗 Install Python dependencies | ||
run: poetry install --no-interaction | ||
- name: 🚀 Run pylint | ||
run: poetry run pre-commit run pylint --all-files | ||
|
||
yamllint: | ||
name: yamllint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
- name: 🏗 Set up Poetry | ||
run: pipx install poetry | ||
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} | ||
id: python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
cache: "poetry" | ||
- name: 🏗 Install workflow dependencies | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
- name: 🏗 Install Python dependencies | ||
run: poetry install --no-interaction | ||
- name: 🚀 Run yamllint | ||
run: poetry run yamllint . |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,50 @@ | ||
--- | ||
name: Python application validation | ||
|
||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Python application validation | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
branches: [ "master" ] | ||
branches: | ||
- master | ||
pull_request: | ||
branches: [ "master" ] | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.12" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=C,E,F,W,B,B950 --ignore=E203,E501,W503 --show-source --statistics | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics | ||
- name: "Check formatting 1: black" | ||
run: | | ||
black --diff --check *client.py | ||
black --diff --check incomfort* | ||
- name: "Check formatting 2: isort" | ||
run: | | ||
isort --check --diff *client.py | ||
isort --check --diff incomfort* | ||
- name: Test with pytest | ||
run: | | ||
pytest | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.12" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=C,E,F,W,B,B950 --ignore=E203,E501,W503 --show-source --statistics | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics | ||
- name: "Check formatting 1: black" | ||
run: | | ||
black --diff --check *client.py | ||
black --diff --check src/incomfort* | ||
- name: "Check formatting 2: isort" | ||
run: | | ||
isort --check --diff *client.py | ||
isort --check --diff src/incomfort* | ||
- name: Test with pytest | ||
run: | | ||
pytest |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.