Skip to content

Commit 6b01f9f

Browse files
PipeItToDevNulldkay0670ajax146
authored
concatenation of all prior CI and addition of dependabot close steps … (#1075)
* concatenation of all prior CI and addition of dependabot close steps for semver patches on specific packages * correct invalid yaml * correct s * add removed word * Add black, fix flake8 ci * rename black test --------- Co-authored-by: dkay <dkay@nortnet.org> Co-authored-by: ajax146 <31014239+ajax146@users.noreply.github.com>
1 parent 87eef24 commit 6b01f9f

8 files changed

Lines changed: 211 additions & 173 deletions

File tree

.github/workflows/black.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
name: Test and build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
pyTest:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python 3.11
15+
uses: actions/setup-python@v3
16+
with:
17+
python-version: 3.11
18+
- name: Install pip
19+
run: |
20+
python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile)
21+
- name: Install pipenv
22+
run: |
23+
PIPENV_VERSION=$(sed -nE 's/pipenv = "==(.*)"/\1/p' Pipfile)
24+
python -m pip install pipenv==$PIPENV_VERSION
25+
- name: Install from pipfile
26+
run: |
27+
pipenv install --system
28+
- name: Running pytest
29+
run: |
30+
cd techsupport_bot
31+
python3.11 -m pytest tests/ -p no:warnings
32+
33+
black:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Set up Python 3.11
38+
uses: actions/setup-python@v3
39+
with:
40+
python-version: 3.11
41+
- name: Install dependencies
42+
run: |
43+
python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile)
44+
BLACK_VERSION=$(sed -nE 's/black = "==(.*)"/\1/p' Pipfile)
45+
pip install black==$BLACK_VERSION
46+
- name: Analysing the code with black
47+
run: |
48+
black $(git rev-parse --show-toplevel) --check
49+
50+
pyLint:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v3
54+
- name: Set up Python 3.11
55+
uses: actions/setup-python@v3
56+
with:
57+
python-version: 3.11
58+
- name: Install dependencies
59+
run: |
60+
python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile)
61+
PYLINT_VERSION=$(sed -nE 's/pylint = "==(.*)"/\1/p' Pipfile)
62+
pip install pylint==$PYLINT_VERSION
63+
- name: Analysing the code with pylint
64+
run: |
65+
pylint $(git ls-files '*.py')
66+
67+
lineEndingCheck:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v3
71+
- name: Check for CRLF line endings
72+
run: |
73+
for file in $(git ls-files); do
74+
if grep -q $'\r$' "$file"; then
75+
echo "$file has faulty file endings"
76+
fi
77+
done
78+
if git grep -I --name-only $'\r'; then
79+
echo "CRLF line endings detected"
80+
exit 1
81+
fi
82+
83+
flake8:
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v3
87+
- name: Set up Python 3.11
88+
uses: actions/setup-python@v3
89+
with:
90+
python-version: 3.11
91+
- name: Install dependencies
92+
run: |
93+
python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile)
94+
pip install pipenv==$(sed -nE 's/pipenv = "==(.*)"/\1/p' Pipfile)
95+
pipenv install --system
96+
- name: Analysing the code with flake8
97+
run: |
98+
flake8 $(git rev-parse --show-toplevel)
99+
100+
isort:
101+
runs-on: ubuntu-latest
102+
steps:
103+
- uses: actions/checkout@v3
104+
- name: Set up Python 3.11
105+
uses: actions/setup-python@v3
106+
with:
107+
python-version: 3.11
108+
- name: Install dependencies
109+
run: |
110+
python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile)
111+
ISORT_VERSION=$(sed -nE 's/isort = "==(.*)"/\1/p' Pipfile)
112+
pip install isort==$ISORT_VERSION
113+
- name: Analysing the code with isort
114+
run: |
115+
isort --check-only $(git rev-parse --show-toplevel)/ --profile black
116+
117+
containerBuild:
118+
runs-on: ubuntu-latest
119+
needs:
120+
- pyTest
121+
- pyLint
122+
- flake8
123+
- isort
124+
steps:
125+
- uses: actions/checkout@v3
126+
- name: Build the Docker image
127+
run: make establish_config && docker build -f Dockerfile . -t techsupportbot:$(date +%s)
128+
129+
close_pyTest:
130+
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
131+
runs-on: ubuntu-latest
132+
needs:
133+
- pyTest
134+
permissions:
135+
contents: write
136+
pull-requests: write
137+
steps:
138+
- name: Dependabot metadata
139+
id: dependabot-metadata
140+
uses: dependabot/fetch-metadata@v2
141+
with:
142+
github-token: "${{ secrets.GITHUB_TOKEN }}"
143+
- name: Merge PR
144+
if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'pytest'
145+
run: gh pr merge --auto --merge "$PR_URL"
146+
env:
147+
PR_URL: ${{github.event.pull_request.html_url}}
148+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
149+
150+
close_pyLint:
151+
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
152+
runs-on: ubuntu-latest
153+
needs:
154+
- pyLint
155+
permissions:
156+
contents: write
157+
pull-requests: write
158+
steps:
159+
- name: Dependabot metadata
160+
id: dependabot-metadata
161+
uses: dependabot/fetch-metadata@v2
162+
with:
163+
github-token: "${{ secrets.GITHUB_TOKEN }}"
164+
- name: Merge PR
165+
if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'pylint'
166+
run: gh pr merge --auto --merge "$PR_URL"
167+
env:
168+
PR_URL: ${{github.event.pull_request.html_url}}
169+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
170+
171+
close_flake8:
172+
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
173+
runs-on: ubuntu-latest
174+
needs:
175+
- flake8
176+
permissions:
177+
contents: write
178+
pull-requests: write
179+
steps:
180+
- name: Dependabot metadata
181+
id: dependabot-metadata
182+
uses: dependabot/fetch-metadata@v2
183+
with:
184+
github-token: "${{ secrets.GITHUB_TOKEN }}"
185+
- name: Merge PR
186+
if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'flake8'
187+
run: gh pr merge --auto --merge "$PR_URL"
188+
env:
189+
PR_URL: ${{github.event.pull_request.html_url}}
190+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
191+
192+
close_isort:
193+
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
194+
runs-on: ubuntu-latest
195+
needs:
196+
- isort
197+
permissions:
198+
contents: write
199+
pull-requests: write
200+
steps:
201+
- name: Dependabot metadata
202+
id: dependabot-metadata
203+
uses: dependabot/fetch-metadata@v2
204+
with:
205+
github-token: "${{ secrets.GITHUB_TOKEN }}"
206+
- name: Merge PR
207+
if: steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' && steps.dependabot-metadata.outputs.dependency-names == 'isort'
208+
run: gh pr merge --auto --merge "$PR_URL"
209+
env:
210+
PR_URL: ${{github.event.pull_request.html_url}}
211+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/docker-image.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/flake8.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/isort.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/lfendings.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/pylint.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/pytest.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)