From f61acb00fb67c2461eca3d090d80aae0f2d8c5da Mon Sep 17 00:00:00 2001 From: PipeItToDevNull Date: Thu, 11 Jul 2024 21:36:45 -0400 Subject: [PATCH 1/6] concatenation of all prior CI and addition of dependabot close steps for semver patches on specific packages --- .github/workflows/black.yml | 25 ---- .github/workflows/ci.yml | 198 +++++++++++++++++++++++++++++ .github/workflows/docker-image.yml | 18 --- .github/workflows/flake8.yml | 25 ---- .github/workflows/isort.yml | 25 ---- .github/workflows/lfendings.yml | 24 ---- .github/workflows/pylint.yml | 25 ---- .github/workflows/pytest.yml | 31 ----- 8 files changed, 198 insertions(+), 173 deletions(-) delete mode 100644 .github/workflows/black.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/docker-image.yml delete mode 100644 .github/workflows/flake8.yml delete mode 100644 .github/workflows/isort.yml delete mode 100644 .github/workflows/lfendings.yml delete mode 100644 .github/workflows/pylint.yml delete mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index d0ac8e0fe..000000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,25 +0,0 @@ -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/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..b85fd9c8f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,198 @@ +name: Test and build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + pyTest: + 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 pip + run: | + python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile) + - name: Install pipenv + run: | + PIPENV_VERSION=$(sed -nE 's/pipenv = "==(.*)"/\1/p' Pipfile) + python -m pip install pipenv==$PIPENV_VERSION + - name: Install from pipfile + run: | + pipenv install --system + - name: Running pytest + run: | + cd techsupport_bot + python3.11 -m pytest tests/ -p no:warnings + + pyLint: + 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') + + lineEndingCheck: + 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 + + 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) + + isort: + 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 + + containerBuild: + runs-on: ubuntu-latest + needs: + - pyTest + - pyLint + - flake8 + - isort + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: make establish_config && docker build -f Dockerfile . -t techsupportbot:$(date +%s) + + close_pyTest: + if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + needs: + - pyTest + permissions: + contents: write + pull-requests: write + steps: + - name: Dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Merge PR + if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && \ + steps.dependabot-metadata.outputs.dependency-names == 'pytest' + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + + close_pyLint: + if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + needs: + - pyLint + permissions: + contents: write + pull-requests: write + steps: + - name: Dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Merge PR + if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && \ + steps.dependabot-metadata.outputs.dependency-names == 'pylint' + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + + close_flake8: + if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + needs: + - flake8 + permissions: + contents: write + pull-requests: write + steps: + - name: Dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Merge PR + if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && \ + steps.dependabot-metadata.outputs.dependency-names == 'pylint' + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + + close_isort: + if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + needs: + - isort + permissions: + contents: write + pull-requests: write + steps: + - name: Dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Merge PR + if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && \ + steps.dependabot-metadata.outputs.dependency-names == 'isort' + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index a9fdc5b7a..000000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: make establish_config && docker build -f Dockerfile . -t techsupportbot:$(date +%s) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml deleted file mode 100644 index b2570d061..000000000 --- a/.github/workflows/flake8.yml +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index 122e981ef..000000000 --- a/.github/workflows/isort.yml +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index 01b8e873b..000000000 --- a/.github/workflows/lfendings.yml +++ /dev/null @@ -1,24 +0,0 @@ -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/pylint.yml b/.github/workflows/pylint.yml deleted file mode 100644 index 04904f4d8..000000000 --- a/.github/workflows/pylint.yml +++ /dev/null @@ -1,25 +0,0 @@ -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') diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml deleted file mode 100644 index d4ad0a40d..000000000 --- a/.github/workflows/pytest.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: PyTest - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - PyTests: - 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 pip - run: | - python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile) - - name: Install pipenv - run: | - PIPENV_VERSION=$(sed -nE 's/pipenv = "==(.*)"/\1/p' Pipfile) - python -m pip install pipenv==$PIPENV_VERSION - - name: Install from pipfile - run: | - pipenv install --system - - name: Running pytest - run: | - cd techsupport_bot - python3.11 -m pytest tests/ -p no:warnings \ No newline at end of file From 7977c2164d97a3aa604953c6bb4380df478908fc Mon Sep 17 00:00:00 2001 From: PipeItToDevNull Date: Thu, 11 Jul 2024 21:46:43 -0400 Subject: [PATCH 2/6] correct invalid yaml --- .github/workflows/ci.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b85fd9c8f..5cfdb3711 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: containerBuild: runs-on: ubuntu-latest needs: - - pyTest + - pyTests - pyLint - flake8 - isort @@ -124,8 +124,7 @@ jobs: with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Merge PR - if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && \ - steps.dependabot-metadata.outputs.dependency-names == 'pytest' + if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'pytest' run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} @@ -146,8 +145,7 @@ jobs: with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Merge PR - if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && \ - steps.dependabot-metadata.outputs.dependency-names == 'pylint' + if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'pylint' run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} @@ -168,8 +166,7 @@ jobs: with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Merge PR - if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && \ - steps.dependabot-metadata.outputs.dependency-names == 'pylint' + if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'pylint' run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} @@ -190,8 +187,7 @@ jobs: with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Merge PR - if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && \ - steps.dependabot-metadata.outputs.dependency-names == 'isort' + if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'isort' run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} From 2cfca42a49a0ba2382b3089d8bb6cab8c1504685 Mon Sep 17 00:00:00 2001 From: PipeItToDevNull Date: Thu, 11 Jul 2024 21:47:40 -0400 Subject: [PATCH 3/6] correct s --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cfdb3711..522a13b05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: containerBuild: runs-on: ubuntu-latest needs: - - pyTests + - pyTest - pyLint - flake8 - isort From 88a9cfef6670b049df35469bc8b7ed277e7816b6 Mon Sep 17 00:00:00 2001 From: PipeItToDevNull Date: Thu, 11 Jul 2024 21:49:17 -0400 Subject: [PATCH 4/6] add removed word --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 522a13b05..b812286c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: pip install isort==$ISORT_VERSION - name: Analysing the code with isort run: | - isort --check-only $(git rev-parse --show-toplevel)/ --profile + isort --check-only $(git rev-parse --show-toplevel)/ --profile black containerBuild: runs-on: ubuntu-latest From 73a342c766113e186b2501a6ceacdfc119e2fd5b Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 22:18:17 -0400 Subject: [PATCH 5/6] Add black, fix flake8 ci --- .github/workflows/ci.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b812286c8..55a334733 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,23 @@ jobs: cd techsupport_bot python3.11 -m pytest tests/ -p no:warnings + 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 + pyLint: runs-on: ubuntu-latest steps: @@ -166,7 +183,7 @@ jobs: with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Merge PR - if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'pylint' + if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'flake8' run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} @@ -191,4 +208,4 @@ jobs: run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} - GH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} From a91aad59db73f085a166c26387e0852621e8f840 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 22:19:25 -0400 Subject: [PATCH 6/6] rename black test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55a334733..b31cfb58f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: cd techsupport_bot python3.11 -m pytest tests/ -p no:warnings - blackCheck: + black: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3