Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 12 additions & 133 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ on:
types: [opened, labeled]

jobs:
pyTest:
codeValidation:
if: |
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
(
contains(github.event.pull_request.title, '[run ci]') ||
contains(github.event.pull_request.body, '[run ci]') ||
contains(join(github.event.pull_request.labels.*.name), 'run-ci')
)
)
Expand All @@ -36,79 +34,12 @@ jobs:
- name: Install from pipfile
run: |
pipenv install --system
- name: Running pytest
run: |
cd techsupport_bot
python3.11 -m pytest tests/ -p no:warnings

black:
if: |
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
(
contains(github.event.pull_request.title, '[run ci]') ||
contains(github.event.pull_request.body, '[run ci]') ||
contains(join(github.event.pull_request.labels.*.name), 'run-ci')
)
)
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:
if: |
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
(
contains(github.event.pull_request.title, '[run ci]') ||
contains(github.event.pull_request.body, '[run ci]') ||
contains(join(github.event.pull_request.labels.*.name), 'run-ci')
)
)
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:
if: |
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
(
contains(github.event.pull_request.title, '[run ci]') ||
contains(github.event.pull_request.body, '[run ci]') ||
contains(join(github.event.pull_request.labels.*.name), 'run-ci')
)
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check for CRLF line endings
run: |
for file in $(git ls-files); do
Expand All @@ -120,78 +51,26 @@ jobs:
echo "CRLF line endings detected"
exit 1
fi

flake8:
if: |
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
(
contains(github.event.pull_request.title, '[run ci]') ||
contains(github.event.pull_request.body, '[run ci]') ||
contains(join(github.event.pull_request.labels.*.name), 'run-ci')
)
)
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:
if: |
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
(
contains(github.event.pull_request.title, '[run ci]') ||
contains(github.event.pull_request.body, '[run ci]') ||
contains(join(github.event.pull_request.labels.*.name), 'run-ci')
)
)
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
- name: Running pytest
run: |
cd techsupport_bot
python3.11 -m pytest tests/ -p no:warnings

containerBuild:
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' &&
(
github.event_name == 'pull_request' &&
(
contains(github.event.pull_request.title, '[run ci]') ||
contains(github.event.pull_request.body, '[run ci]') ||
contains(join(github.event.pull_request.labels.*.name), 'run-ci')
)
contains(join(github.event.pull_request.labels.*.name), 'run-ci')
)
runs-on: ubuntu-latest
needs:
- pyTest
- pyLint
- flake8
- isort
- codeValidation
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
Expand All @@ -201,7 +80,7 @@ jobs:
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
needs:
- pyTest
- codeValidation
permissions:
contents: write
pull-requests: write
Expand All @@ -222,7 +101,7 @@ jobs:
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
needs:
- pyLint
- codeValidation
permissions:
contents: write
pull-requests: write
Expand All @@ -243,7 +122,7 @@ jobs:
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
needs:
- flake8
- codeValidation
permissions:
contents: write
pull-requests: write
Expand All @@ -264,7 +143,7 @@ jobs:
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
needs:
- isort
- codeValidation
permissions:
contents: write
pull-requests: write
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened, labeled]
Expand Down
Loading