-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.13 KB
/
ci.yml
File metadata and controls
74 lines (64 loc) · 2.13 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
# © 2026 NetApp, Inc. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# See the NOTICE file in the repo root for trademark and attribution details.
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
lint:
name: validate-and-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install dev deps
run: pip install ruff
- name: Ruff lint — Python examples
run: ruff check python/
- name: Ruff format check
run: ruff format --check python/
- name: Verify example directories have READMEs
run: |
ERRORS=0
for dir in python ansible terraform; do
if [ ! -f "$dir/README.md" ]; then
echo "::error::Missing README.md in $dir/"
ERRORS=$((ERRORS + 1))
else
echo " OK $dir/README.md"
fi
done
[ "$ERRORS" -eq 0 ] || exit 1
- name: Verify NetApp copyright header on source files
run: |
MARKER="NetApp, Inc. All Rights Reserved"
MISSING=0
mapfile -t FILES < <(git ls-files \
'python/*.py' \
'ansible/*.yml' \
'terraform/**/*.tf' \
'docs/example-template/**/*.py' \
'docs/example-template/**/*.yml' \
'docs/example-template/**/*.tf' \
'.github/scripts/*.sh' \
'docs/*.html' \
'poc/*.html' \
| grep -Ev '(\.example$|requirements\.|inventory/|group_vars/)')
for f in "${FILES[@]}"; do
if ! head -10 "$f" | grep -q "$MARKER"; then
echo "::error file=$f::Missing NetApp copyright header"
MISSING=$((MISSING + 1))
fi
done
if [ "$MISSING" -gt 0 ]; then
echo "::error::$MISSING file(s) missing the required header. See CONTRIBUTING.md > Copyright headers."
exit 1
fi
echo "All checked files carry the NetApp copyright header."