diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml new file mode 100644 index 0000000..947de61 --- /dev/null +++ b/.github/workflows/linting.yaml @@ -0,0 +1,33 @@ +name: Linting Linux + +on: + pull_request: + +jobs: + linting: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: + - "3.11" + + name: linting + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version : ${{ matrix.python-version }} + + - name: Install flake8 + run: | + python -m pip install flake8 + + - name: Check format without making corrections + run: | + flake8 diff --git a/.github/workflows/unit-test.yaml b/.github/workflows/unit-test.yaml index e846e84..4b7dbf2 100644 --- a/.github/workflows/unit-test.yaml +++ b/.github/workflows/unit-test.yaml @@ -1,11 +1,13 @@ name: Unit Test Linux on: - push: - # pull_request: + workflow_run: + workflows: [Linting Linux] + types: + - completed jobs: - run-tests: + unit-test: strategy: fail-fast: false matrix: @@ -15,7 +17,7 @@ jobs: name: unit-test runs-on: ${{ matrix.os }} - # runs-on: python:alpine + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout code @@ -37,4 +39,3 @@ jobs: - name: Run tests run: | python -m unittest discover -v - diff --git a/funcs/__init__.py b/funcs/__init__.py index 2b8e6eb..5a86c79 100644 --- a/funcs/__init__.py +++ b/funcs/__init__.py @@ -1 +1 @@ -# placeholder file to modularize (to package) .py files under the directory "funcs", making the files importable. \ No newline at end of file +# placeholder file to modularize (to package) .py files under the directory "tests", making the files importable. diff --git a/funcs/func.py b/funcs/func.py index 46d0d23..8d531d0 100644 --- a/funcs/func.py +++ b/funcs/func.py @@ -1,2 +1,2 @@ def sum(x: float, y: float) -> float: - return x + y \ No newline at end of file + return x + y diff --git a/requirements.txt b/requirements.txt index 1b946d5..51a2c28 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,4 @@ -annotated-types==0.5.0 -anyio==3.7.1 -fastapi==0.101.1 -idna==3.4 -numpy==1.25.2 -pandas==2.0.3 -pydantic==2.3.0 -pydantic_core==2.6.3 -python-dateutil==2.8.2 -pytz==2023.3 -six==1.16.0 -sniffio==1.3.0 -starlette==0.27.0 -typing_extensions==4.7.1 -tzdata==2023.3 +flake8==6.1.0 +mccabe==0.7.0 +pycodestyle==2.11.0 +pyflakes==3.1.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..66da313 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,10 @@ +[flake8] +max-line-length = 120 +exclude = + .git, + __pycache__, + docs/source/conf.py, + old, + build, + dist, + venv diff --git a/tests/__init__.py b/tests/__init__.py index 61d14e5..5a86c79 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -# placeholder file to modularize (to package) .py files under the directory "tests", making the files importable. \ No newline at end of file +# placeholder file to modularize (to package) .py files under the directory "tests", making the files importable. diff --git a/tests/test_func.py b/tests/test_func.py index 2d37034..8618217 100644 --- a/tests/test_func.py +++ b/tests/test_func.py @@ -1,10 +1,12 @@ import unittest from funcs import func + class Test(unittest.TestCase): def test_sum(self): - self.assertEqual(func.sum(2,3), 5) + self.assertEqual(func.sum(2, 3), 5) + if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main()