-
Notifications
You must be signed in to change notification settings - Fork 16
147 lines (140 loc) · 4.73 KB
/
ci.yml
File metadata and controls
147 lines (140 loc) · 4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Test and build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
codeValidation:
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: Analysing the code with black
run: |
black $(git rev-parse --show-toplevel) --check
- 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
- 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: Running pytest
run: |
cd techsupport_bot
python3.11 -m pytest tests/ -p no:warnings
containerBuild:
runs-on: ubuntu-latest
needs:
- codeValidation
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:
- codeValidation
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:
- codeValidation
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:
- codeValidation
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 == 'flake8'
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:
- codeValidation
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}}