-
Notifications
You must be signed in to change notification settings - Fork 0
Add fast CI checks #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
IlyaasK
merged 1 commit into
hypeship/v0-docs-correctness
from
hypeship/v0-ci-correctness
Jul 2, 2026
+116
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| workdir="$(mktemp -d "${TMPDIR:-/tmp}/kernel-tfexamples.XXXXXX")" | ||
|
|
||
| cleanup() { | ||
| rm -rf "$workdir" | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| command -v terraform >/dev/null || { | ||
| echo "terraform is required to validate examples" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| mkdir -p "$workdir/plugins" | ||
|
|
||
| cd "$root" | ||
| go build -o "$workdir/plugins/terraform-provider-kernel" ./cmd/terraform-provider-kernel | ||
|
|
||
| cat >"$workdir/terraformrc" <<EOF | ||
| provider_installation { | ||
| dev_overrides { | ||
| "kernel/kernel" = "$workdir/plugins" | ||
| } | ||
|
|
||
| direct {} | ||
| } | ||
| EOF | ||
|
|
||
| validated=0 | ||
| while IFS= read -r example; do | ||
| echo "validating $example" | ||
| ( | ||
| cd "$example" | ||
| TF_CLI_CONFIG_FILE="$workdir/terraformrc" CHECKPOINT_DISABLE=1 \ | ||
| terraform validate -no-color | ||
| ) | ||
| validated=$((validated + 1)) | ||
| done < <(find examples -mindepth 1 -maxdepth 1 -type d -exec test -f '{}/main.tf' ';' -print | sort) | ||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| # Guard against a silent no-op: an empty examples tree (or a failed find) | ||
| # must not let the check pass without validating anything. | ||
| if [ "$validated" -eq 0 ]; then | ||
| echo "no example configurations found under examples/" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "validated $validated example configurations" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
|
|
||
| cd "$root" | ||
|
|
||
| command -v python3 >/dev/null || { | ||
| echo "python3 is required to check Markdown links" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| python3 - <<'PY' | ||
| import pathlib | ||
| import re | ||
| import subprocess | ||
| import sys | ||
| import urllib.parse | ||
|
|
||
| root = pathlib.Path.cwd() | ||
| tracked_markdown = subprocess.check_output(["git", "ls-files", "*.md"], text=True) | ||
| files = [pathlib.Path(p) for p in tracked_markdown.splitlines()] | ||
| # Matches both links and images; a missing local image target is just as | ||
| # broken a reference as a missing link target. | ||
| link_re = re.compile(r"!?\[[^\]]*\]\(([^)]+)\)") | ||
| title_re = re.compile(r'^(\S+)\s+"[^"]*"$') | ||
| errors: list[str] = [] | ||
|
|
||
| for path in files: | ||
| text = path.read_text(encoding="utf-8") | ||
| for match in link_re.finditer(text): | ||
| target = match.group(1).strip() | ||
| # Drop an optional quoted title: [text](path "title"). | ||
| titled = title_re.match(target) | ||
| if titled: | ||
| target = titled.group(1) | ||
| if not target or target.startswith(("#", "http://", "https://", "mailto:")): | ||
| continue | ||
|
|
||
| target = target.split("#", 1)[0] | ||
| target = urllib.parse.unquote(target) | ||
| if not target: | ||
| continue | ||
|
|
||
| resolved = (root / path.parent / target).resolve() | ||
| try: | ||
| resolved.relative_to(root) | ||
| except ValueError: | ||
| errors.append(f"{path}: link leaves repository: {target}") | ||
| continue | ||
|
|
||
| if not resolved.exists(): | ||
| errors.append(f"{path}: missing link target: {target}") | ||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| if errors: | ||
| print("\n".join(errors), file=sys.stderr) | ||
| sys.exit(1) | ||
| PY | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.