-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
654 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# .editorconfig | ||
|
||
# Check http://editorconfig.org for more information | ||
# top-most .editorconfig file | ||
root = true | ||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
[*.py] | ||
indent_size = 4 | ||
[Makefile] | ||
indent_style = tab | ||
[*.md] | ||
trim_trailing_whitespace = false | ||
[*.{yaml,yml}] | ||
indent_size = 2 |
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,4 @@ | ||
# .flake8 | ||
[flake8] | ||
max-line-length = 88 | ||
extend-ignore = E203 |
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,39 @@ | ||
--- | ||
name: Linting | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
Linting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# check-out repo | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
# install poetry | ||
- name: Install poetry | ||
run: pipx install poetry==1.2.0 | ||
# set-up python with cache | ||
- name: Setup Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
cache: 'poetry' | ||
# install requirements (including dev dependencies) | ||
- name: Install requirements | ||
run: poetry install --with lint | ||
# run linters | ||
- name: Run linters | ||
run: | | ||
set -o pipefail | ||
poetry run make lint |
7 changes: 5 additions & 2 deletions
7
.github/workflows/build_release.yml → .github/workflows/test_build_dev.old
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,100 @@ | ||
name: "Test, Build, Publish: Main" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.9", "3.8"] | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python${{ matrix.python-version }} -m venv env | ||
source env/bin/activate | ||
python -m pip install --upgrade pip setuptools | ||
python -m pip install ".[dev]" | ||
|
||
- name: "Static analysis: pylint" | ||
run: | | ||
source env/bin/activate | ||
pylint -d C0301 $(git ls-files '*.py') | ||
|
||
- name: "Static analysis: mypy" | ||
run: | | ||
source env/bin/activate | ||
python -m mypy src/which_plates/*.py | ||
|
||
- name: "Static analysis: flake8" | ||
run: | | ||
source env/bin/activate | ||
flake8 --statistics --count --max-line-length=130 --max-complexity 8 src/which_plates/*.py | ||
|
||
- name: "Static analysis: safety" | ||
run: | | ||
source env/bin/activate | ||
safety check | ||
|
||
- name: "Test: pytest" | ||
run: | | ||
source env/bin/activate | ||
pytest --cov which_plates --junitxml=pytest.xml --cov-report=term-missing:skip-covered src/which_plates/tests/ | tee pytest-coverage.txt | ||
|
||
- name: Pytest coverage comment | ||
uses: MishaKav/pytest-coverage-comment@main | ||
with: | ||
pytest-coverage-path: ./pytest-coverage.txt | ||
junitxml-path: ./pytest.xml | ||
|
||
release: | ||
needs: build | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python${{ matrix.python-version }} -m venv env | ||
source env/bin/activate | ||
python -m pip install --upgrade pip setuptools | ||
python -m pip install ".[dev]" | ||
|
||
- name: Build package | ||
run: | | ||
source env/bin/activate | ||
python -m build | ||
|
||
- name: Archive package | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: which_plates | ||
path: dist/ | ||
|
||
- name: Publish distribution to PyPI | ||
uses: pypa/[email protected] | ||
if: github.repository == 'iandday/whichPlates' && matrix.python-version == '3.10' && github.event_name == 'push') | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
|
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,24 @@ | ||
format-black: | ||
@black . | ||
|
||
format-isort: | ||
@isort . | ||
|
||
lint-black: | ||
@black . --check | ||
|
||
lint-isort: | ||
@isort . --check | ||
|
||
lint-flake8: | ||
@flake8 . | ||
|
||
lint-mypy: | ||
@mypy ./src | ||
|
||
lint-mypy-report: | ||
@mypy ./src --html-report ./mypy_html | ||
|
||
format: format-black format-isort | ||
|
||
lint: lint-black lint-isort lint-flake8 lint-mypy |
Oops, something went wrong.