-
Notifications
You must be signed in to change notification settings - Fork 75
ci: update CI workflow to run TypeScript tests with new script #480
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
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
05bb78b
ci: update CI workflow to run TypeScript tests with new script with d…
DevelopmentCats 8658049
fix: update base reference detection
DevelopmentCats 4cf919d
ci: fetch the base branch for accurate context for diff check
DevelopmentCats a2b8378
feat: change to use dorny/paths-filter
DevelopmentCats 2b858dc
Merge branch 'main' into cat/tf-test-ci-rework
DevelopmentCats 576c509
ci: add modified files logging, and use modules filter instead of scr…
DevelopmentCats b6f2ff4
fix: reorder module change check in TypeScript test automation script
DevelopmentCats 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Auto-detect which TypeScript tests to run based on changed files from paths-filter | ||
| # Uses paths-filter outputs from GitHub Actions (CHANGED_FILES and SHARED_CHANGED env vars) | ||
| # Runs all tests if shared infrastructure changes | ||
| # | ||
| # This script only runs tests for changed modules. Documentation and template changes are ignored. | ||
|
|
||
| echo "==> Detecting changed files..." | ||
|
|
||
| if [[ -z "${CHANGED_FILES:-}" ]]; then | ||
| echo "✓ No files changed, skipping tests" | ||
| exit 0 | ||
| fi | ||
|
|
||
| CHANGED_FILES=$(echo "$CHANGED_FILES" | tr ' ' '\n') | ||
|
|
||
| if [[ "${SHARED_CHANGED:-false}" == "true" ]]; then | ||
| echo "==> Shared infrastructure changed" | ||
| echo "==> Running all tests for safety" | ||
| exec bun test | ||
| fi | ||
|
|
||
| echo "Changed files:" | ||
| echo "$CHANGED_FILES" | sed 's/^/ - /' | ||
| echo "" | ||
|
|
||
| MODULE_DIRS=() | ||
| while IFS= read -r file; do | ||
| if [[ "$file" =~ \.(md|png|jpg|jpeg|svg)$ ]]; then | ||
| continue | ||
| fi | ||
|
|
||
| if [[ "$file" =~ ^registry/([^/]+)/modules/([^/]+)/ ]]; then | ||
DevelopmentCats marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| namespace="${BASH_REMATCH[1]}" | ||
| module="${BASH_REMATCH[2]}" | ||
| module_dir="registry/${namespace}/modules/${module}" | ||
|
|
||
| if [[ -f "$module_dir/main.test.ts" ]] && [[ ! " ${MODULE_DIRS[*]} " =~ " ${module_dir} " ]]; then | ||
DevelopmentCats marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| MODULE_DIRS+=("$module_dir") | ||
| fi | ||
| fi | ||
| done <<< "$CHANGED_FILES" | ||
|
|
||
| if [[ ${#MODULE_DIRS[@]} -eq 0 ]]; then | ||
| echo "✓ No TypeScript tests to run" | ||
| echo " (documentation, templates, namespace files, or modules without tests)" | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "==> Running TypeScript tests for ${#MODULE_DIRS[@]} changed module(s):" | ||
| for dir in "${MODULE_DIRS[@]}"; do | ||
| echo " - $dir" | ||
| done | ||
| echo "" | ||
|
|
||
| exec bun test "${MODULE_DIRS[@]}" | ||
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.