Skip to content

Commit

Permalink
Replace scripts with Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
harens committed Jul 6, 2021
1 parent ba563a9 commit c6f2e58
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 90 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8

[Makefile]
indent_style = tab
24 changes: 10 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
test-file: [dependencies, formatting, pytest, type_checking]
test-section: [dependencies, formatting, pytest, type-checking]
exclude: # See https://github.521000.bestmunity/t/improve-matrix-exclusion-feature/16340
- {test-file: dependencies, python-version: 3.6}
- {test-file: dependencies, python-version: 3.7}
- {test-file: dependencies, python-version: 3.8}
- {test-file: formatting, python-version: 3.6}
- {test-file: formatting, python-version: 3.7}
- {test-file: formatting, python-version: 3.8}
- {test-section: dependencies, python-version: 3.6}
- {test-section: dependencies, python-version: 3.7}
- {test-section: dependencies, python-version: 3.8}
- {test-section: formatting, python-version: 3.6}
- {test-section: formatting, python-version: 3.7}
- {test-section: formatting, python-version: 3.8}
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -30,17 +30,13 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
brew install shellcheck
python -m pip install -U pip poetry
poetry --version
poetry install
- name: ShellCheck
run: |
shellcheck scripts/*.sh
- name: Test ${{ matrix.test-file }}
run: bash ./scripts/tests/${{ matrix.test-file }}.sh
- name: Test ${{ matrix.test-section }}
run: make ${{ matrix.test-section }}
- name: Upload coverage to Codecov
if: matrix.test-file == 'pytest'
if: matrix.test-section == 'pytest'
uses: codecov/[email protected]
with:
file: ./coverage.xml
Expand Down
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
all: lint test

lint: ## Runs black and isort
poetry run $(MAKE) lint-poetry

lint-poetry:
python -m isort .
python -m black .

test: pytest type-checking formatting dependencies ## Runs all available tests (pytest, type checking, etc.)

# TODO: LOCATION = checkdigit/ tests/
pytest: ## Runs pytest on docstrings and the tests folder and outputs coverage.xml
poetry run python -m pytest --cov-report=xml:coverage.xml --cov=checkdigit --doctest-modules checkdigit/ tests/

type-checking: ## Runs mypy --strict
poetry run python -m mypy --strict .

dependencies: ## Verifies pyproject.toml file integrity
poetry check
poetry run python -m pip check

formatting: ## Tests whether formatting meets standards
poetry run $(MAKE) formatting-poetry

formatting-poetry:
python -m black --check .
python -m isort --check-only .
python -m pylint checkdigit
python -m pydocstyle --convention=google
5 changes: 3 additions & 2 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ First, fork the `GitHub project <https://github.com/harens/checkdigit>`_ to your
.. code-block:: console
git clone https://github.com/INSERT_GITHUB_NAME/checkdigit
cd checkdigit
poetry install && poetry shell
pre-commit install
Before submitting any new changes, please run :code:`make` beforehand. This formats the code and runs the tests. Thank you :)

🏛 Project structure
---------------------

Expand All @@ -66,8 +69,6 @@ First, fork the `GitHub project <https://github.com/harens/checkdigit>`_ to your

Each new format should go into a separate file which is named accordingly.

Before submitting any new changes, please run the :code:`format.sh` and :code:`tests.sh` scripts beforehand. Thank you :)

📚 Building the Docs
---------------------

Expand Down
13 changes: 0 additions & 13 deletions scripts/format.sh

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/tests.sh

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/tests/dependencies.sh

This file was deleted.

14 changes: 0 additions & 14 deletions scripts/tests/formatting.sh

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/tests/pytest.sh

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/tests/type_checking.sh

This file was deleted.

0 comments on commit c6f2e58

Please sign in to comment.