Skip to content

Commit

Permalink
move
Browse files Browse the repository at this point in the history
  • Loading branch information
iandday committed Apr 10, 2023
1 parent d0325d0 commit f041344
Show file tree
Hide file tree
Showing 13 changed files with 654 additions and 45 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
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
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .flake8
[flake8]
max-line-length = 88
extend-ignore = E203
39 changes: 39 additions & 0 deletions .github/workflows/lint.yml
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: "Test, Build, Publish: Main"
name: "Test, Build, Publish: Dev"

on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop


jobs:
build:
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/test_build_main.old
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 }}


24 changes: 24 additions & 0 deletions Makefile
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
Loading

0 comments on commit f041344

Please sign in to comment.