diff --git a/.github/workflows/github-python-workflow.yml b/.github/workflows/github-python-workflow.yml new file mode 100644 index 0000000..b9056a1 --- /dev/null +++ b/.github/workflows/github-python-workflow.yml @@ -0,0 +1,38 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python Workflow + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: "3.11" + - name: Install dependencies + run: | + pip install --upgrade pip setuptools && pip install .[dev] + - name: Run flake8 lint checks + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics + - name: Run black format checks + run: black --check --diff ogc example || true # For now pass even if files need formatting + - name: Run pytest with coverage + run: | + pytest -v --cov=ogc diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..08cb765 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: +- repo: https://github.com/ambv/black + rev: stable + hooks: + - id: black + language_version: python3 + files: (^ogc|^example) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 0145581..3411a4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,7 @@ dev = [ # FORMATTING "pre_commit", "black", + "flake8", ] [tool.setuptools.packages.find]