From 946ee9b91b281fdcc268834c5da7e24ad2f6ce8c Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:14:06 -0400 Subject: [PATCH] Add old workflows back --- .github/workflows/black.yml | 25 ++++++++++++++++++ .github/workflows/flake8.yml | 25 ++++++++++++++++++ .github/workflows/isort.yml | 25 ++++++++++++++++++ .github/workflows/lfendings.yml | 24 ++++++++++++++++++ .github/workflows/lint.yml | 45 --------------------------------- .github/workflows/pylint.yml | 25 ++++++++++++++++++ 6 files changed, 124 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/black.yml create mode 100644 .github/workflows/flake8.yml create mode 100644 .github/workflows/isort.yml create mode 100644 .github/workflows/lfendings.yml delete mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/pylint.yml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 000000000..d0ac8e0fe --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,25 @@ +name: Black + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + blackCheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: 3.11 + - name: Install dependencies + run: | + python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile) + BLACK_VERSION=$(sed -nE 's/black = "==(.*)"/\1/p' Pipfile) + pip install black==$BLACK_VERSION + - name: Analysing the code with black + run: | + black $(git rev-parse --show-toplevel) --check diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml new file mode 100644 index 000000000..b2570d061 --- /dev/null +++ b/.github/workflows/flake8.yml @@ -0,0 +1,25 @@ +name: flake8 + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + Flake8: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: 3.11 + - name: Install dependencies + run: | + python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile) + pip install pipenv==$(sed -nE 's/pipenv = "==(.*)"/\1/p' Pipfile) + pipenv install --system + - name: Analysing the code with flake8 + run: | + flake8 $(git rev-parse --show-toplevel) diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml new file mode 100644 index 000000000..122e981ef --- /dev/null +++ b/.github/workflows/isort.yml @@ -0,0 +1,25 @@ +name: isort + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + isortCheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: 3.11 + - name: Install dependencies + run: | + python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile) + ISORT_VERSION=$(sed -nE 's/isort = "==(.*)"/\1/p' Pipfile) + pip install isort==$ISORT_VERSION + - name: Analysing the code with isort + run: | + isort --check-only $(git rev-parse --show-toplevel)/ --profile black diff --git a/.github/workflows/lfendings.yml b/.github/workflows/lfendings.yml new file mode 100644 index 000000000..01b8e873b --- /dev/null +++ b/.github/workflows/lfendings.yml @@ -0,0 +1,24 @@ +name: Check Line Endings + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + check-line-endings: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check for CRLF line endings + run: | + for file in $(git ls-files); do + if grep -q $'\r$' "$file"; then + echo "$file has faulty file endings" + fi + done + if git grep -I --name-only $'\r'; then + echo "CRLF line endings detected" + exit 1 + fi diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 0f2c483f2..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Linting - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - Linting: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.11 - uses: actions/setup-python@v3 - with: - python-version: 3.11 - - name: Install dependencies - run: | - python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile) - pip install pipenv==$(sed -nE 's/pipenv = "==(.*)"/\1/p' Pipfile) - pipenv install --system - - name: Analysing the code with black - run: | - black $(git rev-parse --show-toplevel) --check - - name: Analysing the code with flake8 - run: | - flake8 $(git rev-parse --show-toplevel) - - name: Analysing the code with isort - run: | - isort --check-only $(git rev-parse --show-toplevel)/ --profile black - - name: Analysing the code with pylint - run: | - pylint $(git ls-files '*.py') - - name: Check for CRLF line endings - run: | - for file in $(git ls-files); do - if grep -q $'\r$' "$file"; then - echo "$file has faulty file endings" - fi - done - if git grep -I --name-only $'\r'; then - echo "CRLF line endings detected" - exit 1 - fi diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 000000000..04904f4d8 --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,25 @@ +name: Pylint + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + pylintTest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: 3.11 + - name: Install dependencies + run: | + python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile) + PYLINT_VERSION=$(sed -nE 's/pylint = "==(.*)"/\1/p' Pipfile) + pip install pylint==$PYLINT_VERSION + - name: Analysing the code with pylint + run: | + pylint $(git ls-files '*.py')