-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (85 loc) · 2.54 KB
/
lint.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
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
name: lint
on:
pull_request:
branches:
- '*'
push:
branches:
- 'main'
paths:
- '**Dockerfile'
- '**.sh'
- '**.py'
workflow_dispatch:
env:
SHELLCHECK_URL: https://github.com/koalaman/shellcheck/releases/download/v0.9.0/shellcheck-v0.9.0.linux.x86_64.tar.xz
jobs:
hadolint:
name: 'hadolint (fail on error)'
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Lint data_augmentation Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: data_augmentation/Dockerfile
verbose: true
failure-threshold: error
- name: Lint feature_extraction Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: feature_extraction/Dockerfile
verbose: true
failure-threshold: error
shellcheck:
name: 'ShellCheck (fail on error)'
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install shellcheck
run: wget -O- -q $SHELLCHECK_URL | sudo tar -xJ -C /usr/local/bin --strip-components=1 --wildcards --no-same-owner --no-same-permissions '*/shellcheck'
- uses: liskin/gh-problem-matcher-wrap@v2
with:
action: add
linters: gcc
- name: Run shellcheck
run: |
run_shellcheck() {
args=("$0" "$@")
for arg in "${args[@]}"; do
SHELLCHECK_OUT=$(/usr/local/bin/shellcheck --format=gcc "$arg") && :;
if [ -n "$SHELLCHECK_OUT" ];then
echo "$SHELLCHECK_OUT"
fi
# fail on error
if (echo "$SHELLCHECK_OUT" | grep -q -P '^(.*):(\d+):(\d+):\s+(?:fatal\s+)?(error):\s+(.*)$' && :)
then
exit 1
fi
done
}
export -f run_shellcheck
find . -name '*.sh' -exec bash -c 'set -e; run_shellcheck "$@"' {} +
- uses: liskin/gh-problem-matcher-wrap@v2
with:
action: remove
linters: gcc
flake8:
name: 'Flake8 (annotations only)'
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install flake8
run: pip install flake8~=6.0.0
- name: Run flake8
uses: liskin/gh-problem-matcher-wrap@v2
with:
linters: flake8
run: flake8 --exit-zero .