From e0aaa579c0bc6367a3e4eb6f4211ce1c11108bdb Mon Sep 17 00:00:00 2001 From: Paul-Edouard Sarlin Date: Mon, 19 Feb 2024 22:48:58 +0100 Subject: [PATCH] Add formatting CI --- .github/workflows/code-quality.yml | 26 ++++++++++++++++++++++++++ .isort.cfg | 2 ++ requirements/dev.txt | 3 +++ 3 files changed, 31 insertions(+) create mode 100644 .github/workflows/code-quality.yml create mode 100644 .isort.cfg create mode 100644 requirements/dev.txt diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 0000000..8342c4b --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,26 @@ +name: Format and Lint Checks +on: + push: + branches: + - master + paths: + - '*.py' + - '*.ipynb' + pull_request: + types: [ assigned, opened, synchronize, reopened ] +jobs: + check: + name: Format and Lint Checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: 'pip' + cache-dependency-path: 'requirements/dev.txt' + - run: python -m pip install --upgrade pip + - run: python -m pip install -r requirements/dev.txt + - run: python -m flake8 maploc + - run: python -m isort maploc *.ipynb --check-only --diff + - run: python -m black maploc *.ipynb --check --diff diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 0000000..b9fb3f3 --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,2 @@ +[settings] +profile=black diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 0000000..acae39b --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1,3 @@ +black[jupyter]==24.2.0 +isort +flake8