-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from docugami/tjaffri/types
Fixed type issues and upgraded deps
- Loading branch information
Showing
17 changed files
with
2,017 additions
and
1,881 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 |
---|---|---|
@@ -1,20 +1,35 @@ | ||
name: PR Gate | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Check out the code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run setup.sh | ||
run: chmod +x setup.sh && ./setup.sh | ||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
shell: bash | ||
|
||
- name: Run static_analysis.sh | ||
run: chmod +x static_analysis.sh && ./static_analysis.sh | ||
- name: Install dependencies | ||
run: poetry install --with dev | ||
|
||
- name: Lint code | ||
run: make lint | ||
|
||
- name: Check spellings | ||
run: make spell_check | ||
|
||
- name: Test code | ||
run: make test | ||
|
||
- name: Check PR status | ||
run: | | ||
if [ -n "$(git diff --name-only ${{ github.base_ref }}..${{ github.head_ref }})" ]; then | ||
echo "Changes detected. Please make sure to push all changes to the branch before merging."; | ||
exit 1; | ||
fi |
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,6 +1,10 @@ | ||
{ | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter" | ||
}, | ||
"python.formatting.provider": "none" | ||
"python.testing.pytestArgs": [ | ||
"tests", | ||
"--doctest-modules", | ||
"tests", | ||
"docugami" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
} |
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,54 @@ | ||
.PHONY: all format lint test tests | ||
|
||
# Default target executed when no arguments are given to make. | ||
all: help | ||
|
||
# Define a variable for the test file path. | ||
TEST_FILE ?= tests/ docugami_dfm_benchmarks/ | ||
|
||
test: | ||
poetry run pytest --doctest-modules $(TEST_FILE) | ||
|
||
tests: | ||
poetry run pytest --doctest-modules $(TEST_FILE) | ||
|
||
###################### | ||
# LINTING AND FORMATTING | ||
###################### | ||
|
||
# Define a variable for Python and notebook files. | ||
PYTHON_FILES=. | ||
MYPY_CACHE=.mypy_cache | ||
lint format: PYTHON_FILES=. | ||
lint_package: PYTHON_FILES=docugami_dfm_benchmarks | ||
lint_tests: PYTHON_FILES=tests | ||
lint_tests: MYPY_CACHE=.mypy_cache_test | ||
|
||
lint lint_diff lint_package lint_tests: | ||
poetry run ruff check . | ||
poetry run ruff check $(PYTHON_FILES) --diff | ||
poetry run ruff check --select I $(PYTHON_FILES) | ||
mkdir -p $(MYPY_CACHE); poetry run mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE) | ||
|
||
format format_diff: | ||
poetry run ruff check --select I --fix $(PYTHON_FILES) | ||
|
||
spell_check: | ||
poetry run codespell --skip "./poetry.lock,./data/*,./tests/testdata/*,./temp/*" --toml pyproject.toml | ||
|
||
spell_fix: | ||
poetry run codespell --skip "./poetry.lock,./data/*,./tests/testdata/*,./temp/*" --toml pyproject.toml -w | ||
|
||
|
||
###################### | ||
# HELP | ||
###################### | ||
|
||
help: | ||
@echo '----' | ||
@echo 'format - run code formatters' | ||
@echo 'lint - run linters' | ||
@echo 'spell_check - run spell checker' | ||
@echo 'test - run unit tests' | ||
@echo 'tests - run unit tests' | ||
@echo 'test TEST_FILE=<test_file> - run all tests in file' |
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 was deleted.
Oops, something went wrong.
Empty file.
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
Oops, something went wrong.