-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (45 loc) · 1.6 KB
/
pipeline.yml
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
name: Pylint and Flake8
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint flake8
# Run Pylint and Flake8 simultaneously using background tasks and redirect output to files.
- name: Run Pylint and Flake8
run: |
python_files=$(git ls-files '*.py')
if [[ -n "$python_files" ]]; then
echo "$python_files" | xargs pylint --disable=E0401 --disable=R0801 --disable=E0611 --disable=W0106 --disable=R0903 --disable=R0914 --disable=C0103 --disable=C3001 --disable=E1121 > pylint.out &
flake8 --max-line-length=100 --max-complexity=10 --ignore=E731,W503,E226,W504 $python_files > flake8.out &
wait
fi
# Check the output files for errors and fail the pipeline if either of them is not empty.
- name: Check for errors
run: |
if ! grep -q "10.00/10" pylint.out && [ -s flake8.out ]; then
echo "Pylint Errors:"
cat pylint.out
echo "Flake8 Errors:"
cat flake8.out
exit 1
elif ! grep -q "10.00/10" pylint.out; then
echo "Pylint Errors:"
cat pylint.out
exit 1
elif [ -s flake8.out ]; then
echo "Flake8 Errors:"
cat flake8.out
exit 1
fi