vale/report: Drop unused download_artifacts input #40
Workflow file for this run
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: test-vale-lint | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'vale/**' | |
| - '.github/workflows/test-vale-lint.yml' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'vale/**' | |
| - '.github/workflows/test-vale-lint.yml' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: test-vale-lint-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-lint: | |
| name: Test (${{ matrix.style_source }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - style_source: released | |
| use_local_styles: 'false' | |
| - style_source: local | |
| use_local_styles: 'true' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Checkout local Vale rules | |
| if: matrix.use_local_styles == 'true' | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: elastic/vale-rules | |
| path: vale-rules | |
| persist-credentials: false | |
| - name: Run lint action | |
| id: lint | |
| uses: ./vale/lint | |
| with: | |
| files: vale/test-fixtures/sample-violations.md | |
| fail_on_error: 'false' | |
| use_local_styles: ${{ matrix.use_local_styles }} | |
| styles_path: vale-rules | |
| disable_telemetry: 'true' | |
| upload_artifact: 'false' | |
| debug: 'true' | |
| - name: Verify issues were found | |
| run: | | |
| if [ ! -f issue_counts.txt ]; then | |
| echo "::error::issue_counts.txt was not generated" | |
| exit 1 | |
| fi | |
| source issue_counts.txt | |
| total=$((errors + warnings + suggestions)) | |
| echo "Found: $errors errors, $warnings warnings, $suggestions suggestions" | |
| if [ "$total" -eq 0 ]; then | |
| echo "::error::Expected issues in sample-violations.md but found none" | |
| exit 1 | |
| fi | |
| echo "Issues detected as expected (total: $total)" | |
| - name: Verify specific rules are working | |
| run: | | |
| echo "Checking that key rules fired..." | |
| rules_to_check=( | |
| "Elastic.Articles" | |
| "Elastic.BritishSpellings" | |
| "Elastic.WordChoice" | |
| "Elastic.OxfordComma" | |
| "Elastic.Wordiness" | |
| "Elastic.DontUse" | |
| "Elastic.Exclamation" | |
| ) | |
| failed=0 | |
| for rule in "${rules_to_check[@]}"; do | |
| if jq -e --arg r "$rule" 'any(.issues[]; .rule == $r)' vale_results.json > /dev/null; then | |
| echo "$rule fired" | |
| else | |
| echo "::error::$rule did not fire - rule may be broken" | |
| failed=1 | |
| fi | |
| done | |
| if [ "$failed" -eq 1 ]; then | |
| exit 1 | |
| fi | |
| echo "All key rules verified" | |
| - name: Verify JSON report was generated | |
| run: | | |
| if [ ! -f vale_results.json ]; then | |
| echo "::error::vale_results.json was not generated" | |
| exit 1 | |
| fi | |
| python3 -c " | |
| import json | |
| with open('vale_results.json') as f: | |
| data = json.load(f) | |
| assert 'summary' in data, 'missing summary' | |
| assert 'issues' in data, 'missing issues' | |
| assert isinstance(data['issues'], list), 'issues must be a list' | |
| for issue in data['issues']: | |
| assert set(issue.keys()) == {'path', 'line', 'rule', 'severity', 'message'}, f'bad keys: {issue.keys()}' | |
| print(f'OK: {len(data[\"issues\"])} issues in JSON report') | |
| " | |
| - name: Upload test artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-results-${{ matrix.style_source }} | |
| path: | | |
| vale_results.json | |
| issue_counts.txt | |
| retention-days: 5 | |
| test-python: | |
| name: Test Python scripts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Run path_filter tests | |
| working-directory: vale/lint | |
| run: python3 -m unittest test_path_filter -v | |
| - name: Run vale_reporter tests | |
| working-directory: vale/lint | |
| run: python3 -m unittest test_vale_reporter -v | |
| - name: Run render_report tests | |
| working-directory: vale/report | |
| run: python3 -m unittest test_render_report -v | |
| test-clean-file: | |
| name: Test clean file | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Checkout local Vale rules | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: elastic/vale-rules | |
| path: vale-rules | |
| persist-credentials: false | |
| - name: Run lint on clean file | |
| id: lint-clean | |
| uses: ./vale/lint | |
| with: | |
| files: vale/test-fixtures/clean-doc.md | |
| fail_on_error: 'true' | |
| use_local_styles: 'true' | |
| styles_path: vale-rules | |
| disable_telemetry: 'true' | |
| upload_artifact: 'false' | |
| debug: 'true' | |
| - name: Verify no issues found | |
| run: | | |
| if [ ! -f issue_counts.txt ]; then | |
| echo "::error::issue_counts.txt was not generated" | |
| exit 1 | |
| fi | |
| source issue_counts.txt | |
| total=$((errors + warnings + suggestions)) | |
| if [ "$total" -gt 0 ]; then | |
| echo "::error::Clean file should have 0 issues but found $total" | |
| echo "Report contents:" | |
| cat vale_results.json | |
| exit 1 | |
| fi | |
| echo "Clean file correctly produced no issues" | |
| test-vale-paths: | |
| name: Test vale-paths filtering | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Checkout local Vale rules | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: elastic/vale-rules | |
| path: vale-rules | |
| persist-credentials: false | |
| - name: Run lint with vale-paths filter | |
| id: lint-filtered | |
| uses: ./vale/lint | |
| with: | |
| files: vale/test-fixtures/team-a/doc.md vale/test-fixtures/team-b/doc.md | |
| vale-paths: vale/test-fixtures/team-a | |
| fail_on_error: 'false' | |
| use_local_styles: 'true' | |
| styles_path: vale-rules | |
| disable_telemetry: 'true' | |
| upload_artifact: 'false' | |
| debug: 'true' | |
| - name: Verify filtering worked | |
| run: | | |
| if [ ! -f vale_results.json ]; then | |
| echo "::error::vale_results.json was not generated" | |
| exit 1 | |
| fi | |
| if jq -e 'any(.issues[]; .path | contains("team-a"))' vale_results.json > /dev/null; then | |
| echo "team-a files were linted" | |
| else | |
| echo "::error::team-a files should have been linted" | |
| exit 1 | |
| fi | |
| if jq -e 'any(.issues[]; .path | contains("team-b"))' vale_results.json > /dev/null; then | |
| echo "::error::team-b files should have been filtered out" | |
| exit 1 | |
| else | |
| echo "team-b files were correctly filtered out" | |
| fi | |
| test-vale-paths-negation: | |
| name: Test vale-paths negation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Checkout local Vale rules | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: elastic/vale-rules | |
| path: vale-rules | |
| persist-credentials: false | |
| - name: Run lint with negation pattern | |
| id: lint-negation | |
| uses: ./vale/lint | |
| with: | |
| files: vale/test-fixtures/team-a/doc.md vale/test-fixtures/team-a/excluded/doc.md | |
| vale-paths: | | |
| vale/test-fixtures/team-a/** | |
| !vale/test-fixtures/team-a/excluded/** | |
| fail_on_error: 'false' | |
| use_local_styles: 'true' | |
| styles_path: vale-rules | |
| disable_telemetry: 'true' | |
| upload_artifact: 'false' | |
| debug: 'true' | |
| - name: Verify negation filtering worked | |
| run: | | |
| if [ ! -f vale_results.json ]; then | |
| echo "::error::vale_results.json was not generated" | |
| exit 1 | |
| fi | |
| if jq -e 'any(.issues[]; .path | contains("team-a/doc.md"))' vale_results.json > /dev/null; then | |
| echo "team-a/doc.md was linted" | |
| else | |
| echo "::error::team-a/doc.md should have been linted" | |
| exit 1 | |
| fi | |
| if jq -e 'any(.issues[]; .path | contains("team-a/excluded"))' vale_results.json > /dev/null; then | |
| echo "::error::team-a/excluded/doc.md should have been excluded by negation" | |
| exit 1 | |
| else | |
| echo "team-a/excluded/doc.md was correctly excluded by negation" | |
| fi | |
| test-yaml-files: | |
| name: Test YAML file linting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Run lint on YAML fixtures | |
| id: lint-yaml | |
| uses: ./vale/lint | |
| with: | |
| files: vale/test-fixtures/yaml/manifest.yml vale/test-fixtures/yaml/fields.yaml | |
| fail_on_error: 'false' | |
| use_local_styles: 'true' | |
| styles_path: vale/test-fixtures/local-vale-rules | |
| disable_telemetry: 'true' | |
| upload_artifact: 'false' | |
| debug: 'true' | |
| lint-yaml: 'true' | |
| - name: Verify YAML files were linted | |
| run: | | |
| if [ ! -f vale_results.json ]; then | |
| echo "::error::vale_results.json was not generated" | |
| exit 1 | |
| fi | |
| if jq -e 'any(.issues[]; .path | contains("manifest.yml")) and any(.issues[]; .path | contains("fields.yaml"))' vale_results.json > /dev/null; then | |
| echo "YAML and YML files were linted" | |
| else | |
| echo "::error::Expected both YAML fixtures in the Vale report" | |
| cat vale_results.json | |
| exit 1 | |
| fi | |
| fixture_count=$(jq '[.issues[] | select(.rule == "Elastic.Please")] | length' vale_results.json) | |
| if [ "$fixture_count" -ge 2 ]; then | |
| echo "Elastic.Please fired for both YAML fixtures" | |
| else | |
| echo "::error::Expected Elastic.Please to fire for both YAML fixtures but found $fixture_count" | |
| cat vale_results.json | |
| exit 1 | |
| fi | |
| test-repo-override: | |
| name: Test repo-level Vale overrides | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Checkout local Vale rules | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: elastic/vale-rules | |
| path: vale-rules | |
| persist-credentials: false | |
| - name: Run lint without override | |
| id: lint-no-override | |
| uses: ./vale/lint | |
| with: | |
| files: vale/test-fixtures/spelling-test.md | |
| fail_on_error: 'false' | |
| use_local_styles: 'true' | |
| styles_path: vale-rules | |
| disable_telemetry: 'true' | |
| upload_artifact: 'false' | |
| debug: 'true' | |
| - name: Verify spelling did not fire without override | |
| run: | | |
| if [ ! -f vale_results.json ]; then | |
| echo "::error::vale_results.json was not generated" | |
| exit 1 | |
| fi | |
| if jq -e 'any(.issues[]; .rule == "Elastic.Spelling")' vale_results.json > /dev/null; then | |
| echo "::error::Elastic.Spelling fired without an override" | |
| exit 1 | |
| fi | |
| echo "Elastic.Spelling correctly disabled by default" | |
| rm -f vale_results.json issue_counts.txt | |
| - name: Run lint with inline override | |
| id: lint-inline-override | |
| uses: ./vale/lint | |
| with: | |
| files: vale/test-fixtures/spelling-test.md | |
| fail_on_error: 'false' | |
| use_local_styles: 'true' | |
| styles_path: vale-rules | |
| disable_telemetry: 'true' | |
| upload_artifact: 'false' | |
| debug: 'true' | |
| vale-overrides: | | |
| Elastic.Spelling = warning | |
| - name: Verify spelling fired via inline override | |
| run: | | |
| if [ ! -f vale_results.json ]; then | |
| echo "::error::vale_results.json was not generated" | |
| exit 1 | |
| fi | |
| spelling_count=$(jq '[.issues[] | select(.rule == "Elastic.Spelling")] | length' vale_results.json) | |
| if [ "$spelling_count" -ge 2 ]; then | |
| echo "Elastic.Spelling fired $spelling_count times via inline vale-overrides" | |
| else | |
| echo "::error::Expected at least 2 Elastic.Spelling hits from inline override but found $spelling_count" | |
| echo "Report contents:" | |
| cat vale_results.json | |
| exit 1 | |
| fi | |
| rm -f vale_results.json issue_counts.txt | |
| - name: Place override file in repo root | |
| run: cp vale/test-fixtures/vale-overrides/.vale-overrides.ini .vale-overrides.ini | |
| - name: Run lint with override | |
| id: lint-override | |
| uses: ./vale/lint | |
| with: | |
| files: vale/test-fixtures/spelling-test.md | |
| fail_on_error: 'false' | |
| use_local_styles: 'true' | |
| styles_path: vale-rules | |
| disable_telemetry: 'true' | |
| upload_artifact: 'false' | |
| debug: 'true' | |
| - name: Verify spelling fired via override | |
| run: | | |
| if [ ! -f vale_results.json ]; then | |
| echo "::error::vale_results.json was not generated" | |
| exit 1 | |
| fi | |
| spelling_count=$(jq '[.issues[] | select(.rule == "Elastic.Spelling")] | length' vale_results.json) | |
| if [ "$spelling_count" -ge 2 ]; then | |
| echo "Elastic.Spelling fired $spelling_count times via .vale-overrides.ini" | |
| else | |
| echo "::error::Expected at least 2 Elastic.Spelling hits from repo override but found $spelling_count" | |
| echo "Report contents:" | |
| cat vale_results.json | |
| exit 1 | |
| fi | |
| upload-results: | |
| name: Upload combined results | |
| runs-on: ubuntu-latest | |
| needs: [test-lint, test-clean-file, test-vale-paths, test-vale-paths-negation, test-yaml-files, test-repo-override] | |
| if: always() && needs.test-lint.result == 'success' | |
| steps: | |
| - name: Download local styles results | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: test-results-local | |
| - name: Upload as vale-results for report action | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: vale-results | |
| path: | | |
| vale_results.json | |
| issue_counts.txt | |
| retention-days: 1 |