Skip to content

Merge pull request #55 from NetApp/feat/go-scripts #45

Merge pull request #55 from NetApp/feat/go-scripts

Merge pull request #55 from NetApp/feat/go-scripts #45

# © 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: Validate Examples
on:
push:
branches: [main]
paths:
- "ansible/**"
- "terraform/**"
- "go/**"
pull_request:
branches: [main]
paths:
- "ansible/**"
- "terraform/**"
- "go/**"
permissions:
contents: read
jobs:
ansible-lint:
name: Ansible — syntax & lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install Ansible toolchain
run: pip install ansible ansible-lint
- name: Install NetApp ONTAP collection
run: ansible-galaxy collection install -r ansible/requirements.yml
- name: Syntax check playbooks
run: |
for f in ansible/*.yml; do
[ "$(basename "$f")" = "requirements.yml" ] && continue
echo "Checking $f …"
ansible-playbook --syntax-check "$f" -i ansible/inventory/hosts.yml
done
- name: Run ansible-lint
run: ansible-lint ansible/*.yml --exclude ansible/requirements.yml --profile min
terraform-validate:
name: Terraform — fmt, validate & lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: hashicorp/setup-terraform@v4
with:
terraform_version: "1.7"
- name: Install tflint
run: |
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
- name: Validate Terraform modules
run: |
ERRORS=0
for dir in terraform/*/; do
echo "=== $(basename "$dir") ==="
echo " fmt check …"
if ! terraform -chdir="$dir" fmt -check; then
echo " FAIL: terraform fmt"
ERRORS=$((ERRORS + 1))
fi
echo " init …"
terraform -chdir="$dir" init -backend=false -input=false > /dev/null 2>&1 || true
echo " validate …"
if ! terraform -chdir="$dir" validate; then
echo " FAIL: terraform validate"
ERRORS=$((ERRORS + 1))
fi
echo " tflint …"
if ! tflint --chdir="$dir" --no-color; then
echo " WARN: tflint reported issues"
fi
echo ""
done
[ "$ERRORS" -eq 0 ] || exit 1
go-vet:
name: Go — vet & build-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
cache-dependency-path: go/go.sum
- name: go vet
working-directory: go
run: go vet ./...
- name: Build-check all programs
working-directory: go
run: |
ERRORS=0
for dir in */; do
[ -f "${dir}main.go" ] || continue
echo "Building ${dir} …"
(cd "${dir}" && go build -o /dev/null .) || ERRORS=$((ERRORS + 1))
done
[ "$ERRORS" -eq 0 ] || exit 1