|
| 1 | +name: lint |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + shellcheck: |
| 14 | + runs-on: ubuntu-24.04 |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v5 |
| 17 | + - name: ShellCheck all run.sh / cleanup.sh |
| 18 | + run: | |
| 19 | + set -e |
| 20 | + # SC2015: `[ cond ] && ok ... || ng ...` is intentional in assert lines |
| 21 | + # because both helpers are simple printf wrappers and ng exits anyway. |
| 22 | + fail=0 |
| 23 | + while IFS= read -r f; do |
| 24 | + echo "::group::shellcheck $f" |
| 25 | + if ! shellcheck --exclude=SC2015 "$f"; then fail=1; fi |
| 26 | + echo "::endgroup::" |
| 27 | + done < <(find . -type f \( -name 'run.sh' -o -name 'cleanup.sh' -o -path './lib/*.sh' \)) |
| 28 | + exit "$fail" |
| 29 | +
|
| 30 | + yamllint: |
| 31 | + runs-on: ubuntu-24.04 |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v5 |
| 34 | + - uses: ibiqlik/action-yamllint@v3 |
| 35 | + with: |
| 36 | + config_file: .yamllint.yml |
| 37 | + |
| 38 | + markdownlint: |
| 39 | + runs-on: ubuntu-24.04 |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v5 |
| 42 | + - uses: DavidAnson/markdownlint-cli2-action@v20 |
| 43 | + with: |
| 44 | + globs: | |
| 45 | + **/*.md |
| 46 | + config: .markdownlint.jsonc |
| 47 | + |
| 48 | + kubectl-dry-run: |
| 49 | + runs-on: ubuntu-24.04 |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v5 |
| 52 | + - name: Install kubectl |
| 53 | + uses: azure/setup-kubectl@v4 |
| 54 | + - name: kubectl --dry-run=client on every manifest |
| 55 | + run: | |
| 56 | + set -e |
| 57 | + fail=0 |
| 58 | + # Skip CRDs that the client doesn't know about (Calico/Cilium/Istio/SPIRE/Gatekeeper). |
| 59 | + # We validate plain k8s manifests only. |
| 60 | + while IFS= read -r f; do |
| 61 | + case "$f" in |
| 62 | + */policy-db-l4.yaml|*/policy-cart-l7.yaml|*/policy-deny-staging-to-prod.yaml|\ |
| 63 | + */policy-allow-audit-exception.yaml|*/peer-auth-strict.yaml|\ |
| 64 | + */authz-httpbin-cart-only.yaml|*/template-required-labels.yaml|\ |
| 65 | + */constraint-required-labels.yaml|*/template-no-pod-without-netpol.yaml|\ |
| 66 | + */constraint-no-pod-without-netpol.yaml|*/sync-config.yaml) |
| 67 | + echo "skip CRD-bound: $f"; continue;; |
| 68 | + esac |
| 69 | + echo "::group::kubectl dry-run $f" |
| 70 | + if ! kubectl apply --dry-run=client -f "$f"; then fail=1; fi |
| 71 | + echo "::endgroup::" |
| 72 | + done < <(find . -type f -path '*/manifests/*.yaml') |
| 73 | + exit "$fail" |
0 commit comments