feat: enhance exercises with quality improvements and validation tools #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate YAML | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'skeletons/**' | |
| - 'exercises/**' | |
| - '**.yaml' | |
| - '**.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'skeletons/**' | |
| - 'exercises/**' | |
| - '**.yaml' | |
| - '**.yml' | |
| jobs: | |
| yamllint: | |
| name: YAML Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install yamllint | |
| run: pip install yamllint | |
| - name: Lint skeleton YAML files | |
| run: | | |
| yamllint -d '{extends: default, rules: {line-length: {max: 200}, truthy: disable, document-start: disable, comments-indentation: disable, indentation: {indent-sequences: whatever}, new-lines: {type: platform}}}' skeletons/ | |
| - name: Validate YAML syntax (kubectl dry-run) | |
| run: | | |
| echo "--- Checking YAML syntax ---" | |
| errors=0 | |
| for f in skeletons/*.yaml; do | |
| if ! python3 -c "import yaml, sys; yaml.safe_load_all(open('$f'))" 2>/dev/null; then | |
| echo "INVALID: $f" | |
| errors=$((errors + 1)) | |
| else | |
| echo "OK: $f" | |
| fi | |
| done | |
| if [ $errors -gt 0 ]; then | |
| echo "$errors file(s) failed validation" | |
| exit 1 | |
| fi | |
| echo "All YAML files valid" |